Subject: Re: /etc/rc.d/network restart stops delivery of ipv6 packets
To: None <tech-net@netbsd.org>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-net
Date: 09/06/2005 17:11:05
In article <20050906085414.GL17019@che.ojctech.com>,
	David Young <dyoung@pobox.com> writes:
> If I restart networking on a NetBSD host with '/etc/rc.d/network restart',
> IPv6 stops working.

This has bothered me, too, and I believe I've come up with a solution.

I see it as a more general problem. I expect '/etc/rc.d/network restart'
to yield the same network configuration everytime. Also, shutting down to
single-user, then exiting the single-user shell, should yield the same
network configuration as after the initial start up.

> 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.

Yes. The solution I came up with, is to do exactly that:  I would add a
new special character to the "/etc/ifconfig.xxx" files, "-", which only
operates on the way down.  For example, I have:

/etc/ifconfig.sk0:
------------------
inet 209.100.230.158 netmask 255.255.255.240
inet 192.168.8.9 netmask 255.255.255.0 alias
inet6 2001:5c0:81c1:80:: eui64 prefixlen 64 alias
-inet 209.100.230.158 -alias
-inet 192.168.8.9 -alias
-inet6 2001:5c0:81c1:80:: eui64 -alias

I'm deleting the IPv4 aliases, because otherwise alternate restarts
make the internet unusable for that host. (Packets go to the NAT per
the routing table, but the second address to be configured is always
the source address.)  This example demonstrates the need for a new
special character:  there's no way to program the desired action on
shutdown from the start-up commands, except in the simplest cases.

I also added a a way to dismount the NFS mounts before bringing the
network down. This is not useful if your "/usr" is NFS mounted, but
it works for my situation.

Here's the patch:

  ftp://ftp.netbsd.org/pub/NetBSD/misc/fredb/clean-shutdown.diff

-- 
Frederick