allow stateless address auto configuration when v6 forwarding is enabled

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

allow stateless address auto configuration when v6 forwarding is enabled

Florian Obser-2
[ 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 | Threaded
Open this post in threaded view
|

Re: allow stateless address auto configuration when v6 forwarding is enabled

Stefan Sperling-5
On Mon, Mar 23, 2015 at 06:21:40PM +0000, Florian Obser wrote:

> [ 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?

Is there already a way to obtain prefixes but avoid the default route?
That would be useful to me.

The only way I could think of so far are rdomains. But that seems overkill.

Reply | Threaded
Open this post in threaded view
|

Re: allow stateless address auto configuration when v6 forwarding is enabled

Florian Obser-2
On Mon, Mar 23, 2015 at 08:22:46PM +0100, Stefan Sperling wrote:

> On Mon, Mar 23, 2015 at 06:21:40PM +0000, Florian Obser wrote:
> > [ 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?
>
> Is there already a way to obtain prefixes but avoid the default route?
> That would be useful to me.
>

Well, what we currently have without this diff behaves that way.
Enable forwarding and the kernel only processes the prefix. AFAIC
that's not a feature but an accident.

I'm not quite sure what your use case is though...

> The only way I could think of so far are rdomains. But that seems overkill.
>

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