From: Vladislav Grishenko Date: Mon, 13 Jul 2015 13:12:41 +0000 (+0500) Subject: Merge branch 'upstream' X-Git-Tag: debian/1.1+git20160131-1~11^2 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=odhcp6c.git;a=commitdiff_plain;h=b30bce275255b48de02783e85b8cb3e0ba9dea2e;hp=-c Merge branch 'upstream' --- b30bce275255b48de02783e85b8cb3e0ba9dea2e diff --combined src/dhcpv6.c index a3e0a18,cc28627..cfa3f29 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@@ -272,21 -272,17 +272,21 @@@ static void dhcpv6_send(enum dhcpv6_ms for (size_t i = 0; i < n_prefixes; i++) { struct dhcpv6_ia_hdr hdr_ia_pd = { htons(DHCPV6_OPT_IA_PD), - htons(sizeof(hdr_ia_pd) - 4 + sizeof(struct dhcpv6_ia_prefix)), + htons(sizeof(hdr_ia_pd) - 4 + + sizeof(struct dhcpv6_ia_prefix) * !!request_prefixes[i].length), request_prefixes[i].iaid, 0, 0 }; struct dhcpv6_ia_prefix pref = { .type = htons(DHCPV6_OPT_IA_PREFIX), - .len = htons(25), .prefix = request_prefixes[i].length + .len = htons(sizeof(pref) - 4), + .prefix = request_prefixes[i].length }; memcpy(ia_pd + ia_pd_len, &hdr_ia_pd, sizeof(hdr_ia_pd)); ia_pd_len += sizeof(hdr_ia_pd); - memcpy(ia_pd + ia_pd_len, &pref, sizeof(pref)); - ia_pd_len += sizeof(pref); + if (request_prefixes[i].length) { + memcpy(ia_pd + ia_pd_len, &pref, sizeof(pref)); + ia_pd_len += sizeof(pref); + } } } else { struct odhcp6c_entry *e = odhcp6c_get_state(STATE_IA_PD, &ia_pd_entries); @@@ -797,18 -793,6 +797,6 @@@ static int dhcpv6_handle_advert(enum dh if (otype == DHCPV6_OPT_SERVERID && olen <= 130) { memcpy(cand.duid, odata, olen); cand.duid_len = olen; - } else if (otype == DHCPV6_OPT_STATUS && olen >= 2) { - int error = ((int)odata[0] << 8 | (int)odata[1]); - - switch (error) { - case DHCPV6_NoPrefixAvail: - // Status code on global level - cand.preference -= 2000; - break; - - default : - break; - } } else if (otype == DHCPV6_OPT_PREF && olen >= 1 && cand.preference >= 0) { cand.preference = pref = odata[0];