Fix dhcpcd regression in 6.10.2: "If sla is 0, just copy the prefix and don't

set a blackhole route if end prefix is the same as the delegated prefix."
Fix from upstream, diff from LÉVAI Dániel.
This commit is contained in:
sthen 2016-04-18 09:10:23 +00:00
parent f097dcf90f
commit 75d31a34da
2 changed files with 54 additions and 1 deletions

View File

@ -1,7 +1,8 @@
# $OpenBSD: Makefile,v 1.12 2016/04/09 12:55:35 sthen Exp $
# $OpenBSD: Makefile,v 1.13 2016/04/18 09:10:23 sthen Exp $
COMMENT= DHCPv4/IPv4LL/IPv6RS/DHCPv6 quad stack client
DISTNAME= dhcpcd-6.10.2
REVISION= 0
CATEGORIES= net
EXTRACT_SUFX= .tar.xz

View File

@ -0,0 +1,52 @@
$OpenBSD: patch-dhcp6_c,v 1.2 2016/04/18 09:10:23 sthen Exp $
"If sla is 0, just copy the prefix and don't set a blackhole route if end
prefix is the same as the delegated prefix."
http://roy.marples.name/projects/dhcpcd/info/7461677bd0
http://roy.marples.name/projects/dhcpcd/info/59cdbb6e777c4bec
--- dhcp6.c.orig Fri Apr 8 22:54:04 2016
+++ dhcp6.c Sun Apr 17 16:43:56 2016
@@ -437,7 +437,7 @@ dhcp6_delegateaddr(struct in6_addr *addr, struct inter
else {
asla.prefix_len = (uint8_t)(prefix->prefix_len + bits);
- /* Make a 64 prefix by default, as this maks SLAAC
+ /* Make a 64 prefix by default, as this makes SLAAC
* possible.
* Otherwise round up to the nearest 4 bits. */
if (asla.prefix_len <= 64)
@@ -455,7 +455,9 @@ dhcp6_delegateaddr(struct in6_addr *addr, struct inter
prefix->prefix_len);
}
- if (ipv6_userprefix(&prefix->prefix, prefix->prefix_len,
+ if (sla->sla == 0) {
+ *addr = prefix->prefix;
+ } else if (ipv6_userprefix(&prefix->prefix, prefix->prefix_len,
sla->sla, addr, sla->prefix_len) == -1)
{
sa = inet_ntop(AF_INET6, &prefix->prefix,
@@ -2389,6 +2391,11 @@ dhcp6_ifdelegateaddr(struct interface *ifp, struct ipv
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. */
+ if (sla->sla_set && sla->sla == 0 && prefix->prefix_len == pfxlen)
+ prefix->flags |= IPV6_AF_DELEGATEDZERO;
+
/* Add our suffix */
if (sla->suffix) {
a->addr = addr;
@@ -2512,9 +2519,6 @@ dhcp6_delegate_prefix(struct interface *ifp)
}
for (j = 0; j < ia->sla_len; j++) {
sla = &ia->sla[j];
- if (sla->sla_set && sla->sla == 0)
- ap->flags |=
- IPV6_AF_DELEGATEDZERO;
if (strcmp(ifd->name, sla->ifname))
continue;
if (ifd->carrier != LINK_UP) {