[ this originated on misc@:
https://marc.info/?t=141703621800001&r=1&w=2 ]

so there are setups out there where a router gets a default route
(and maybe a prefix) via SLAAC (think dsl / cable line).

Currently the kernel does not accept a default route via SLAAC when
forwarding is enabled. Since we have a per-interface flag to enable
SLAAC we can lift this restriction.

I already have one OK and one testresult.
More tests / OKs / Comments?


diff --git netinet6/nd6.c netinet6/nd6.c
index 7ffed43..30c9414 100644
--- netinet6/nd6.c
+++ netinet6/nd6.c
@@ -610,8 +610,7 @@ nd6_purge(struct ifnet *ifp)
                }
        }
 
-       /* XXX: too restrictive? */
-       if (!ip6_forwarding && (ifp->if_xflags & IFXF_AUTOCONF6)) {
+       if (ifp->if_xflags & IFXF_AUTOCONF6) {
                /* refresh default router list */
                defrouter_select();
        }
@@ -1574,12 +1573,8 @@ fail:
         * defrtrlist_update called the function as well.  However, I believe
         * we can compromise the overhead, since it only happens the first
         * time.
-        * XXX: although defrouter_select() should not have a bad effect
-        * for those are not autoconfigured hosts, we explicitly avoid such
-        * cases for safety.
         */
-       if (do_update && ln->ln_router && !ip6_forwarding &&
-           (ifp->if_xflags & IFXF_AUTOCONF6))
+       if (do_update && ln->ln_router && (ifp->if_xflags & IFXF_AUTOCONF6))
                defrouter_select();
 
        return rt;
diff --git netinet6/nd6_rtr.c netinet6/nd6_rtr.c
index 50f577d..e8659e0 100644
--- netinet6/nd6_rtr.c
+++ netinet6/nd6_rtr.c
@@ -106,7 +106,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
        char src[INET6_ADDRSTRLEN], dst[INET6_ADDRSTRLEN];
 
        /* If I'm not a router, ignore it. XXX - too restrictive? */
-       if (!ip6_forwarding || (ifp->if_xflags & IFXF_AUTOCONF6))
+       if (!ip6_forwarding)
                goto freeit;
 
        /* Sanity checks */
@@ -579,7 +579,7 @@ defrtrlist_del(struct nd_defrouter *dr)
         * as a next hop.
         */
        /* XXX: better condition? */
-       if (!ip6_forwarding && (dr->ifp->if_xflags & IFXF_AUTOCONF6))
+       if (!ip6_forwarding)
                rt6_flush(&dr->rtaddr, dr->ifp);
 
        if (dr->installed) {
@@ -712,21 +712,6 @@ defrouter_select(void)
        int s = splsoftnet();
 
        /*
-        * This function should be called only when acting as an autoconfigured
-        * host.  Although the remaining part of this function is not effective
-        * if the node is not an autoconfigured host, we explicitly exclude
-        * such cases here for safety.
-        */
-       /* XXX too strict? */
-       if (ip6_forwarding) {
-               nd6log((LOG_WARNING,
-                   "defrouter_select: called unexpectedly (forwarding=%d)\n",
-                   ip6_forwarding));
-               splx(s);
-               return;
-       }
-
-       /*
         * Let's handle easy case (3) first:
         * If default router list is empty, there's nothing to be done.
         */
@@ -879,7 +864,7 @@ defrtrlist_update(struct nd_defrouter *new)
        /* entry does not exist */
        if (new->rtlifetime == 0) {
                /* flush all possible redirects */
-               if (!ip6_forwarding && (new->ifp->if_xflags & IFXF_AUTOCONF6))
+               if (new->ifp->if_xflags & IFXF_AUTOCONF6)
                        rt6_flush(&new->rtaddr, new->ifp);
                splx(s);
                return (NULL);


-- 
I'm not entirely sure you are real.

Reply via email to