Get rid of the variable request_prefix as it serves no purpose anymore
and even triggers wrong code in dhcpv6_send by setting cnt to 12 which
is an invalid msg_iovlen index
Where appropriate request_prefix check can be replaced by checking the
pd_mode variable.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
static int64_t t1 = 0, t2 = 0, t3 = 0;
// IA states
static int64_t t1 = 0, t2 = 0, t3 = 0;
// IA states
-static int request_prefix = -1;
static enum odhcp6c_ia_mode na_mode = IA_MODE_NONE, pd_mode = IA_MODE_NONE;
static bool accept_reconfig = false;
// Server unicast address
static enum odhcp6c_ia_mode na_mode = IA_MODE_NONE, pd_mode = IA_MODE_NONE;
static bool accept_reconfig = false;
// Server unicast address
- if (ia_pd_entries > 0)
- request_prefix = 1;
-
// Build IA_NAs
size_t ia_na_entries, ia_na_len = 0;
void *ia_na = NULL;
// Build IA_NAs
size_t ia_na_entries, ia_na_len = 0;
void *ia_na = NULL;
size_t cnt = IOV_TOTAL;
if (type == DHCPV6_MSG_INFO_REQ)
cnt = 8;
size_t cnt = IOV_TOTAL;
if (type == DHCPV6_MSG_INFO_REQ)
cnt = 8;
- else if (!request_prefix)
- cnt = 12;
// Disable IAs if not used
if (type != DHCPV6_MSG_SOLICIT && ia_na_len == 0)
// Disable IAs if not used
if (type != DHCPV6_MSG_SOLICIT && ia_na_len == 0)
inf_max_rt <= DHCPV6_INF_MAX_RT_MAX)
cand.inf_max_rt = inf_max_rt;
inf_max_rt <= DHCPV6_INF_MAX_RT_MAX)
cand.inf_max_rt = inf_max_rt;
- } else if (otype == DHCPV6_OPT_IA_PD && request_prefix &&
+ } else if (otype == DHCPV6_OPT_IA_PD &&
olen >= -4 + sizeof(struct dhcpv6_ia_hdr)) {
struct dhcpv6_ia_hdr *h = (struct dhcpv6_ia_hdr*)&odata[-4];
uint8_t *oend = odata + olen, *d;
olen >= -4 + sizeof(struct dhcpv6_ia_hdr)) {
struct dhcpv6_ia_hdr *h = (struct dhcpv6_ia_hdr*)&odata[-4];
uint8_t *oend = odata + olen, *d;
if (cand->ia_pd_len) {
odhcp6c_add_state(STATE_IA_PD, cand->ia_pd, cand->ia_pd_len);
free(cand->ia_pd);
if (cand->ia_pd_len) {
odhcp6c_add_state(STATE_IA_PD, cand->ia_pd, cand->ia_pd_len);
free(cand->ia_pd);
+ if (pd_mode != IA_MODE_NONE)