Bug 104851 - [inet6] [patch] On link routes not configured when using both IPv6 autoconfiguration and manual configuration
Summary: [inet6] [patch] On link routes not configured when using both IPv6 autoconfig...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
Depends on:
Reported: 2006-10-27 06:20 UTC by Jan Melen
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Jan Melen 2006-10-27 06:20:17 UTC
I have a problem with routes in 6.1 when configuring IPv6 address using both
autoconfigured addresses at the same time with statically configured
addresses from different prefixes.

If the host is not accepting router advertisements everything seems to work
# sysctl -a | grep rtad
net.inet6.ip6.accept_rtadv: 0
# ifconfig fxp0 inet6 3ffe:101::1 prefixlen 64

# netstat -rn -f inet6 | grep 3ffe:101
3ffe:101::/64                     link#1                        UC
3ffe:101::1                       00:12:3f:71:3e:ef             UHL

As you can see I have two routes one for the loopback and one for the prefix
as it should GREAT!

Now if I'll set the host to accept router advertisements then the route for
the 3ffe:101:: prefix will be deleted as the first router advertisement is
received. The router advertises prefix 3ffe:14b8:400:101::/64.

# sysctl net.inet6.ip6.accept_rtadv=1
net.inet6.ip6.accept_rtadv: 0 -> 1
# rtsol -a
# netstat -rn -f inet6 | grep 3ffe:101
3ffe:101::1                       00:12:3f:71:3e:ef             UHL

It seems that the route is deleted because in function pfxlist_onlink_check()
there is a check that if the state has changed to DETACHED the
nd6_prefix_offlink will be called which then removes the route:
        if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 &&
            (pr->ndpr_stateflags & NDPRF_ONLINK) != 0) {
                if ((e = nd6_prefix_offlink(pr)) != 0) {
                            "pfxlist_onlink_check: failed to "
                            "make %s/%d offlink, errno=%d\n",
                            pr->ndpr_plen, e));

Result is the same if I first do the autoconfiguration part and then after
I have the autoconfigured address add the manually configured address the
result is that there wont be any route for the manually configured prefix

Fix: The solution is that we check if the valid lifetime for the address is infinite, then skip the reachable router check for that prefix.

-                       if ((pr->ndpr_stateflags & NDPRF_DETACHED) == 0 &&
+                       /* For some reason nd6 tries to find a active
+                       * advertising router also for prefixes that are
+                       * statically configured which shouldn't be the case
+                       */
+                       if (pr->ndpr_vltime == ND6_INFINITE_LIFETIME) {
+                               pr->ndpr_stateflags &= ~NDPRF_DETACHED;
+                       } else {
+                       if ((pr->ndpr_stateflags & NDPRF_DETACHED) == 0 &&
                            find_pfxlist_reachable_router(pr) == NULL)
                                pr->ndpr_stateflags |= NDPRF_DETACHED;
                        if ((pr->ndpr_stateflags & NDPRF_DETACHED) != 0 &&
                            find_pfxlist_reachable_router(pr) != 0)
                                pr->ndpr_stateflags &= ~NDPRF_DETACHED;
+                       }
        } else {
                /* there is no prefix that has a reachable router */--YxunEP06jCGcjKTjuVlV9nVVY9z44byoSLtXme4Jw2dRJXMx
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- nd6_rtr.c.orig      Mon Mar 20 18:23:08 2006
+++ nd6_rtr.c   Thu Oct 26 09:48:59 2006
@@ -1409,12 +1409,20 @@
                        if (pr->ndpr_raf_onlink == 0)
How-To-Repeat: Add any prefix that is not the same as advertised prefix on the link and you will notice that the route for that prefix on link will be missing.
Comment 1 Bruce Cran freebsd_committer 2009-01-30 23:18:07 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:00 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped