]> git.decadent.org.uk Git - odhcp6c.git/blobdiff - src/dhcpv6.c
Fixed prefix class finding - it was starting from wrong offset. Now works.
[odhcp6c.git] / src / dhcpv6.c
index 013e215c6555d1a0f2ffa7cf794efb5f04799c73..161f6287a546302db2288520461e8927f7d6ab6a 100644 (file)
@@ -648,6 +648,7 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig,
                        if (ia_hdr->iaid != 1 || l_t2 < l_t1)
                                continue;
 
+                       bool error = false;
                        uint16_t stype, slen;
                        uint8_t *sdata;
                        // Test status and bail if error
@@ -655,7 +656,10 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig,
                                        stype, slen, sdata)
                                if (stype == DHCPV6_OPT_STATUS && slen >= 2 &&
                                                (sdata[0] || sdata[1]))
-                                       continue;
+                                       error = true;
+
+                       if (error)
+                               continue;
 
                        // Update times
                        if (l_t1 > 0 && t1 > l_t1)
@@ -748,7 +752,7 @@ static uint32_t dhcpv6_parse_ia(void *opt, void *end)
                        uint8_t *sdata;
 
                         // Find prefix class, if any
-                       dhcpv6_for_each_option(odata, odata + olen,
+                       dhcpv6_for_each_option(&prefix[1], odata + olen,
                                                stype, slen, sdata)
                           if (stype == DHCPV6_OPT_PREFIX_CLASS && slen == 2) 
                             entry.prefix_class = ntohs(*((uint16_t*)sdata));