From: Steven Barth Date: Wed, 18 Sep 2013 10:25:20 +0000 (+0200) Subject: Restart transaction if server returns IAID error code X-Git-Tag: debian/1.1+git20160131-1~130 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=122c431883b221393d8876bef8a07e87e0e524d1;p=odhcp6c.git Restart transaction if server returns IAID error code --- diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 50bbb02..ee2031d 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -744,18 +744,20 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig, if (ia_hdr->iaid != 1 || l_t2 < l_t1) continue; - bool error = false; + int error = 0; uint16_t stype, slen; uint8_t *sdata; // Test status and bail if error dhcpv6_for_each_option(&ia_hdr[1], odata + olen, stype, slen, sdata) - if (stype == DHCPV6_OPT_STATUS && slen >= 2 && - (sdata[0] || sdata[1])) - error = true; + if (stype == DHCPV6_OPT_STATUS && slen >= 2) + error = ((int)sdata[0]) << 8 | ((int)sdata[1]); - if (error) - continue; + if (error) { + syslog(LOG_WARNING, "Server returned IAID status %i!", error); + raise(SIGUSR2); + break; + } uint32_t n = dhcpv6_parse_ia(&ia_hdr[1], odata + olen);