[Olsr-dev] mtu problem with multicast ipv6 packets

John Hay (spam-protected)
Sun Oct 19 21:30:26 CEST 2008


Hi,

While debugging some other stuff, I noticed that a lot of the olsr packets
on our network was fragmented. Looking into it a bit, it turns out that
while the interface mtu might be 1500 bytes, on FreeBSD (and I would guess
most other BSDs) by default multicast IPv6 packets will be transmitted with
a mtu of 1280 bytes. RFC 3542 Section 11.1 gives the reasoning behind it.

So here is my patch to clip the mtu in the IPv6 case. I have hardcoded
OLSR_IPV6_MTU, but at least on the BSDs it is defined in netinet/ip6.h as
IPV6_MMTU. It did not look as if ip6.h is pulled in at the moment, so I did
not know if we should start now. :-)

John
-- 
John Hay -- (spam-protected) / (spam-protected)


--- src/interfaces.h.orig	2008-10-03 14:45:07.000000000 +0200
+++ src/interfaces.h	2008-10-19 17:28:53.000000000 +0200
@@ -178,7 +178,8 @@
 };
 
 
-#define OLSR_DEFAULT_MTU             1500
+#define OLSR_DEFAULT_MTU    1500
+#define OLSR_IPV6_MTU       1280 /* RFC 3542 Section 11.1 multicast packets */
 
 /* Ifchange actions */
 
--- src/unix/ifnet.c.orig	2008-10-03 14:45:07.000000000 +0200
+++ src/unix/ifnet.c	2008-10-19 17:33:31.000000000 +0200
@@ -237,6 +237,8 @@
     ifp->int_mtu = 0;
   else
     {
+      if ((olsr_cnf->ip_version == AF_INET6) && (ifr.ifr_mtu > OLSR_IPV6_MTU))
+	ifr.ifr_mtu = OLSR_IPV6_MTU;
       ifr.ifr_mtu -= (olsr_cnf->ip_version == AF_INET6) ? UDP_IPV6_HDRSIZE : UDP_IPV4_HDRSIZE;
 
       if(ifp->int_mtu != ifr.ifr_mtu)
@@ -533,6 +535,8 @@
     }
 
   ifp->int_mtu = OLSR_DEFAULT_MTU;
+  if (olsr_cnf->ip_version == AF_INET6)
+    ifp->int_mtu = OLSR_IPV6_MTU;
 
   ifp->int_mtu -= (olsr_cnf->ip_version == AF_INET6) ? UDP_IPV6_HDRSIZE : UDP_IPV4_HDRSIZE;
 
@@ -837,6 +841,8 @@
     ifs.int_mtu = OLSR_DEFAULT_MTU;
   else
     ifs.int_mtu = ifr.ifr_mtu;
+  if ((olsr_cnf->ip_version == AF_INET6) && (ifr.ifr_mtu > OLSR_IPV6_MTU))
+    ifr.ifr_mtu = OLSR_IPV6_MTU;
 
   ifs.int_mtu -= (olsr_cnf->ip_version == AF_INET6) ? UDP_IPV6_HDRSIZE : UDP_IPV4_HDRSIZE;
 




More information about the Olsr-dev mailing list