case DHCP6_STATE_SOLICITATION:
message->type = DHCP6_SOLICIT;
- r = dhcp6_option_append(&opt, &optlen, DHCP6_OPTION_CLIENTID,
- sizeof(client->duid), &client->duid);
+ r = dhcp6_option_append_ia(&opt, &optlen, &client->ia_na);
if (r < 0)
return r;
- r = dhcp6_option_append_ia(&opt, &optlen, &client->ia_na);
+ break;
+
+ case DHCP6_STATE_REQUEST:
+ message->type = DHCP6_REQUEST;
+
+ r = dhcp6_option_append(&opt, &optlen, DHCP6_OPTION_SERVERID,
+ client->lease->serverid_len,
+ client->lease->serverid);
+ if (r < 0)
+ return r;
+
+ r = dhcp6_option_append_ia(&opt, &optlen, &client->lease->ia);
if (r < 0)
return r;
return -EINVAL;
}
+ r = dhcp6_option_append(&opt, &optlen, DHCP6_OPTION_CLIENTID,
+ sizeof(client->duid), &client->duid);
+ if (r < 0)
+ return r;
+
r = dhcp6_network_send_udp_socket(client->fd, &all_servers, message,
len - optlen);
if (r < 0)
switch (client->state) {
case DHCP6_STATE_SOLICITATION:
+
+ if (client->retransmit_count && client->lease) {
+ client_start(client, DHCP6_STATE_REQUEST);
+ return 0;
+ }
+
init_retransmit_time = DHCP6_SOL_TIMEOUT;
max_retransmit_time = DHCP6_SOL_MAX_RT;
max_retransmit_count = 0;
break;
+ case DHCP6_STATE_REQUEST:
+ init_retransmit_time = DHCP6_REQ_TIMEOUT;
+ max_retransmit_time = DHCP6_REQ_MAX_RT;
+ max_retransmit_count = DHCP6_REQ_MAX_RC;
+ max_retransmit_duration = 0;
+
+ break;
+
case DHCP6_STATE_STOPPED:
case DHCP6_STATE_RS:
return 0;
r = 0;
}
+ if (pref_advertise == 255 || client->retransmit_count > 1)
+ r = DHCP6_STATE_REQUEST;
+
return r;
}
case DHCP6_STATE_SOLICITATION:
r = client_receive_advertise(client, message, len);
+ if (r == DHCP6_STATE_REQUEST)
+ client_start(client, r);
+
break;
+ case DHCP6_STATE_REQUEST:
case DHCP6_STATE_STOPPED:
case DHCP6_STATE_RS:
return 0;
client->state = DHCP6_STATE_SOLICITATION;
break;
+
+ case DHCP6_STATE_REQUEST:
+ client->state = state;
+
+ break;
}
client->transaction_id = random_u32() & htobe32(0x00ffffff);