]> git.decadent.org.uk Git - odhcp6c.git/blobdiff - src/dhcpv6.c
Merge remote-tracking branch 'up/master' into hnet
[odhcp6c.git] / src / dhcpv6.c
index 1df31cd1811c585ce35d5aa9d139abfbd2dfc31a..fe4cc0b48e8f5dd4ca56139ee1c7fdcc5e353f1f 100644 (file)
@@ -569,6 +569,13 @@ static int dhcpv6_handle_advert(enum dhcpv6_msg orig,
        struct dhcpv6_server_cand cand = {false, false, 0, 0, {0}, NULL, NULL, 0, 0};
 
        dhcpv6_for_each_option(opt, end, otype, olen, odata) {
+               if (orig == DHCPV6_MSG_SOLICIT &&
+                               (otype == DHCPV6_OPT_IA_PD || otype == DHCPV6_OPT_IA_NA) &&
+                               olen > sizeof(struct dhcpv6_ia_hdr)) {
+                       struct dhcpv6_ia_hdr *ia_hdr = (void*)(&odata[-4]);
+                       dhcpv6_parse_ia(&ia_hdr[1], odata + olen);
+               }
+
                if (otype == DHCPV6_OPT_SERVERID && olen <= 130) {
                        memcpy(cand.duid, odata, olen);
                        cand.duid_len = olen;
@@ -600,13 +607,6 @@ static int dhcpv6_handle_advert(enum dhcpv6_msg orig,
                                        cand.preference -= 2000;
                        }
                }
-
-               if (orig == DHCPV6_MSG_SOLICIT &&
-                               (otype == DHCPV6_OPT_IA_PD || otype == DHCPV6_OPT_IA_NA) &&
-                               olen > sizeof(struct dhcpv6_ia_hdr)) {
-                       struct dhcpv6_ia_hdr *ia_hdr = (void*)(&odata[-4]);
-                       dhcpv6_parse_ia(&ia_hdr[1], odata + olen);
-               }
        }
 
        if (cand.duid_len > 0) {