On Tue, Aug 06, 2013 at 12:53:38AM +0000, Olivier Mehani wrote:
> On 2013-07-24, Rolf Sommerhalder <[email protected]> wrote:
> > The v6 default route now persists once I killed dhclient, which was
> > renewing the v4 address every 54 seconds or so due to a short lease
> > time!
> 
> OK, I can confirm this reliably:
> 
>   $ sudo /sbin/route add -inet6 default -gateway 2001:41D0:1:XX:ff:ff:ff:ff
>   $ route -n show -inet6 | grep default
>   default                            2001:41d0:1:XX:ff:ff:ff:ff   UGS 0       
>  0     -     8 sis0
>   $ sudo pkill dhclient && sudo dhclient sis0
>   DHCPREQUEST on sis0 to 255.255.255.255 port 67
>   DHCPACK from 91.121.XX.XX (00:30:48:XX:XX:XX)
>   Unexpected DHCPACK from 91.121.XX.XX (00:04:4d:XX:XX:XX). State #4 bound to 
> 91.121.XX.XX -- renewal in 300 seconds.
>   $ route -n show -inet6 | grep default
>   $ 
> 
> > I am unsure why dhclient touches the v6 routing table. Is this an
> > unwanted side effect when it eventually refreshes the v4 default
> > gateway, e.g. a bug?

It should not be touching the v6 routing table. If it does, then this is
a bug. priv_flush_routes() assumes that specifying mib[3] = AF_INET will
prevent any IPv6 routes from being reported and thus zapped. If this is
not working ...

> 
> Same here. This is odd. Maybe the IPv6 default route gets overwritten at
> the same time as the IPv4 one. 

Since add_route() explicitly specifies *.sin_family = AF_INET, the
assumption again is that IPv6 routing table entries should not be
affected.

> 
> I wonder if the very last change to dhclient in CURRENT (1.260 [0])
> wouldn't actually fix the problem, at least as a side effect in this
> case: it only apply changes when the lease differs from the previously
> obtained one.
> 
> Prior to this change, bind_lease() unconditionally called
> flush_routes(). However, flush_routes() in [1] is documented to be
> equivalent to `route -q $rdomain -n flush -inet -iface $interface` (note
> the -inet), which might contradict my understanding of the cause.
> 
> Anyway, I build dhclient from current today, and tried running it. This
> time, I don't seem to lose my route!
> 
>   $ sudo /sbin/route add -inet6 default -gateway 2001:41D0:1:XX:ff:ff:ff:ff
>   add net default: gateway 2001:41D0:1:XX:ff:ff:ff:ff
>   $ route -n show -inet6 | grep default
>   default                            2001:41d0:1:XX:ff:ff:ff:ff   UGS 0       
>  0     -     8 sis0 
>   $ sudo pkill dhclient && sudo ./dhclient sis0
>   DHCPREQUEST on sis0 to 255.255.255.255 port 67
>   DHCPACK from 91.121.XX.XX (00:30:48:XX:XX:XX)
>   bound to 91.121.XX.XX -- renewal in 300 seconds.
>   $  route -n show -inet6 | grep default
>   default                            2001:41d0:1:XX:ff:ff:ff:ff   UGS 0       
>  0     -     8 sis0 
>   $
> 
> What's better, it doesn't seem to go away anymore:
> 
>   $ while : ; do sudo /sbin/route add -inet6 default -gateway 
> 2001:41D0:1:XX:ff:ff:ff:ff -expire 0; time while route show -inet6 | grep -q 
> default; do sleep 1; echo -n .; done; done | tee routelog 2>&1
>   route: writing to routing socket: File exists
>   add net default: gateway 2001:41D0:1:XX:ff:ff:ff:ff: File exists
>   ............... (It keeps going, rather than failing every 5 minutes).
> 
> Running dhclient from CURRENT therefore seems to be a good workaround,
> but I doubt the lease management is the cause of the problem. Rather, I
> still suspect that flush_routes() is closer to the culprit.
> 
> I'll file a bug.

Well, if it's working in -current, what's the bug?

.... Ken

> 
> [0] 
> http://www.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.260
> [1] http://www.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/kroute.c?rev=1.55
> 
> -- 
> Olivier Mehani <[email protected]>
> PGP fingerprint: 4435 CF6A 7C8D DD9B E2DE  F5F9 F012 A6E2 98C6 6655

Reply via email to