From: Roy Marples Date: Mon, 15 Feb 2016 21:27:59 +0000 (+0000) Subject: Remove ipv6ra_accept_nopublic and just accept it. X-Git-Tag: v6.10.2~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=539a8ecfa85904f43e756c4ee424e1d9b988e19c;p=thirdparty%2Fdhcpcd.git Remove ipv6ra_accept_nopublic and just accept it. --- diff --git a/dhcp6.c b/dhcp6.c index 2b13479f..08b81d03 100644 --- a/dhcp6.c +++ b/dhcp6.c @@ -481,21 +481,6 @@ dhcp6_delegateaddr(struct in6_addr *addr, struct interface *ifp, return sla->prefix_len; } -int -dhcp6_has_public_addr(const struct interface *ifp) -{ - const struct dhcp6_state *state = D6_CSTATE(ifp); - const struct ipv6_addr *ia; - - if (state == NULL) - return 0; - TAILQ_FOREACH(ia, &state->addrs, next) { - if (ipv6_publicaddr(ia)) - return 1; - } - return 0; -} - static int dhcp6_makemessage(struct interface *ifp) { @@ -3046,7 +3031,6 @@ recv: eloop_timeout_add_sec(ifp->ctx->eloop, (time_t)state->expire, dhcp6_startexpire, ifp); - ipv6nd_runignoredra(ifp); ipv6_addaddrs(&state->addrs); if (state->state == DH6S_INFORMED) diff --git a/dhcp6.h b/dhcp6.h index 93605be7..3d4b8b7b 100644 --- a/dhcp6.h +++ b/dhcp6.h @@ -238,7 +238,6 @@ const struct ipv6_addr *dhcp6_iffindaddr(const struct interface *ifp, struct ipv6_addr *dhcp6_findaddr(struct dhcpcd_ctx *, const struct in6_addr *, short); size_t dhcp6_find_delegates(struct interface *); -int dhcp6_has_public_addr(const struct interface *); int dhcp6_start(struct interface *, enum DH6S); void dhcp6_reboot(struct interface *); void dhcp6_renew(struct interface *); diff --git a/dhcpcd.conf.5.in b/dhcpcd.conf.5.in index f8010592..f0a2da14 100644 --- a/dhcpcd.conf.5.in +++ b/dhcpcd.conf.5.in @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 14, 2016 +.Dd February 15, 2016 .Dt DHCPCD.CONF 5 .Os .Sh NAME @@ -410,12 +410,6 @@ 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 ipv6ra_accept_nopublic -Some IPv6 routers advertise themselves as a default router without any -public prefixes or managed addresses. -Generally, this is incorrect behaviour and -.Nm dhcpcd -will ignore the advertisement unless this option is turned on. .It Ic ipv6rs Enables IPv6 Router Advertisment solicitation. This is on by default, but is documented here in the case where it is disabled diff --git a/if-options.c b/if-options.c index 88148837..2653937a 100644 --- a/if-options.c +++ b/if-options.c @@ -96,7 +96,6 @@ #define O_IPV6RA_AUTOCONF O_BASE + 38 #define O_IPV6RA_NOAUTOCONF O_BASE + 39 #define O_REJECT O_BASE + 40 -#define O_IPV6RA_ACCEPT_NOPUBLIC O_BASE + 41 #define O_BOOTP O_BASE + 42 #define O_DEFINEND O_BASE + 43 #define O_NODELAY O_BASE + 44 @@ -166,7 +165,6 @@ const struct option cf_options[] = { {"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}, - {"ipv6ra_accept_nopublic", no_argument, NULL, O_IPV6RA_ACCEPT_NOPUBLIC}, {"ipv4", no_argument, NULL, O_IPV4}, {"noipv4", no_argument, NULL, O_NOIPV4}, {"ipv6", no_argument, NULL, O_IPV6}, @@ -1290,9 +1288,6 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, case O_IPV6RA_OWN_D: ifo->options |= DHCPCD_IPV6RA_OWN_DEFAULT; break; - case O_IPV6RA_ACCEPT_NOPUBLIC: - ifo->options |= DHCPCD_IPV6RA_ACCEPT_NOPUBLIC; - break; case O_IPV6RA_AUTOCONF: ifo->options |= DHCPCD_IPV6RA_AUTOCONF; break; diff --git a/if-options.h b/if-options.h index d87096fd..9d825569 100644 --- a/if-options.h +++ b/if-options.h @@ -110,7 +110,7 @@ #define DHCPCD_RTM_PPID (1ULL << 53) #define DHCPCD_IPV6RA_AUTOCONF (1ULL << 54) #define DHCPCD_ROUTER_HOST_ROUTE_WARNED (1ULL << 55) -#define DHCPCD_IPV6RA_ACCEPT_NOPUBLIC (1ULL << 56) +// unassigned (1ULL << 56) #define DHCPCD_BOOTP (1ULL << 57) #define DHCPCD_INITIAL_DELAY (1ULL << 58) #define DHCPCD_PRINT_PIDFILE (1ULL << 59) diff --git a/ipv6.c b/ipv6.c index 8a6d011d..16f73ad5 100644 --- a/ipv6.c +++ b/ipv6.c @@ -740,13 +740,6 @@ ipv6_addaddr(struct ipv6_addr *ap, const struct timespec *now) return 0; } -int -ipv6_publicaddr(const struct ipv6_addr *ia) -{ - return (ia->prefix_pltime && - (ia->addr.s6_addr[0] & 0xfe) != 0xfc && - !(ia->addr_flags & IN6_IFF_NOTUSEABLE)); -} int ipv6_findaddrmatch(const struct ipv6_addr *addr, const struct in6_addr *match, @@ -2239,8 +2232,7 @@ ipv6_build_ra_routes(struct ipv6_ctx *ctx, struct rt6_head *dnr, int expired) } } if (rap->lifetime && rap->iface->options->options & - (DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT) && - !rap->no_public_warned) + (DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT)) { rt = make_router(rap); if (rt) diff --git a/ipv6.h b/ipv6.h index 988ae701..35e9f075 100644 --- a/ipv6.h +++ b/ipv6.h @@ -281,7 +281,6 @@ void ipv6_handleifa(struct dhcpcd_ctx *ctx, int, struct if_head *, const char *, const struct in6_addr *, uint8_t, int); int ipv6_handleifa_addrs(int, struct ipv6_addrhead *, const struct in6_addr *, int); -int ipv6_publicaddr(const struct ipv6_addr *); struct ipv6_addr *ipv6_iffindaddr(struct interface *, const struct in6_addr *, int); int ipv6_hasaddr(const struct interface *); diff --git a/ipv6nd.c b/ipv6nd.c index 3e80509e..010a8d96 100644 --- a/ipv6nd.c +++ b/ipv6nd.c @@ -712,24 +712,6 @@ try_script: } } -static int -ipv6nd_has_public_addr(const struct interface *ifp) -{ - const struct ra *rap; - const struct ipv6_addr *ia; - - TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) { - if (rap->iface == ifp) { - TAILQ_FOREACH(ia, &rap->addrs, next) { - if (ia->flags & IPV6_AF_AUTOCONF && - ipv6_publicaddr(ia)) - return 1; - } - } - } - return 0; -} - static void ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp, struct icmp6_hdr *icp, size_t len, int hoplimit) @@ -820,7 +802,6 @@ ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp, if (rap) { free(rap->data); rap->data_len = 0; - rap->no_public_warned = 0; } new_data = 1; } else @@ -1093,19 +1074,6 @@ ipv6nd_handlera(struct dhcpcd_ctx *dctx, struct interface *ifp, if (new_rap) add_router(ifp->ctx->ipv6, rap); - if (!ipv6nd_has_public_addr(rap->iface) && - !(rap->iface->options->options & DHCPCD_IPV6RA_ACCEPT_NOPUBLIC) && - (!(rap->flags & ND_RA_FLAG_MANAGED) || - !dhcp6_has_public_addr(rap->iface))) - { - logger(rap->iface->ctx, - rap->no_public_warned ? LOG_DEBUG : LOG_WARNING, - "%s: ignoring RA from %s" - " (no public prefix, no managed address)", - rap->iface->name, rap->sfrom); - rap->no_public_warned = 1; - goto handle_flag; - } if (ifp->ctx->options & DHCPCD_TEST) { script_runreason(ifp, "TEST"); goto handle_flag; @@ -1153,34 +1121,6 @@ nodhcp6: ipv6nd_expirera(ifp); } -/* Run RA's we ignored becuase they had no public addresses - * This should only be called when DHCPv6 applies a public address */ -void -ipv6nd_runignoredra(struct interface *ifp) -{ - struct ra *rap; - - TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) { - if (rap->iface == ifp && - !rap->expired && - rap->no_public_warned) - { - rap->no_public_warned = 0; - logger(rap->iface->ctx, LOG_INFO, - "%s: applying ignored RA from %s", - rap->iface->name, rap->sfrom); - if (ifp->ctx->options & DHCPCD_TEST) { - script_runreason(ifp, "TEST"); - continue; - } - if (ipv6nd_scriptrun(rap)) - return; - eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); - eloop_timeout_delete(ifp->ctx->eloop, NULL, rap); - } - } -} - int ipv6nd_hasra(const struct interface *ifp) { diff --git a/ipv6nd.h b/ipv6nd.h index ef01c554..35d7acd4 100644 --- a/ipv6nd.h +++ b/ipv6nd.h @@ -50,7 +50,6 @@ struct ra { struct ipv6_addrhead addrs; uint8_t hasdns; uint8_t expired; - uint8_t no_public_warned; }; TAILQ_HEAD(ra_head, ra); @@ -110,7 +109,6 @@ ssize_t ipv6nd_free(struct interface *); void ipv6nd_expirera(void *arg); int ipv6nd_hasra(const struct interface *); int ipv6nd_hasradhcp(const struct interface *); -void ipv6nd_runignoredra(struct interface *); void ipv6nd_handleifa(struct dhcpcd_ctx *, int, const char *, const struct in6_addr *, int); int ipv6nd_dadcompleted(const struct interface *);