Page MenuHomeFreeBSD

Separate ioctl address prefix management from RA prefix management as we have no API for controlling the latter.
Needs ReviewPublic

Authored by guyyur_gmail.com on May 12 2018, 6:18 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This fixes a long standing problem where addresses added with non /128
prefixes and non infinite address lifetimes would register a prefix route
which would expire. Subsequent calls set new lifetimes for the same address
would not affect the prefix route management, so once expired, the
prefix route would be impossible to add back as the kernel would remove it.

Based on NetBSD changes (and reusing the commit message):
sys/netinet6/in6.c 1.216
sys/netinet6/in6.c 1.217
sys/netinet6/in6.c 1.218
sys/netinet6/in6_ifattach.c 1.104
sys/netinet6/nd6_rtr.c 1.119

Also fixes a panic with INVARIANTS set and running "ndp -P"
after an IPv6 address is manually added and the same prefix
for the address is learned via router advertisment.

#11 0xffffffff805d42b0 in kassert_panic (fmt=0xffffffff80939e3a "prefix %p has referencing addresses")

at /usr/src/sys/kern/kern_shutdown.c:723

#12 0xffffffff807d4049 in nd6_prefix_del (pr=0xfffff800043c0400) at /usr/src/sys/netinet6/nd6_rtr.c:1189
#13 0xffffffff807caf38 in nd6_ioctl (cmd=<optimized out>, data=<optimized out>, ifp=0xfffff80002337000)

at /usr/src/sys/netinet6/nd6.c:1831

PR: 195197

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

replace TAILQ_FOREACH with CK_STAILQ_FOREACH in in6_ifremprefix

rebase the changes against D23695, dropping the use of RTF_CONNECTED

update after rtinit split/removal changes

Update changes to mask destination address before calling rib_handle_ifaddr_info

rib_handle_ifaddr_info calls add_route which fails with ENOMEM when adding unmasked
destination if the route already exists and there is also a loopback route installed.
lookup_prefix in add_route is not masking the address so do the masking
before calling rib_handle_ifaddr_info.