]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Remove ipv6ra_own and ipv6ra_own_default options.
authorRoy Marples <roy@marples.name>
Fri, 24 Mar 2017 21:34:12 +0000 (21:34 +0000)
committerRoy Marples <roy@marples.name>
Fri, 24 Mar 2017 21:34:12 +0000 (21:34 +0000)
This is controllable via noipv6 and noipv6rs options.

src/dhcpcd.c
src/dhcpcd.conf.5.in
src/if-bsd.c
src/if-linux.c
src/if-options.c
src/if-options.h
src/if-sun.c
src/if.h
src/ipv6.c
src/route.c

index 0e8720e6d1f04a7a35ae662dde8dc53b7486cea9..6d5f9801e4a48876d9aaa73eb44b89e30915fb13 100644 (file)
@@ -441,10 +441,6 @@ configure_interface1(struct interface *ifp)
                ifo->options &=
                    ~(DHCPCD_IPV6RS | DHCPCD_DHCP6 | DHCPCD_WAITIP6);
 
-       if (ifo->options & DHCPCD_SLAACPRIVATE &&
-           !(ifp->ctx->options & (DHCPCD_DUMPLEASE | DHCPCD_TEST)))
-               ifo->options |= DHCPCD_IPV6RA_OWN;
-
        /* We want to disable kernel interface RA as early as possible. */
        if (ifo->options & DHCPCD_IPV6 &&
            !(ifp->ctx->options & DHCPCD_DUMPLEASE))
@@ -452,15 +448,10 @@ configure_interface1(struct interface *ifp)
                /* If not doing any DHCP, disable the RDNSS requirement. */
                if (!(ifo->options & (DHCPCD_DHCP | DHCPCD_DHCP6)))
                        ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS;
-               ra_global = if_checkipv6(ifp->ctx, NULL,
-                   ifp->ctx->options & DHCPCD_IPV6RA_OWN ? 1 : 0);
-               ra_iface = if_checkipv6(ifp->ctx, ifp,
-                   ifp->options->options & DHCPCD_IPV6RA_OWN ? 1 : 0);
+               ra_global = if_checkipv6(ifp->ctx, NULL);
+               ra_iface = if_checkipv6(ifp->ctx, ifp);
                if (ra_global == -1 || ra_iface == -1)
                        ifo->options &= ~DHCPCD_IPV6RS;
-               else if (ra_iface == 0 &&
-                   !(ifp->ctx->options & DHCPCD_TEST))
-                       ifo->options |= DHCPCD_IPV6RA_OWN;
        }
 
        if (!(ifo->options & DHCPCD_IAID)) {
@@ -759,8 +750,7 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags,
                        ipv6nd_expire(ifp, RTR_CARRIER_EXPIRE);
 #endif
                        /* RFC4941 Section 3.5 */
-                       if (ifp->options->options & DHCPCD_IPV6RA_OWN)
-                               ipv6_gentempifid(ifp);
+                       ipv6_gentempifid(ifp);
                        dhcpcd_startinterface(ifp);
                }
        }
index 10846276b72617dd8d60f2acfb783df701cf0d2f..7e3db0ffc2978771db5c9048cc9f47de699e29fb 100644 (file)
@@ -406,14 +406,6 @@ RDNSS option and a valid prefix or no DHCPv6 instruction.
 Set this option so to make
 .Nm dhcpcd
 always fork on an RA.
-.It Ic ipv6ra_own
-Disables kernel IPv6 Router Advertisement processing so dhcpcd can manage
-addresses and routes.
-.It Ic ipv6ra_own_default
-Each time dhcpcd receives an IPv6 Router Adveristment, dhcpcd will manage
-the default route only.
-This allows dhcpcd to prefer an interface for outbound traffic based on metric
-and/or user selection rather than the kernel.
 .It Ic ipv6rs
 Enables IPv6 Router Advertisement solicitation.
 This is on by default, but is documented here in the case where it is disabled
index ed3ba2f11d6b4e2353e19d669bf77d7320e2ed23..e3c6b8895e6911edd4dc73ad10f9146317858509 100644 (file)
@@ -1299,7 +1299,7 @@ set_ifxflags(int s, const struct interface *ifp, int own)
 #endif
 
 int
