[Olsr-dev] mtu problem with multicast ipv6 packets

John Hay (spam-protected)
Mon Mar 23 19:10:46 CET 2009


Hi,

Last year I reported a problem with FreeBSD (and I guess the others with
KAME derived IPv6 stacks) where they would limit multicast packets to
1280 bytes. This caused fragmentation inside the stack. Possible solutions
floated around, but was never committed.

Here is a fix that only touch one file. The effect of setting the socket
option IPV6_USE_MIN_MTU to 0 is that the stack will not limit multicast
packets to 1280 anymore, but to the mtu of the interface.

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


--- src/bsd/net.c.orig	2009-03-17 23:52:47.000000000 +0200
+++ src/bsd/net.c	2009-03-21 21:46:26.000000000 +0200
@@ -466,6 +466,9 @@
   /* See netinet6/in6.h */
   struct ipaddr_str addrstr;
   struct ipv6_mreq mcastreq;
+#ifdef IPV6_USE_MIN_MTU
+  int on;
+#endif
 
   mcastreq.ipv6mr_multiaddr = ifs->int6_multaddr.sin6_addr;
   mcastreq.ipv6mr_interface = ifs->if_index;
@@ -491,6 +494,19 @@
     return -1;
   }
 
+#ifdef IPV6_USE_MIN_MTU
+  /*
+   * This allow multicast packets to use the full interface MTU and not
+   * be limited to 1280 bytes.
+   */
+  on = 0;
+  if (setsockopt(sock, IPPROTO_IPV6, IPV6_USE_MIN_MTU, (char *)&on, sizeof(on)) < 0) {
+    perror("IPV6_USE_MIN_MTU failed");
+    close(sock);
+    return -1;
+  }
+#endif
+
   OLSR_PRINTF(3, "OK\n");
   return 0;
 }




More information about the Olsr-dev mailing list