summaryrefslogtreecommitdiffstats
path: root/ipv6.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2015-03-18 12:07:02 +0000
committerRoy Marples <roy@marples.name>2015-03-18 12:07:02 +0000
commitcfbb98169a2c89668707fea913e7999c285def03 (patch)
tree04abb2c2a25863b3cfd9b48434f7a8dd9fbcf1a4 /ipv6.c
parent5dc8a3e0c3d389dcf3f2ac14b32e18484c378b38 (diff)
downloaddhcpcd-cfbb98169a2c89668707fea913e7999c285def03.tar.xz
Fix creation of normal IPv6 link-local addresses overflowing the
address and fooling dhcpcd into thinking it's not tentative when added.
Diffstat (limited to 'ipv6.c')
-rw-r--r--ipv6.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ipv6.c b/ipv6.c
index 54053cf4..2187c461 100644
--- a/ipv6.c
+++ b/ipv6.c
@@ -1149,7 +1149,7 @@ nextslaacprivate:
}
ap->dadcounter = dadcounter;
} else {
- memcpy(ap->addr.s6_addr, ap->prefix.s6_addr, ap->prefix_len);
+ memcpy(ap->addr.s6_addr, ap->prefix.s6_addr, 8);
switch (ifp->family) {
case ARPHRD_ETHER:
if (ifp->hwlen == 6) {
@@ -1163,6 +1163,11 @@ nextslaacprivate:
ap->addr.s6_addr[15] = ifp->hwaddr[5];
} else if (ifp->hwlen == 8)
memcpy(&ap->addr.s6_addr[8], ifp->hwaddr, 8);
+ else {
+ free(ap);
+ errno = ENOTSUP;
+ return -1;
+ }
break;
}