[quagga-dev 7788] IPv6 Multicast Hop Limit for OSPFv3

Mike Pontillo pontillo at gmail.com
Tue Feb 9 23:58:55 GMT 2010


Hi all,

   Today I was doing some interoperability testing between a
proprietary OSPFv3 implementation and Quagga.

   The proprietary implementation enforces the old OSPFv2 MUST
requirement that OSPF multicast packets need to be sent with a TTL of
1. That is, if it receives an OSPFv3 packet with a hop limit set to
something other than 1, it rejects the packet.

   Now, there is a "should" in RFC 5340 that suggests, but does not
require setting the hop limit to 1. From
http://tools.ietf.org/html/rfc5340#appendix-A.1 -

http://tools.ietf.org/html/rfc5340#appendix-A.1

   o  Use of IPv6 multicast.  Some OSPF messages are multicast when sent
      over broadcast networks.  Two distinct IP multicast addresses are
      used.  Packets sent to these multicast addresses should never be
      forwarded; they are meant to travel a single hop only.  As such,
      the multicast addresses have been chosen with link-local scope and
      packets sent to these addresses should have their IPv6 Hop Limit
      set to 1.

   Based on this "should", I wrote up a quick patch that would set the
hop limit to 1 for multicast packets sent on the OSPFv3 socket. (see
attachment) I wasn't sure if it really needed to be #ifdef'd, since it
should work on any RFC 3493 compliant system, and I'm guessing any
systems that don't support that probably won't be compiling OSPFv3
anyway. But I followed the pattern of the existing checksum disable
code.

   Is this something worth fixing in Quagga? (I already plan to nag
about getting the proprietary implementation fixed.)

Regards,
Mike
-------------- next part --------------
diff -urNad quagga-0.99.13~/ospf6d/ospf6_network.c quagga-0.99.13/ospf6d/ospf6_network.c
--- quagga-0.99.13~/ospf6d/ospf6_network.c      2009-05-08 08:46:43.000000000 -0700
+++ quagga-0.99.13/ospf6d/ospf6_network.c       2010-02-09 14:49:05.000000000 -0800
@@ -76,6 +76,19 @@
 #endif /* DISABLE_IPV6_CHECKSUM */
 }

+void
+ospf6_set_hop_limit (void)
+{
+  int hop_limit = 1;
+#ifndef DISABLE_OSPF6_HOP_LIMIT
+  if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
+                  &hop_limit, sizeof (hop_limit)) < 0)
+    zlog_warn ("Network: set ospf6 hop limit failed: %s", safe_strerror (errno));
+#else
+  zlog_warn ("Network: Not setting ospf6 hop limit to 1");
+#endif /* DISABLE_IPV6_CHECKSUM */
+}
+
 /* Make ospf6d's server socket. */
 int
 ospf6_serv_sock (void)
@@ -103,6 +116,7 @@
   ospf6_reset_mcastloop ();
   ospf6_set_pktinfo ();
   ospf6_set_checksum ();
+  ospf6_set_hop_limit ();

   /* setup global in6_addr, allspf6 and alldr6 for later use */
   inet_pton (AF_INET6, ALLSPFROUTERS6, &allspfrouters6);


More information about the Quagga-dev mailing list