summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Dedecker2019-01-16 10:03:14 +0000
committerHans Dedecker2019-01-16 12:34:36 +0000
commitc70d5cf09d6277da474615cac5e532897cc93384 (patch)
tree1ca746b0b1e90c66e3ca4a3df3faaed8c7056697
parent96694abe8093b06daf5d503d19e7cdcd62de03a5 (diff)
downloadodhcpd-c70d5cf09d6277da474615cac5e532897cc93384.tar.gz
dhcpv6-ia: fix onlink IA check (FS#2060)
Some DHCPv6 clients start sending SOLICIT messages without including either an IA_NA or IA_PD and only start including an IA_NA or IA_PD in the REQUEST message without including an IA_PREFIX or IA_ADDR as suboption. As a result the check to verify if an IA_ADDR and/or IA_PREFIX is onlink fails. Fix this by returning notonlink if an IA_PREFIX or IA_ADDR suboption is present having an address/prefix not matching any of the addresses Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r--src/dhcpv6-ia.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index fb1c228..de7e673 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -1102,7 +1102,7 @@ static bool dhcpv6_ia_on_link(const struct dhcpv6_ia_hdr *ia, struct dhcpv6_assi
time_t now = odhcpd_time();
uint8_t *odata, *end = ((uint8_t*)ia) + htons(ia->len) + 4;
uint16_t otype, olen;
- bool onlink = false;
+ bool onlink = true;
dhcpv6_for_each_option((uint8_t*)&ia[1], end, otype, olen, odata) {
struct dhcpv6_ia_prefix *p = (struct dhcpv6_ia_prefix*)&odata[-4];
@@ -1112,7 +1112,7 @@ static bool dhcpv6_ia_on_link(const struct dhcpv6_ia_hdr *ia, struct dhcpv6_assi
(otype != DHCPV6_OPT_IA_ADDR || olen < sizeof(*n) - 4))
continue;
- for (size_t i = 0; i < addrlen; ++i) {
+ for (size_t i = 0, onlink = false; i < addrlen; ++i) {
struct in6_addr addr = addrs[i].addr.in6;
if (!valid_addr(&addrs[i], now))