Update to FreeBSD head 2018-09-17

Git mirror commit 6c2192b1ef8c50788c751f878552526800b1e319.

Update #3472.
This commit is contained in:
Sebastian Huber
2018-08-22 14:59:50 +02:00
parent 3becda1fef
commit 3489e3b639
579 changed files with 26749 additions and 11388 deletions

View File

@@ -59,8 +59,8 @@ __FBSDID("$FreeBSD$");
/* Assert that pointer p is aligned to at least align bytes */
#define assert_aligned(p, align) assert((((uintptr_t)p) & ((align) - 1)) == 0)
struct protocol *protocols;
struct timeout *timeouts;
static struct protocol *protocols;
static struct timeout *timeouts;
static struct timeout *free_timeouts;
static int interfaces_invalidated;
void (*bootp_packet_handler)(struct interface_info *,
@@ -549,17 +549,29 @@ interface_set_mtu_priv(char *ifname, u_int16_t mtu)
{
struct ifreq ifr;
int sock;
u_int16_t old_mtu;
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
error("Can't create socket");
memset(&ifr, 0, sizeof(ifr));
old_mtu = 0;
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
ifr.ifr_mtu = mtu;
if (ioctl(sock, SIOCSIFMTU, &ifr) == -1)
warning("SIOCSIFMTU failed (%d): %s", mtu,
if (ioctl(sock, SIOCGIFMTU, (caddr_t)&ifr) == -1)
warning("SIOCGIFMTU failed (%s): %s", ifname,
strerror(errno));
else
old_mtu = ifr.ifr_mtu;
if (mtu != old_mtu) {
ifr.ifr_mtu = mtu;
if (ioctl(sock, SIOCSIFMTU, &ifr) == -1)
warning("SIOCSIFMTU failed (%d): %s", mtu,
strerror(errno));
}
close(sock);
}