about summary refs log tree commit diff
path: root/src/core/dhcp/nm-dhcp-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/dhcp/nm-dhcp-client.c')
-rw-r--r--src/core/dhcp/nm-dhcp-client.c45
1 files changed, 14 insertions, 31 deletions
diff --git a/src/core/dhcp/nm-dhcp-client.c b/src/core/dhcp/nm-dhcp-client.c
index 18ad4024..c17e5544 100644
--- a/src/core/dhcp/nm-dhcp-client.c
+++ b/src/core/dhcp/nm-dhcp-client.c
@@ -266,9 +266,8 @@ nm_dhcp_client_create_options_dict(NMDhcpClient *self, gboolean static_keys)
         guint option = IS_IPv4 ? NM_DHCP_OPTION_DHCP4_CLIENT_ID : NM_DHCP_OPTION_DHCP6_CLIENT_ID;
         gs_free char *str = nm_dhcp_utils_duid_to_string(effective_client_id);
 
-        /* Note that for the nm-dhcp-helper based plugins (dhclient), the plugin
-         * may send the used client-id/DUID via the environment variables and
-         * overwrite them yet again. */
+        /* Note that nm-dhcp-helper based plugins may send the used client-id/DUID
+         * via the environment variables and overwrite them yet again. */
 
         nm_dhcp_option_take_option(options,
                                    static_keys,
@@ -786,13 +785,12 @@ _nm_dhcp_client_notify(NMDhcpClient         *self,
                        NMDhcpClientEventType client_event_type,
                        const NML3ConfigData *l3cd)
 {
-    NMDhcpClientPrivate                     *priv = NM_DHCP_CLIENT_GET_PRIVATE(self);
-    GHashTable                              *options;
-    gboolean                                 l3cd_changed;
-    NMOptionBool                             acd_state;
-    const int                                IS_IPv4     = NM_IS_IPv4(priv->config.addr_family);
-    nm_auto_unref_l3cd const NML3ConfigData *l3cd_merged = NULL;
-    char                                     sbuf1[NM_HASH_OBFUSCATE_PTR_STR_BUF_SIZE];
+    NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE(self);
+    GHashTable          *options;
+    gboolean             l3cd_changed;
+    NMOptionBool         acd_state;
+    const int            IS_IPv4 = NM_IS_IPv4(priv->config.addr_family);
+    char                 sbuf1[NM_HASH_OBFUSCATE_PTR_STR_BUF_SIZE];
 
     nm_assert(NM_IN_SET(client_event_type,
                         NM_DHCP_CLIENT_EVENT_TYPE_UNSPECIFIED,
@@ -825,16 +823,6 @@ _nm_dhcp_client_notify(NMDhcpClient         *self,
     if (client_event_type >= NM_DHCP_CLIENT_EVENT_TYPE_TIMEOUT)
         watch_cleanup(self);
 
-    if (!IS_IPv4 && l3cd) {
-        /* nm_dhcp_utils_merge_new_dhcp6_lease() relies on "life_starts" option
-         * for merging, which is only set by dhclient. Internal client never sets that,
-         * but it supports multiple IP addresses per lease. */
-        if (nm_dhcp_utils_merge_new_dhcp6_lease(priv->l3cd_next, l3cd, &l3cd_merged)) {
-            _LOGD("lease merged with existing one");
-            l3cd = nm_l3_config_data_seal(l3cd_merged);
-        }
-    }
-
     if (l3cd) {
         nm_clear_g_source_inst(&priv->no_lease_timeout_source);
     } else
@@ -1460,7 +1448,9 @@ nm_dhcp_client_schedule_ipv6_only_restart(NMDhcpClient *self, guint timeout)
     nm_assert(!priv->is_stopped);
 
     timeout = NM_MAX(priv->v4.ipv6_only_min_wait, timeout);
-    _LOGI("received option \"ipv6-only-preferred\": stopping DHCPv4 for %u seconds", timeout);
+    _LOGI("received option \"ipv6-only-preferred\": stopping DHCPv4 for %u seconds. Set "
+          "ipv4.dhcp-ipv6-only-preferred=no to force the use of IPv4 on this IPv6-mostly network",
+          timeout);
 
     nm_dhcp_client_stop(self, FALSE);
     nm_clear_g_source_inst(&priv->no_lease_timeout_source);
@@ -1690,21 +1680,14 @@ maybe_add_option(NMDhcpClient *self, GHashTable *hash, const char *key, GVariant
 
     g_hash_table_insert(hash, g_strdup(key), str_value);
 
-    /* dhclient has no special labels for private dhcp options: it uses "unknown_xyz"
-     * labels for that. We need to identify those to alias them to our "private_xyz"
-     * format unused in the internal dchp plugins.
-     */
+    /* "unknown_xyz" labels are aliased to our "private_xyz" format. */
     if ((priv_opt_num = label_is_unknown_xyz(key)) > 0) {
         gs_free guint8 *check_val = NULL;
         char           *hex_str   = NULL;
         gsize           len;
 
-        /* dhclient passes values from dhcp private options in its own "string" format:
-         * if the raw values are printable as ascii strings, it will pass the string
-         * representation; if the values are not printable as an ascii string, it will
-         * pass a string displaying the hex values (hex string). Try to enforce passing
-         * always an hex string, converting string representation if needed.
-         */
+        /* Private options may arrive as printable ascii strings or as hex strings.
+         * Normalize to always use hex string format. */
         check_val = nm_utils_hexstr2bin_alloc(str_value, FALSE, TRUE, ":", 0, &len);
         hex_str   = nm_utils_bin2hexstr_full(check_val ?: (guint8 *) str_value,
                                            check_val ? len : strlen(str_value),