network: dhcp4: warn when Anonymize=yes and ClientIdentifier= is not mac
This commit is contained in:
@@ -35,13 +35,20 @@ void network_adjust_dhcp4(Network *network) {
|
||||
if (network->dhcp_use_gateway < 0)
|
||||
network->dhcp_use_gateway = network->dhcp_use_routes;
|
||||
|
||||
if (network->dhcp_anonymize) {
|
||||
/* RFC7844 section 3.: MAY contain the Client Identifier option
|
||||
* Section 3.5: clients MUST use client identifiers based solely on the link-layer address
|
||||
* NOTE: Using MAC, as it does not reveal extra information, and some servers might not
|
||||
* answer if this option is not sent */
|
||||
/* RFC7844 section 3.: MAY contain the Client Identifier option
|
||||
* Section 3.5: clients MUST use client identifiers based solely on the link-layer address
|
||||
* NOTE: Using MAC, as it does not reveal extra information, and some servers might not answer
|
||||
* if this option is not sent */
|
||||
if (network->dhcp_anonymize &&
|
||||
network->dhcp_client_identifier >= 0 &&
|
||||
network->dhcp_client_identifier != DHCP_CLIENT_ID_MAC) {
|
||||
log_warning("%s: ClientIdentifier= is set, although Anonymize=yes. Using ClientIdentifier=mac.",
|
||||
network->filename);
|
||||
network->dhcp_client_identifier = DHCP_CLIENT_ID_MAC;
|
||||
}
|
||||
|
||||
if (network->dhcp_client_identifier < 0)
|
||||
network->dhcp_client_identifier = network->dhcp_anonymize ? DHCP_CLIENT_ID_MAC : DHCP_CLIENT_ID_DUID;
|
||||
}
|
||||
|
||||
static int dhcp4_release_old_lease(Link *link) {
|
||||
|
||||
@@ -312,8 +312,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
||||
.dhcp_send_hostname = true,
|
||||
.dhcp_send_release = true,
|
||||
.dhcp_route_metric = DHCP_ROUTE_METRIC,
|
||||
/* NOTE: this var might be overwritten by network_adjust_dhcp4() */
|
||||
.dhcp_client_identifier = DHCP_CLIENT_ID_DUID,
|
||||
.dhcp_client_identifier = _DHCP_CLIENT_ID_INVALID,
|
||||
.dhcp_route_table = RT_TABLE_MAIN,
|
||||
.dhcp_ip_service_type = -1,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user