diff options
| author | Michael Biebl <biebl@debian.org> | 2024-01-25 09:46:18 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2024-01-25 09:46:18 +0100 |
| commit | 70e18d99b8e3e77bb37e218d7ac582130156f8ef (patch) | |
| tree | d40c587e6d3f0e094ff558e415f1bb9803643214 /src/core/dhcp/nm-dhcp-dhclient-utils.c | |
| parent | d4d8b2b91f7ba000d97a8b2aab48c85000c11314 (diff) | |
New upstream version 1.45.90 upstream/1.45.90
Diffstat (limited to 'src/core/dhcp/nm-dhcp-dhclient-utils.c')
| -rw-r--r-- | src/core/dhcp/nm-dhcp-dhclient-utils.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/dhcp/nm-dhcp-dhclient-utils.c b/src/core/dhcp/nm-dhcp-dhclient-utils.c index ea8943fa..286f7aa1 100644 --- a/src/core/dhcp/nm-dhcp-dhclient-utils.c +++ b/src/core/dhcp/nm-dhcp-dhclient-utils.c @@ -120,7 +120,10 @@ add_ip4_config(GString *str, } g_string_append(str, CLIENTID_TAG " "); - if (i < l) { + if (l == 0) { + /* An empty value effectively unsets the client-id to avoid sending it */ + g_string_append(str, "\"\""); + } else if (i < l) { /* Unprintable; convert to a hex string */ for (i = 0; i < l; i++) { if (i > 0) @@ -293,6 +296,7 @@ char * nm_dhcp_dhclient_create_config(const char *interface, int addr_family, GBytes *client_id, + gboolean send_client_id, const char *anycast_address, const char *hostname, guint32 timeout, @@ -391,8 +395,8 @@ nm_dhcp_dhclient_create_config(const char *interface, continue; if (NM_STR_HAS_PREFIX(p, CLIENTID_TAG)) { - /* Override config file "dhcp-client-id" and use one from the connection */ - if (client_id) + /* Skip "dhcp-client-id" if the connection has defined a custom one or "none" */ + if (client_id || !send_client_id) continue; /* Otherwise, capture and return the existing client id */ @@ -477,6 +481,8 @@ nm_dhcp_dhclient_create_config(const char *interface, } if (addr_family == AF_INET) { + nm_auto_unref_bytes GBytes *client_id_none = NULL; + client_id = send_client_id ? client_id : (client_id_none = g_bytes_new_static("", 0)); add_ip4_config(new_contents, client_id, hostname, use_fqdn, hostname_flags); add_request(reqs, "rfc3442-classless-static-routes"); add_request(reqs, "ms-classless-static-routes"); |