summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-04-14 13:14:30 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-04-14 14:15:11 +0900
commitf90635f14fb6ff67905ffa16cc4683dbdeda8212 (patch)
tree7e3146a131bb86bdc1b3fdb77e92bc3fe13887b5 /src/network
parent00781958358d5da94bbdeb7250fd9b9c865f6de2 (diff)
downloadsystemd-f90635f14fb6ff67905ffa16cc4683dbdeda8212.tar.gz
network: dhcp4: warn when Anonymize=yes and ClientIdentifier= is not mac
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-dhcp4.c17
-rw-r--r--src/network/networkd-network.c3
2 files changed, 13 insertions, 7 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 067247f497..33f501b593 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -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) {
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index ca3582cc8e..03eaf6f5dd 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -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,