[radvd-devel-l] radvd mtu issues

Pekka Savola pekkas at netcore.fi
Fri Oct 28 04:06:16 EDT 2005


Hi,

On Wed, 26 Oct 2005, Sten Spans wrote:
> I did run into this issue:
> Oct 26 12:41:45 ford radvd[1343]: AdvLinkMTU for intern (9000) must be zero 
> or between 1280 and 1500
> Oct 26 12:41:45 ford radvd[1343]: error parsing or activating the config 
> file: /etc/radvd.conf
....
> the check in linux-device.c is a bit braindead imho
> with current jumboframe gigabit environments.
> Any chance it could be enhanced somewhat ?

Indeed.  Please try the attached patch.

-- 
Pekka Savola                 "You each name yourselves king, yet the
Netcore Oy                    kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings
-------------- next part --------------
Index: device-linux.c
===================================================================
RCS file: /work/cvsroot/radvd/device-linux.c,v
retrieving revision 1.14
diff -u -r1.14 device-linux.c
--- device-linux.c	18 Oct 2005 19:17:29 -0000	1.14
+++ device-linux.c	28 Oct 2005 08:04:50 -0000
@@ -31,12 +31,13 @@
 int
 setup_deviceinfo(int sock, struct Interface *iface)
 {
-	struct ifreq	ifr;
+	struct ifreq	ifr, ifr2;
 	struct AdvPrefix *prefix;
 	char zero[HWADDR_MAX];
 	
 	strncpy(ifr.ifr_name, iface->Name, IFNAMSIZ-1);
 	ifr.ifr_name[IFNAMSIZ-1] = '\0';
+	memcpy(&ifr2, &ifr, sizeof(struct ifreq));
 
 	if (ioctl(sock, SIOCGIFHWADDR, &ifr) < 0)
 	{
@@ -48,18 +49,25 @@
 	dlog(LOG_DEBUG, 3, "hardware type for %s is %d", iface->Name,
 		ifr.ifr_hwaddr.sa_family); 
 
+	if (ioctl(sock, SIOCGIFMTU, &ifr2) < 0)
+		flog(LOG_WARNING, "ioctl(SIOCGIFMTU) failed for %s: %s",
+			iface->Name, strerror(errno));
+
+	if (ifr2.ifr_mtu) 
+		dlog(LOG_DEBUG, 3, "mtu for %s is %d", iface->Name, ifr2.ifr_mtu);
+
 	switch(ifr.ifr_hwaddr.sa_family)
         {
 	case ARPHRD_ETHER:
 		iface->if_hwaddr_len = 48;
 		iface->if_prefix_len = 64;
-		iface->if_maxmtu = 1500;
+		iface->if_maxmtu = (ifr2.ifr_mtu) ? ifr2.ifr_mtu : 1500;
 		break;
 #ifdef ARPHRD_FDDI
 	case ARPHRD_FDDI:
 		iface->if_hwaddr_len = 48;
 		iface->if_prefix_len = 64;
-		iface->if_maxmtu = 4352;
+		iface->if_maxmtu = (ifr2.ifr_mtu) ? ifr2.ifr_mtu : 4352;
 		break;
 #endif /* ARPHDR_FDDI */
 #ifdef ARPHRD_ARCNET


More information about the radvd-devel-l mailing list