-if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
+if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp)
 {
        struct priv *priv;
        int s, ra;
@@ -1318,7 +1318,9 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
                flags = (int)nd.ndi.flags;
 
 #ifdef ND6_IFF_AUTO_LINKLOCAL
-               if (own && flags & ND6_IFF_AUTO_LINKLOCAL) {
+               if (!(ctx->options & DHCPCD_TEST) &&
+                   flags & ND6_IFF_AUTO_LINKLOCAL)
+               {
                        syslog(LOG_DEBUG,
                            "%s: disabling Kernel IPv6 auto link-local support",
                            ifp->name);
@@ -1334,14 +1336,17 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
 #endif
 
 #ifdef ND6_IFF_ACCEPT_RTADV
-               if (own && flags & ND6_IFF_ACCEPT_RTADV) {
+               if (!(ctx->options & DHCPCD_TEST) &&
+                   flags & ND6_IFF_ACCEPT_RTADV)
+               {
                        syslog(LOG_DEBUG,
                            "%s: disabling Kernel IPv6 RA support",
                            ifp->name);
                        flags &= ~ND6_IFF_ACCEPT_RTADV;
                }
 #ifdef ND6_IFF_OVERRIDE_RTADV
-               if (own && flags & ND6_IFF_OVERRIDE_RTADV)
+               if (!(ctx->options & DHCPCD_TEST) &&
+                   flags & ND6_IFF_OVERRIDE_RTADV)
                        flags &= ~ND6_IFF_OVERRIDE_RTADV;
 #endif
 #endif
@@ -1351,6 +1356,12 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
 #endif
 
                if (nd.ndi.flags != (uint32_t)flags) {
+                       if (ctx->options & DHCPCD_TEST) {
+                               syslog(LOG_WARNING,
+                                   "%s: interface not IPv6 enabled",
+                                   ifp->name);
+                               return -1;
+                       }
                        nd.ndi.flags = (uint32_t)flags;
                        if (ioctl(s, SIOCSIFINFO_FLAGS, &nd) == -1) {
                                syslog(LOG_ERR, "%s: SIOCSIFINFO_FLAGS: %m",
@@ -1401,7 +1412,7 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
                 * error as such so just log it and continue */
                syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
                    "IPV6CTL_ACCEPT_RTADV: %m");
-       else if (ra != 0 && own) {
+       else if (ra != 0 && !(ctx->options & DHCPCD_TEST)) {
                syslog(LOG_DEBUG, "disabling Kernel IPv6 RA support");
                if (set_inet6_sysctl(IPV6CTL_ACCEPT_RTADV, 0) == -1) {
                        syslog(LOG_ERR, "IPV6CTL_ACCEPT_RTADV: %m");
@@ -1410,7 +1421,7 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
                ra = 0;
 #else
        ra = 0;
-       if (own) {
+       if (!(ctx->options & DHCPCD_TEST)) {
 #endif
                /* Flush the kernel knowledge of advertised routers
                 * and prefixes so the kernel does not expire prefixes
index 485472532bd432ac14ed29889f5fc0326a20d3cb..4f70583bf5f7e314119018c24fa5ceb4d8c186f6 100644 (file)
@@ -1634,7 +1634,7 @@ if_disable_autolinklocal(struct dhcpcd_ctx *ctx, unsigned int ifindex)
 static const char *prefix = "/proc/sys/net/ipv6/conf";
 
 int
-if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
+if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp)
 {
        const char *ifname;
        int ra;
@@ -1642,7 +1642,7 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
 
        if (ifp == NULL)
                ifname = "all";
-       else if (own) {
+       else if (!(ctx->options & DHCPCD_TEST)) {
                if (if_disable_autolinklocal(ctx, ifp->index) == -1)
                        syslog(LOG_DEBUG, "%s: if_disable_autolinklocal: %m",
                            ifp->name);
@@ -1653,10 +1653,10 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
        snprintf(path, sizeof(path), "%s/%s/autoconf", prefix, ifname);
        ra = check_proc_int(path);
        if (ra != 1) {
-               if (!own)
+               if (ctx->options & DHCPCD_TEST)
                        syslog(LOG_WARNING, "%s: IPv6 kernel autoconf disabled",
                            ifname);
-       } else if (ra != -1 && own) {
+       } else if (ra != -1 && !(ctx->options & DHCPCD_TEST)) {
                if (write_path(path, "0") == -1) {
                        syslog(LOG_ERR, "write_path: %s: %m", path);
                        return -1;
@@ -1669,7 +1669,7 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own)
                /* The sysctl probably doesn't exist, but this isn't an
                 * error as such so just log it and continue */
                syslog(errno == ENOENT ? LOG_DEBUG:LOG_WARNING, "%s: %m", path);
-       else if (ra != 0 && own) {
+       else if (ra != 0 && !(ctx->options & DHCPCD_TEST)) {
                syslog(LOG_DEBUG, "%s: disabling kernel IPv6 RA support",
                    ifname);
                if (write_path(path, "0") == -1) {
index ca755f3a5d383daae618cee4f48f25ff6a00e3d9..7f171486388378f35b838bbbbc5fe61bffd75a6f 100644 (file)
@@ -64,8 +64,8 @@
 #define O_IPV6RS               O_BASE + 4
 #define O_NOIPV6RS             O_BASE + 5
 #define O_IPV6RA_FORK          O_BASE + 6
-#define O_IPV6RA_OWN           O_BASE + 7
-#define O_IPV6RA_OWN_D         O_BASE + 8
+// unused                      O_BASE + 7
+// unused                      O_BASE + 8
 #define O_NOALIAS              O_BASE + 9
 #define O_IA_NA                        O_BASE + 10
 #define O_IA_TA                        O_BASE + 11
@@ -167,8 +167,6 @@ const struct option cf_options[] = {
        {"ipv6ra_autoconf", no_argument,       NULL, O_IPV6RA_AUTOCONF},
        {"ipv6ra_noautoconf", no_argument,     NULL, O_IPV6RA_NOAUTOCONF},
        {"ipv6ra_fork",     no_argument,       NULL, O_IPV6RA_FORK},
-       {"ipv6ra_own",      no_argument,       NULL, O_IPV6RA_OWN},
-       {"ipv6ra_own_default", no_argument,    NULL, O_IPV6RA_OWN_D},
        {"ipv4",            no_argument,       NULL, O_IPV4},
        {"noipv4",          no_argument,       NULL, O_NOIPV4},
        {"ipv6",            no_argument,       NULL, O_IPV6},
@@ -1279,12 +1277,6 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
        case O_IPV6RA_FORK:
                ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS;
                break;
-       case O_IPV6RA_OWN:
-               ifo->options |= DHCPCD_IPV6RA_OWN;
-               break;
-       case O_IPV6RA_OWN_D:
-               ifo->options |= DHCPCD_IPV6RA_OWN_DEFAULT;
-               break;
        case O_IPV6RA_AUTOCONF:
                ifo->options |= DHCPCD_IPV6RA_AUTOCONF;
                break;
index 3ecc36b9fad373a2fb0558320066d9d3cf6696f6..be1325b7979e554a3e34addbdb5ee14678de88f9 100644 (file)
@@ -89,8 +89,8 @@
 #define DHCPCD_DUMPLEASE               (1ULL << 30)
 #define DHCPCD_IPV6RS                  (1ULL << 31)
 #define DHCPCD_IPV6RA_REQRDNSS         (1ULL << 32)
-#define DHCPCD_IPV6RA_OWN              (1ULL << 33)
-#define DHCPCD_IPV6RA_OWN_DEFAULT      (1ULL << 34)
+// unused                              (1ULL << 33)
+// unused                              (1ULL << 34)
 #define DHCPCD_IPV4                    (1ULL << 35)
 #define DHCPCD_FORKED                  (1ULL << 36)
 #define DHCPCD_IPV6                    (1ULL << 37)
index b53a41a32f538f9833d1cdefd475122c59eb2db0..5def7b0e13b733ebf4a31cd32817fb9b82e77376 100644 (file)
@@ -1409,7 +1409,7 @@ if_getlifetime6(struct ipv6_addr *addr)
 
 int
 if_checkipv6(__unused struct dhcpcd_ctx *ctx,
-    __unused const struct interface *ifp, int __unused own)
+    __unused const struct interface *ifp)
 {
 
        return 0;
index f1303c902cd5e4569944e9653200dffbd2c83c89..7c0cc40242946b9a25d0f1f9bc082af741014094 100644 (file)
--- a/src/if.h
+++ b/src/if.h
@@ -180,7 +180,7 @@ int if_initrt(struct dhcpcd_ctx *, int);
 #endif
 
 #ifdef INET6
-int if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *, int);
+int if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *);
 #ifdef IPV6_MANAGETEMPADDR
 int ip6_use_tempaddr(const char *ifname);
 int ip6_temp_preferred_lifetime(const char *ifname);
index 296ad22758a8e0c60c00b9b0729418d9e423f6fb..9befa1ee1b5e7f485345b01e2c744435c38a581d 100644 (file)
@@ -710,7 +710,6 @@ ipv6_addaddr1(struct ipv6_addr *ap, const struct timespec *now)
        if (ap->flags & IPV6_AF_TEMPORARY &&
            ap->prefix_pltime &&
            ap->prefix_vltime &&
-           ap->iface->options->options & DHCPCD_IPV6RA_OWN &&
            ip6_use_tempaddr(ap->iface->name))
                eloop_timeout_add_sec(ap->iface->ctx->eloop,
                    (time_t)ap->prefix_pltime - REGEN_ADVANCE,
@@ -1032,7 +1031,6 @@ ipv6_getstate(struct interface *ifp)
 
                /* Regenerate new ids */
                if (ifp->options &&
-                   ifp->options->options & DHCPCD_IPV6RA_OWN &&
                    ip6_use_tempaddr(ifp->name))
                        ipv6_regentempifid(ifp);
        }
@@ -1610,8 +1608,7 @@ ipv6_start(struct interface *ifp)
 
        if (IPV6_CSTATE(ifp)) {
                /* Regenerate new ids */
-               if (ifp->options->options & DHCPCD_IPV6RA_OWN &&
-                   ip6_use_tempaddr(ifp->name))
+               if (ip6_use_tempaddr(ifp->name))
                        ipv6_regentempifid(ifp);
        }
 
@@ -2205,20 +2202,16 @@ inet6_raroutes(struct rt_head *routes, struct dhcpcd_ctx *ctx, int expired,
        TAILQ_FOREACH(rap, ctx->ra_routers, next) {
                if (rap->expired != expired)
                        continue;
-               if (rap->iface->options->options & DHCPCD_IPV6RA_OWN) {
-                       TAILQ_FOREACH(addr, &rap->addrs, next) {
-                               if (addr->prefix_vltime == 0)
-                                       continue;
-                               rt = inet6_makeprefix(rap->iface, rap, addr);
-                               if (rt) {
-                                       TAILQ_INSERT_TAIL(routes, rt, rt_next);
-                                       n++;
-                               }
+               TAILQ_FOREACH(addr, &rap->addrs, next) {
+                       if (addr->prefix_vltime == 0)
+                               continue;
+                       rt = inet6_makeprefix(rap->iface, rap, addr);
+                       if (rt) {
+                               TAILQ_INSERT_TAIL(routes, rt, rt_next);
+                               n++;
                        }
                }
-               if (rap->lifetime && rap->iface->options->options &
-                   (DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT))
-               {
+               if (rap->lifetime) {
                        rt = inet6_makerouter(rap);
                        if (rt) {
                                TAILQ_INSERT_TAIL(routes, rt, rt_next);
index bafc260caca5501c5eb98561864da4a9a8c10739..c91c224de3dde4114e02833c255d308bad179ba6 100644 (file)
@@ -516,8 +516,6 @@ rt_build(struct dhcpcd_ctx *ctx, int af)
                            ctx->options;
 #ifdef INET6
                        if (!have_default &&
-                           (o & DHCPCD_IPV6RA_OWN_DEFAULT) &&
-                           !(o & DHCPCD_IPV6RA_OWN) &&
                            rt->rt_dest.sa_family == AF_INET6 &&
                            sa_is_unspecified(&rt->rt_dest))
                                have_default = true;