From: Yu Watanabe Date: Thu, 10 Feb 2022 12:44:28 +0000 (+0900) Subject: sd-dhcp6-client: append extra options before elapsed time option X-Git-Tag: v251-rc1~291^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbe3f62a163795153b085850023d60601199b74a;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index bc76e026bd6..45994c93ce4 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -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)