Mercurial > hg > dhcpcd
changeset 5413:bb929420bc5d draft
Linux: IP6 forwaring only applies to "all" interface
Per interface forwarding is apparently only for setting things
like IsRouter in NA messages.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Mon, 03 Aug 2020 16:15:39 +0100 |
| parents | 10414d410d49 |
| children | bf786eeda3fc |
| files | src/ipv6.c src/ipv6nd.c |
| diffstat | 2 files changed, 9 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ipv6.c Sat Aug 01 20:56:13 2020 +0100 +++ b/src/ipv6.c Mon Aug 03 16:15:39 2020 +0100 @@ -1092,33 +1092,22 @@ struct interface *ifp; struct ipv6_state *state; struct ipv6_addr *ia; -#ifdef BSD bool forwarding; -#if defined(PRIVSEP) && defined(HAVE_PLEDGE) + /* BSD forwarding is either on or off. + * Linux forwarding is technically the same as it's + * configured by the "all" interface. + * Per interface only affects IsRouter of NA messages. */ +#if defined(PRIVSEP) && (defined(HAVE_PLEDGE) || defined(__linux__)) if (IN_PRIVSEP(sifp->ctx)) - forwarding = ps_root_ip6forwarding(sifp->ctx, NULL) == 1; + forwarding = ps_root_ip6forwarding(sifp->ctx, "all") != 0; else #endif - forwarding = ip6_forwarding(NULL) == 1; -#endif - + forwarding = ip6_forwarding("all") != 0; TAILQ_FOREACH(ifp, sifp->ctx->ifaces, next) { -#ifdef BSD if (ifp != sifp && !forwarding) continue; -#else -#if defined(PRIVSEP) && defined(__linux__) - if (IN_PRIVSEP(sifp->ctx)) { - if (ifp != sifp && - ps_root_ip6forwarding(sifp->ctx, ifp->name) != 1) - continue; - } else -#endif - if (ifp != sifp && ip6_forwarding(ifp->name) != 1) - continue; -#endif state = IPV6_STATE(ifp); if (state == NULL)
--- a/src/ipv6nd.c Sat Aug 01 20:56:13 2020 +0100 +++ b/src/ipv6nd.c Mon Aug 03 16:15:39 2020 +0100 @@ -544,11 +544,11 @@ na->nd_na_flags_reserved = ND_NA_FLAG_OVERRIDE; #if defined(PRIVSEP) && (defined(__linux__) || defined(HAVE_PLEDGE)) if (IN_PRIVSEP(ctx)) { - if (ps_root_ip6forwarding(ctx, ifp->name) == 1) + if (ps_root_ip6forwarding(ctx, ifp->name) != 0) na->nd_na_flags_reserved |= ND_NA_FLAG_ROUTER; } else #endif - if (ip6_forwarding(ifp->name) == 1) + if (ip6_forwarding(ifp->name) != 0) na->nd_na_flags_reserved |= ND_NA_FLAG_ROUTER; na->nd_na_target = ia->addr;
