From: Roy Marples Date: Fri, 6 May 2016 18:45:01 +0000 (+0000) Subject: Don't install a reject route if the prefix is the same as the delegation, [efc359da01]. X-Git-Tag: v6.11.0~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=857a98fcf99032236447fb61ff3a883a46e35115;p=thirdparty%2Fdhcpcd.git Don't install a reject route if the prefix is the same as the delegation, [efc359da01]. --- diff --git a/dhcp6.c b/dhcp6.c index 3c1f060f..7e37e977 100644 --- a/dhcp6.c +++ b/dhcp6.c @@ -2371,13 +2371,10 @@ dhcp6_ifdelegateaddr(struct interface *ifp, struct ipv6_addr *prefix, a->prefix = addr; a->prefix_len = (uint8_t)pfxlen; - /* If sla is zero and the prefix length hasn't changed, - * don't install a blackhole route. - * This does violate RFC3315 section 12.1, but technically - * the end result is no different from assigning the entire - * delegation so I'm OK with it. */ - if (sla->sla_set && sla->sla == 0 && prefix->prefix_len == pfxlen) - prefix->flags |= IPV6_AF_DELEGATEDZERO; + /* If the prefix length hasn't changed, + * don't install a reject route. */ + if (prefix->prefix_len == pfxlen) + prefix->flags |= IPV6_AF_NOREJECT; /* Add our suffix */ if (sla->suffix) { @@ -2526,6 +2523,7 @@ dhcp6_delegate_prefix(struct interface *ifp) ifd_state = D6_STATE(ifd); ipv6_addaddrs(&ifd_state->addrs); if_initrt6(ifd); + ipv6_buildroutes(ifd->ctx); dhcp6_script_try_run(ifd, 1); } } diff --git a/if-options.c b/if-options.c index 2cc18945..49724198 100644 --- a/if-options.c +++ b/if-options.c @@ -1511,12 +1511,22 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, for (sl = 0; sl < ia->sla_len - 1; sl++) { slap = &ia->sla[sl]; if (slap->sla_set != sla->sla_set) { - logger(ctx, LOG_WARNING, + logger(ctx, LOG_ERR, "%s: cannot mix automatic " "and fixed SLA", sla->ifname); goto err_sla; } + if (ia->prefix_len && + (sla->prefix_len == ia->prefix_len || + slap->prefix_len == ia->prefix_len)) + { + logger(ctx, LOG_ERR, + "%s: cannot delegte the same" + "prefix length more than once", + sla->ifname); + goto err_sla; + } if (sla->sla_set == 0 && strcmp(slap->ifname, sla->ifname) == 0) { diff --git a/ipv6.c b/ipv6.c index baa2c527..520ddcf3 100644 --- a/ipv6.c +++ b/ipv6.c @@ -2163,8 +2163,8 @@ make_prefix(const struct interface *ifp, const struct ra *rap, !(addr->flags & (IPV6_AF_ONLINK | IPV6_AF_DELEGATEDPFX))) return NULL; - /* Don't install a blackhole route when not creating bigger prefixes */ - if (addr->flags & IPV6_AF_DELEGATEDZERO) + /* Don't install a reject route when not creating bigger prefixes */ + if (addr->flags & IPV6_AF_NOREJECT) return NULL; r = make_route(ifp, rap); diff --git a/ipv6.h b/ipv6.h index 1fe13817..d20f9435 100644 --- a/ipv6.h +++ b/ipv6.h @@ -165,20 +165,20 @@ struct ipv6_addr { }; TAILQ_HEAD(ipv6_addrhead, ipv6_addr); -#define IPV6_AF_ONLINK 0x0001 +#define IPV6_AF_ONLINK 0x0001 #define IPV6_AF_NEW 0x0002 -#define IPV6_AF_STALE 0x0004 -#define IPV6_AF_ADDED 0x0008 -#define IPV6_AF_AUTOCONF 0x0010 -#define IPV6_AF_DUPLICATED 0x0020 -#define IPV6_AF_DADCOMPLETED 0x0040 -#define IPV6_AF_DELEGATED 0x0080 -#define IPV6_AF_DELEGATEDPFX 0x0100 -#define IPV6_AF_DELEGATEDZERO 0x0200 -#define IPV6_AF_REQUEST 0x0400 -#define IPV6_AF_STATIC 0x0800 +#define IPV6_AF_STALE 0x0004 +#define IPV6_AF_ADDED 0x0008 +#define IPV6_AF_AUTOCONF 0x0010 +#define IPV6_AF_DUPLICATED 0x0020 +#define IPV6_AF_DADCOMPLETED 0x0040 +#define IPV6_AF_DELEGATED 0x0080 +#define IPV6_AF_DELEGATEDPFX 0x0100 +#define IPV6_AF_NOREJECT 0x0200 +#define IPV6_AF_REQUEST 0x0400 +#define IPV6_AF_STATIC 0x0800 #ifdef IPV6_MANAGETEMPADDR -#define IPV6_AF_TEMPORARY 0X1000 +#define IPV6_AF_TEMPORARY 0X1000 #endif struct rt6 {