sd-dhcp6-client: append extra options before elapsed time option

The value of elapsed time option is determined in runtime and not
deterministic. It is hard to test the sent packets if it is located
in the intermidiate of the packet.
This commit is contained in:
Yu Watanabe
2022-02-14 15:02:33 +09:00
parent e261d31557
commit bbe3f62a16
+6 -6
View File
@@ -726,6 +726,12 @@ static int client_send_message(sd_dhcp6_client *client) {
if (r < 0)
return r;
ORDERED_HASHMAP_FOREACH(j, client->extra_options) {
r = dhcp6_option_append(&opt, &optlen, j->option, j->length, j->data);
if (r < 0)
return r;
}
/* RFC 8415 Section 21.9.
* A client MUST include an Elapsed Time option in messages to indicate how long the client has
* been trying to complete a DHCP message exchange. */
@@ -735,12 +741,6 @@ static int client_send_message(sd_dhcp6_client *client) {
if (r < 0)
return r;
ORDERED_HASHMAP_FOREACH(j, client->extra_options) {
r = dhcp6_option_append(&opt, &optlen, j->option, j->length, j->data);
if (r < 0)
return r;
}
r = dhcp6_network_send_udp_socket(client->fd, &all_servers, message,
len - optlen);
if (r < 0)