If we receieve an MTU option through BOOTP/DHCP, accept it; this is
critical on GigE networks on which jumbo frames are used - until
we do this we can't handle large IP datagrams.
diff --git a/ipconfig/bootp_proto.c b/ipconfig/bootp_proto.c
index 7e2b02d..7e6936c 100644
--- a/ipconfig/bootp_proto.c
+++ b/ipconfig/bootp_proto.c
@@ -121,6 +121,10 @@
memcpy(&dev->bootpath, ext, len);
dev->bootpath[len] = '\0';
break;
+ case 26: /* interface MTU */
+ if ( len == 2 )
+ dev->mtu = (ext[0] << 8) + ext[1];
+ break;
case 28: /* broadcast addr */
if (len > 4)
len = 4;
diff --git a/ipconfig/dhcp_proto.c b/ipconfig/dhcp_proto.c
index a01b89d..733f0b5 100644
--- a/ipconfig/dhcp_proto.c
+++ b/ipconfig/dhcp_proto.c
@@ -24,8 +24,9 @@
12, /* host name */
15, /* domain name */
17, /* boot path */
+ 26, /* interface mtu */
28, /* broadcast addr */
- 40, /* NIS domain name */
+ 40, /* NIS domain name (why?) */
};
static __u8 dhcp_discover_hdr[] = {
diff --git a/ipconfig/main.c b/ipconfig/main.c
index 0b6d24b..57fb874 100644
--- a/ipconfig/main.c
+++ b/ipconfig/main.c
@@ -67,6 +67,10 @@
if (do_not_config)
return;
+ if (netdev_setmtu(dev))
+ printf("IP-Config: failed to set MTU on %s to %u\n",
+ dev->name, dev->mtu);
+
if (netdev_setaddress(dev))
printf("IP-Config: failed to set addresses on %s\n", dev->name);
if (netdev_setdefaultroute(dev))
diff --git a/ipconfig/netdev.c b/ipconfig/netdev.c
index 1f0f1d4..b732c46 100644
--- a/ipconfig/netdev.c
+++ b/ipconfig/netdev.c
@@ -100,6 +100,16 @@
return 0;
}
+int netdev_setmtu(struct netdev *dev)
+{
+ struct ifreq ifr;
+
+ copy_name(dev, &ifr);
+ ifr.ifr_mtu = dev->mtu;
+
+ return ioctl(cfd, SIOCSIFMTU, &ifr);
+}
+
static int netdev_gif_addr(struct ifreq *ifr, int cmd, __u32 *ptr)
{
struct sockaddr_in *sin = (struct sockaddr_in *)&ifr->ifr_addr;
diff --git a/ipconfig/netdev.h b/ipconfig/netdev.h
index b57d482..5c56f09 100644
--- a/ipconfig/netdev.h
+++ b/ipconfig/netdev.h
@@ -64,6 +64,7 @@
int netdev_up(struct netdev *dev);
int netdev_down(struct netdev *dev);
int netdev_init_if(struct netdev *dev);
+int netdev_setmtu(struct netdev *dev);
static inline int netdev_running(struct netdev *dev)
{