mirror of
https://github.com/systemd/systemd.git
synced 2025-01-21 22:04:01 +03:00
network,dhcp: drop support of ClientIdentifier=duid-only
The setting has not been never worked, not tested, and should not been used. As the option is RFC incompliant. Let's drop it. Closes #25562.
This commit is contained in:
parent
dfecd67f30
commit
d8f19e03c0
@ -1789,12 +1789,12 @@ allow my_server_t localnet_peer_t:peer recv;</programlisting>
|
||||
<varlistentry>
|
||||
<term><varname>ClientIdentifier=</varname></term>
|
||||
<listitem>
|
||||
<para>The DHCPv4 client identifier to use. Takes one of <option>mac</option>,
|
||||
<option>duid</option> or <option>duid-only</option>. If set to <option>mac</option>, the
|
||||
MAC address of the link is used. If set to <option>duid</option>, an RFC4361-compliant Client
|
||||
ID, which is the combination of IAID and DUID (see below), is used. If set to
|
||||
<option>duid-only</option>, only DUID is used, this may not be RFC compliant, but some setups
|
||||
may require to use this. Defaults to <option>duid</option>.</para>
|
||||
<para>The DHCPv4 client identifier to use. Takes one of <option>mac</option> or
|
||||
<option>duid</option>. If set to <option>mac</option>, the MAC address of the link is used. If set
|
||||
to <option>duid</option>, an RFC4361-compliant Client ID, which is the combination of IAID and
|
||||
DUID, is used. IAID can be configured by <varname>IAID=</varname>. DUID can be configured by
|
||||
<varname>DUIDType=</varname> and <varname>DUIDRawData=</varname>. Defaults to
|
||||
<option>duid</option>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@ -404,7 +404,6 @@ int sd_dhcp_client_set_client_id(
|
||||
*/
|
||||
static int dhcp_client_set_iaid_duid_internal(
|
||||
sd_dhcp_client *client,
|
||||
bool iaid_append,
|
||||
bool iaid_set,
|
||||
uint32_t iaid,
|
||||
DUIDType duid_type,
|
||||
@ -428,16 +427,14 @@ static int dhcp_client_set_iaid_duid_internal(
|
||||
zero(client->client_id);
|
||||
client->client_id.type = 255;
|
||||
|
||||
if (iaid_append) {
|
||||
if (iaid_set)
|
||||
client->client_id.ns.iaid = htobe32(iaid);
|
||||
else {
|
||||
r = dhcp_identifier_set_iaid(client->dev, &client->hw_addr,
|
||||
/* legacy_unstable_byteorder = */ true,
|
||||
&client->client_id.ns.iaid);
|
||||
if (r < 0)
|
||||
return log_dhcp_client_errno(client, r, "Failed to set IAID: %m");
|
||||
}
|
||||
if (iaid_set)
|
||||
client->client_id.ns.iaid = htobe32(iaid);
|
||||
else {
|
||||
r = dhcp_identifier_set_iaid(client->dev, &client->hw_addr,
|
||||
/* legacy_unstable_byteorder = */ true,
|
||||
&client->client_id.ns.iaid);
|
||||
if (r < 0)
|
||||
return log_dhcp_client_errno(client, r, "Failed to set IAID: %m");
|
||||
}
|
||||
|
||||
if (duid) {
|
||||
@ -459,8 +456,7 @@ static int dhcp_client_set_iaid_duid_internal(
|
||||
duid_type_to_string(duid_type));
|
||||
}
|
||||
|
||||
client->client_id_len = sizeof(client->client_id.type) + len +
|
||||
(iaid_append ? sizeof(client->client_id.ns.iaid) : 0);
|
||||
client->client_id_len = sizeof(client->client_id.type) + sizeof(client->client_id.ns.iaid) + len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -472,7 +468,7 @@ int sd_dhcp_client_set_iaid_duid(
|
||||
uint16_t duid_type,
|
||||
const void *duid,
|
||||
size_t duid_len) {
|
||||
return dhcp_client_set_iaid_duid_internal(client, true, iaid_set, iaid, duid_type, duid, duid_len, 0);
|
||||
return dhcp_client_set_iaid_duid_internal(client, iaid_set, iaid, duid_type, duid, duid_len, 0);
|
||||
}
|
||||
|
||||
int sd_dhcp_client_set_iaid_duid_llt(
|
||||
@ -480,21 +476,7 @@ int sd_dhcp_client_set_iaid_duid_llt(
|
||||
bool iaid_set,
|
||||
uint32_t iaid,
|
||||
usec_t llt_time) {
|
||||
return dhcp_client_set_iaid_duid_internal(client, true, iaid_set, iaid, DUID_TYPE_LLT, NULL, 0, llt_time);
|
||||
}
|
||||
|
||||
int sd_dhcp_client_set_duid(
|
||||
sd_dhcp_client *client,
|
||||
uint16_t duid_type,
|
||||
const void *duid,
|
||||
size_t duid_len) {
|
||||
return dhcp_client_set_iaid_duid_internal(client, false, false, 0, duid_type, duid, duid_len, 0);
|
||||
}
|
||||
|
||||
int sd_dhcp_client_set_duid_llt(
|
||||
sd_dhcp_client *client,
|
||||
usec_t llt_time) {
|
||||
return dhcp_client_set_iaid_duid_internal(client, false, false, 0, DUID_TYPE_LLT, NULL, 0, llt_time);
|
||||
return dhcp_client_set_iaid_duid_internal(client, iaid_set, iaid, DUID_TYPE_LLT, NULL, 0, llt_time);
|
||||
}
|
||||
|
||||
void dhcp_client_set_test_mode(sd_dhcp_client *client, bool test_mode) {
|
||||
|
@ -1260,22 +1260,6 @@ static int dhcp4_set_client_identifier(Link *link) {
|
||||
return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set IAID+DUID: %m");
|
||||
break;
|
||||
}
|
||||
case DHCP_CLIENT_ID_DUID_ONLY: {
|
||||
/* If configured, apply user specified DUID */
|
||||
const DUID *duid = link_get_dhcp4_duid(link);
|
||||
|
||||
if (duid->type == DUID_TYPE_LLT && duid->raw_data_len == 0)
|
||||
r = sd_dhcp_client_set_duid_llt(link->dhcp_client,
|
||||
duid->llt_time);
|
||||
else
|
||||
r = sd_dhcp_client_set_duid(link->dhcp_client,
|
||||
duid->type,
|
||||
duid->raw_data_len > 0 ? duid->raw_data : NULL,
|
||||
duid->raw_data_len);
|
||||
if (r < 0)
|
||||
return log_link_debug_errno(link, r, "DHCPv4 CLIENT: Failed to set DUID: %m");
|
||||
break;
|
||||
}
|
||||
case DHCP_CLIENT_ID_MAC: {
|
||||
const uint8_t *hw_addr = link->hw_addr.bytes;
|
||||
size_t hw_addr_len = link->hw_addr.length;
|
||||
@ -1595,8 +1579,9 @@ int dhcp4_start(Link *link) {
|
||||
|
||||
static int dhcp4_configure_duid(Link *link) {
|
||||
assert(link);
|
||||
assert(link->network);
|
||||
|
||||
if (!IN_SET(link->network->dhcp_client_identifier, DHCP_CLIENT_ID_DUID, DHCP_CLIENT_ID_DUID_ONLY))
|
||||
if (link->network->dhcp_client_identifier != DHCP_CLIENT_ID_DUID)
|
||||
return 1;
|
||||
|
||||
return dhcp_configure_duid(link, link_get_dhcp4_duid(link));
|
||||
@ -1832,9 +1817,8 @@ int config_parse_dhcp_label(
|
||||
}
|
||||
|
||||
static const char* const dhcp_client_identifier_table[_DHCP_CLIENT_ID_MAX] = {
|
||||
[DHCP_CLIENT_ID_MAC] = "mac",
|
||||
[DHCP_CLIENT_ID_MAC] = "mac",
|
||||
[DHCP_CLIENT_ID_DUID] = "duid",
|
||||
[DHCP_CLIENT_ID_DUID_ONLY] = "duid-only",
|
||||
};
|
||||
|
||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(dhcp_client_identifier, DHCPClientIdentifier);
|
||||
|
@ -9,11 +9,6 @@ typedef struct Network Network;
|
||||
typedef enum DHCPClientIdentifier {
|
||||
DHCP_CLIENT_ID_MAC,
|
||||
DHCP_CLIENT_ID_DUID,
|
||||
/* The following option may not be good for RFC regarding DHCP (3315 and 4361).
|
||||
* But some setups require this. E.g., Sky Broadband, the second largest provider in the UK
|
||||
* requires the client id to be set to a custom string, reported at
|
||||
* https://github.com/systemd/systemd/issues/7828 */
|
||||
DHCP_CLIENT_ID_DUID_ONLY,
|
||||
_DHCP_CLIENT_ID_MAX,
|
||||
_DHCP_CLIENT_ID_INVALID = -EINVAL,
|
||||
} DHCPClientIdentifier;
|
||||
|
@ -269,14 +269,6 @@ __extension__ int sd_dhcp_client_set_iaid_duid_llt(
|
||||
bool iaid_set,
|
||||
uint32_t iaid,
|
||||
uint64_t llt_time);
|
||||
int sd_dhcp_client_set_duid(
|
||||
sd_dhcp_client *client,
|
||||
uint16_t duid_type,
|
||||
const void *duid,
|
||||
size_t duid_len);
|
||||
int sd_dhcp_client_set_duid_llt(
|
||||
sd_dhcp_client *client,
|
||||
uint64_t llt_time);
|
||||
int sd_dhcp_client_get_client_id(
|
||||
sd_dhcp_client *client,
|
||||
uint8_t *ret_type,
|
||||
|
Loading…
x
Reference in New Issue
Block a user