X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fdhcpv6.c;h=fe06ea3af0a073c13896659e546a1c23df746a82;hb=63d69ee753cbc8a346e2d6c3d11121c4b673bfad;hp=86f24e070bf9d5c6d4ecc66a4e2c1c12380c3d71;hpb=4369d2f0e1ab9682d677f2f8fd876329e740fb0b;p=odhcp6c.git diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 86f24e0..fe06ea3 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -60,7 +60,7 @@ static int dhcpv6_commit_advert(void); static struct dhcpv6_retx dhcpv6_retx[_DHCPV6_MSG_MAX] = { [DHCPV6_MSG_UNKNOWN] = {false, 1, 120, "", dhcpv6_handle_reconfigure, NULL}, - [DHCPV6_MSG_SOLICIT] = {true, 1, 120, "SOLICIT", + [DHCPV6_MSG_SOLICIT] = {true, 1, 7200, "SOLICIT", dhcpv6_handle_advert, dhcpv6_commit_advert}, [DHCPV6_MSG_REQUEST] = {true, 30, 10, "REQUEST", dhcpv6_handle_reply, NULL}, @@ -381,8 +381,9 @@ int dhcpv6_request(enum dhcpv6_msg type) uint64_t start = odhcp6c_get_milli_time(), round_start = start, elapsed; // Generate transaction ID - uint8_t trid[3]; - odhcp6c_random(trid, sizeof(trid)); + uint8_t trid[3] = {0, 0, 0}; + if (type != DHCPV6_MSG_UNKNOWN) + odhcp6c_random(trid, sizeof(trid)); ssize_t len = -1; int64_t rto = 0; @@ -584,7 +585,7 @@ static int dhcpv6_handle_advert(_unused enum dhcpv6_msg orig, } else if (otype == DHCPV6_OPT_RECONF_ACCEPT) { cand.wants_reconfigure = true; } else if (otype == DHCPV6_OPT_IA_PD && request_prefix) { - struct dhcpv6_ia_hdr *h = (void*)odata; + struct dhcpv6_ia_hdr *h = (struct dhcpv6_ia_hdr*)&odata[-4]; uint8_t *oend = odata + olen, *d; dhcpv6_for_each_option(&h[1], oend, otype, olen, d) { if (otype == DHCPV6_OPT_IA_PREFIX)