[patch] ipv6 prefix lifetime is not updated when address is updated through SIOCAIFADDR_IN6

Guy Yur guyyur at gmail.com
Sun Oct 5 20:59:22 UTC 2014


Hi,

I am running dhcpcd 6.4.3 on 11.0-CURRENT r271879M
to get an ipv6 prefix from my ISP.
The prefix is received with a lifetime of 86400 seconds.
dhcpcd adds an address using the prefix with pltime and vltime of 86400.
Before the address expires dhcpcd refreshes it but the interface route
for the prefix is still deleted after 86400 seconds.

dhcpcd uses SIOCAIFADDR_IN6 to update the address and the kernel
doesn't update the prefix lifetime if the prefix already exists.
Since ndpr_lastupdate is also not updated the prefix will expire.

The issue doesn't happen when updating lifetime using ifconfig
with pltime and vltime since ifconfig removes the address before
adding it (each ifconfig invocation will reset the prefix lifetime).

I created a patch to update the prefix lifetimes in SIOCAIFADDR_IN6
from the added address's lifetime.
If there are two addresses with same prefix but different lifetimes
it means the last one added will set the prefix lifetime.

Another way will be to move the check in SIOCAIFADDR_IN6 to a new
function nd6_prelist_update that will call nd6_prefix_lookup.
If the prefix doesn't exist, call nd6_prelist_add.
If it does exist, copy lifetimes (and ndpr_flags?).


Before:

# netstat -rn -f inet6
WWWW:XXXX:YYYY:ZZZZ::/64           link#1                        U          lan0
WWWW:XXXX:YYYY:ZZZZ::1             link#1                        UHS         lo0
...


After more than 86400 seconds:

# ifconfig -L lan0 inet6
lan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8000b<RXCSUM,TXCSUM,VLAN_MTU,LINKSTATE>
        inet6 fe80::AAAA:BBBB:CCCC:DDDD%lan0 prefixlen 64 scopeid 0x1
        inet6 WWWW:XXXX:YYYY:ZZZZ::1 prefixlen 64 pltime 57257 vltime 57257
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

# ndp -p
WWWW:XXXX:YYYY:ZZZZ::/64 if=lan0
flags=L vltime=0, pltime=0, expired, ref=1
  No advertising router
...

# netstat -rn -f inet6
WWWW:XXXX:YYYY:ZZZZ::1             link#1                        UHS         lo0
...


Regards,
Guy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: update_prefix_ltimes.patch
Type: application/octet-stream
Size: 1688 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20141005/ba178fdc/attachment.obj>


More information about the freebsd-net mailing list