]> git.decadent.org.uk Git - odhcp6c.git/blobdiff - src/dhcpv6.c
Merge pull request #6 from fingon/bugfix
[odhcp6c.git] / src / dhcpv6.c
index da920ce21c06aa405feee11652f7317502d1a5a2..d2da0535bed59cc9f22d9642516d164a5d45f6d6 100644 (file)
@@ -520,7 +520,7 @@ static int dhcpv6_handle_advert(_unused enum dhcpv6_msg orig,
                        cand.preference -= 2000;
                } else if (otype == DHCPV6_OPT_PREF && olen >= 1 &&
                                cand.preference >= 0) {
-                       cand.preference = odata[1];
+                       cand.preference = odata[0];
                } else if (otype == DHCPV6_OPT_RECONF_ACCEPT) {
                        cand.wants_reconfigure = true;
                } else if (otype == DHCPV6_OPT_IA_PD && request_prefix) {
@@ -647,6 +647,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
@@ -654,7 +655,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)