mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-06 16:21:50 +00:00
n-dhcp4: allow not to send the client-identifier
Sending the client-identifier (DHCP Option 61) is not mandatory, although it's recommended, and there are some weird cases where clients need not to send it. Allow not to send it by leaving client_id unset.
This commit is contained in:
parent
f78a18bf16
commit
320e386b09
|
@ -543,12 +543,14 @@ static int n_dhcp4_c_connection_new_message(NDhcp4CConnection *connection,
|
|||
if (r)
|
||||
return r;
|
||||
|
||||
r = n_dhcp4_outgoing_append(message,
|
||||
N_DHCP4_OPTION_CLIENT_IDENTIFIER,
|
||||
connection->client_config->client_id,
|
||||
connection->client_config->n_client_id);
|
||||
if (r)
|
||||
return r;
|
||||
if (connection->client_config->n_client_id > 0) {
|
||||
r = n_dhcp4_outgoing_append(message,
|
||||
N_DHCP4_OPTION_CLIENT_IDENTIFIER,
|
||||
connection->client_config->client_id,
|
||||
connection->client_config->n_client_id);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
switch (message_type) {
|
||||
case N_DHCP4_MESSAGE_DISCOVER:
|
||||
|
|
|
@ -403,7 +403,7 @@ _c_public_ int n_dhcp4_client_new(NDhcp4Client **clientp, NDhcp4ClientConfig *co
|
|||
return N_DHCP4_E_INVALID_TRANSPORT;
|
||||
}
|
||||
|
||||
if (config->n_client_id < 1)
|
||||
if (config->n_client_id != 0 && config->n_client_id < 2)
|
||||
return N_DHCP4_E_INVALID_CLIENT_ID;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue