Subject: /etc/rc.d/network restart stops delivery of ipv6 packets
To: None <tech-net@netbsd.org>
From: David Young <dyoung@pobox.com>
List: tech-net
Date: 09/06/2005 03:54:14
If I restart networking on a NetBSD host with '/etc/rc.d/network restart',
IPv6 stops working.  The reason is that the host routes corresponding to
the IPv6 addresses assigned to every interface get deleted.  Those routes
have flags UHL before they are deleted.  As the host sends/receives IPv6
packets, it creates "cloned" routes (flags UHLc) for the IPv6 addresses
on its interfaces.  The way that NetBSD's IPv6 stack works is that it
will not locally deliver packets whose destination address resolves to a
cloning route, not even if the route points at the loopback interface,
and not even if the destination address is assigned to some interface.
See src/sys/netinet6/ip6_input.c, revision 1.78, line 497.

It is possible to recover by running 'ifconfig ifN inet6 addr delete'
for each IPv6 address on each interface, and then 'ifconfig ifN inet6
addr' to add them back again.

It seems that the kernel is being too strict, but consider the comments
in KAME's src/sys/netinet6/ip6_input.c,

         * XXX: some OSes automatically make a cloned route for the destination
         * of an outgoing packet.  If the outgoing interface of the packet
         * is a loopback one, the kernel would consider the packet to be
         * accepted, even if we have no such address assinged on the interface.
         * We check the cloned flag of the route entry to reject such cases,
         * assuming that route entries for our own addresses are not made by
         * cloning (it should be true because in6_addloop explicitly installs
         * the host route).  However, we might have to do an explicit check
         * while it would be less efficient.  Or, should we rather install a
         * reject route for such a case?

Apologies if I'm not making much sense, it's late.

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933