]> git.decadent.org.uk Git - odhcp6c.git/commitdiff
Merge branch 'master' into hnet
authorMarkus Stenberg <markus.stenberg@iki.fi>
Tue, 26 Mar 2013 13:22:05 +0000 (15:22 +0200)
committerMarkus Stenberg <markus.stenberg@iki.fi>
Tue, 26 Mar 2013 13:22:05 +0000 (15:22 +0200)
1  2 
src/dhcpv6.c

diff --combined src/dhcpv6.c
index 013e215c6555d1a0f2ffa7cf794efb5f04799c73,d2da0535bed59cc9f22d9642516d164a5d45f6d6..7e62a2b97cddf393020d202a6b24d3b5e48ba6bf
@@@ -135,8 -135,7 +135,8 @@@ int init_dhcpv6(const char *ifname, in
                        htons(DHCPV6_OPT_DNS_DOMAIN),
                        htons(DHCPV6_OPT_NTP_SERVER),
                        htons(DHCPV6_OPT_SIP_SERVER_A),
 -                      htons(DHCPV6_OPT_SIP_SERVER_D)};
 +                          htons(DHCPV6_OPT_PREFIX_CLASS)
 +                         };
        odhcp6c_add_state(STATE_ORO, oro, sizeof(oro));
  
  
@@@ -648,6 -647,7 +648,7 @@@ static int dhcpv6_handle_reply(enum dhc
                        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
                                        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)
@@@ -726,11 -729,11 +730,11 @@@ static uint32_t dhcpv6_parse_ia(void *o
        uint16_t otype, olen;
        uint8_t *odata;
  
 -      struct odhcp6c_entry entry = {IN6ADDR_ANY_INIT,
 -                      0, 0, IN6ADDR_ANY_INIT, 0, 0};
 -
        // Update address IA
        dhcpv6_for_each_option(opt, end, otype, olen, odata) {
 +          struct odhcp6c_entry entry = {IN6ADDR_ANY_INIT,
 +                                        0, 0, IN6ADDR_ANY_INIT, 0, 0, 0};
 +
                if (otype == DHCPV6_OPT_IA_PREFIX) {
                        struct dhcpv6_ia_prefix *prefix = (void*)&odata[-4];
                        if (olen + 4U < sizeof(*prefix))
  
                        entry.length = prefix->prefix;
                        entry.target = prefix->addr;
 +                      uint16_t stype, slen;
 +                      uint8_t *sdata;
 +
 +                        // Find prefix class, if any
 +                      dhcpv6_for_each_option(odata, odata + olen,
 +                                               stype, slen, sdata)
 +                          if (stype == DHCPV6_OPT_PREFIX_CLASS && slen == 2) 
 +                            entry.prefix_class = ntohs(*((uint16_t*)sdata));
  
                        odhcp6c_update_entry(STATE_IA_PD, &entry);
                } else if (otype == DHCPV6_OPT_IA_ADDR) {