mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
Merge pull request #29013 from yuwata/sd-dhcp-client-ensure-iaid-and-duid
sd-dhcp-client: set IAID and DUID earlier
This commit is contained in:
commit
73ac9520ec
@ -870,13 +870,6 @@ static int client_message_init(
|
||||
if (client->request_broadcast || client->arp_type != ARPHRD_ETHER)
|
||||
packet->dhcp.flags = htobe16(0x8000);
|
||||
|
||||
/* If no client identifier exists, construct an RFC 4361-compliant one */
|
||||
if (client->client_id_len == 0) {
|
||||
r = sd_dhcp_client_set_iaid_duid_en(client, /* iaid_set = */ false, /* iaid = */ 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Some DHCP servers will refuse to issue an DHCP lease if the Client
|
||||
Identifier option is not set */
|
||||
r = dhcp_option_append(&packet->dhcp, optlen, &optoffset, 0,
|
||||
@ -2075,6 +2068,13 @@ int sd_dhcp_client_start(sd_dhcp_client *client) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* If no client identifier exists, construct an RFC 4361-compliant one */
|
||||
if (client->client_id_len == 0) {
|
||||
r = sd_dhcp_client_set_iaid_duid_en(client, /* iaid_set = */ false, /* iaid = */ 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* RFC7844 section 3.3:
|
||||
SHOULD perform a complete four-way handshake, starting with a
|
||||
DHCPDISCOVER, to obtain a new address lease. If the client can
|
||||
|
@ -522,9 +522,7 @@ static void test_addr_acq(sd_event *e) {
|
||||
res = sd_dhcp_client_start(client);
|
||||
assert_se(IN_SET(res, 0, -EINPROGRESS));
|
||||
|
||||
r = sd_event_loop(e);
|
||||
/* Times out since https://github.com/systemd/systemd/issues/28990 add workaorund for now */
|
||||
assert_se(r >= 0 || r == -ETIMEDOUT);
|
||||
assert_se(sd_event_loop(e) >= 0);
|
||||
|
||||
assert_se(sd_dhcp_client_set_callback(client, NULL, NULL) >= 0);
|
||||
assert_se(sd_dhcp_client_stop(client) >= 0);
|
||||
|
Loading…
Reference in New Issue
Block a user