about summary refs log tree commit diff
path: root/src/core
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2021-09-27 13:36:06 +0200
committerSebastien Bacher <seb128@ubuntu.com>2021-09-27 13:36:06 +0200
commit2bfcbfb13b1672c072e4f902260d2122b3e3c122 (patch)
tree3469f17ea9af91f7ff169b890633bda68b0cf76e /src/core
parentcfb80376641fa49137b9996130352697e7f8b436 (diff)
New upstream version 1.32.12
Diffstat (limited to 'src/core')
-rw-r--r--src/core/devices/nm-device-ethernet.c32
-rw-r--r--src/core/nm-active-connection.c7
-rw-r--r--src/core/nm-ip4-config.c2
-rw-r--r--src/core/settings/nm-settings-connection.c2
4 files changed, 26 insertions, 17 deletions
diff --git a/src/core/devices/nm-device-ethernet.c b/src/core/devices/nm-device-ethernet.c
index 305552f0..95336c7a 100644
--- a/src/core/devices/nm-device-ethernet.c
+++ b/src/core/devices/nm-device-ethernet.c
@@ -923,31 +923,33 @@ link_negotiation_set(NMDevice *device)
         return;
     }
 
-    /* If link negotiation setting are already in place do nothing and return with success */
-    if (!!autoneg == !!link_autoneg && speed == link_speed && duplex == link_duplex) {
-        _LOGD(LOGD_DEVICE, "set-link: link negotiation is already configured");
-        return;
-    }
-
     if (autoneg && !speed && !duplex)
         _LOGD(LOGD_DEVICE, "set-link: configure auto-negotiation");
     else {
         _LOGD(LOGD_DEVICE,
-              "set-link: configure %snegotiation (%u Mbit%s, %s duplex%s)",
+              "set-link: configure %snegotiation (%u Mbit, %s duplex)",
               autoneg ? "auto-" : "static ",
-              speed ?: link_speed,
-              speed ? "" : "*",
-              duplex ? nm_platform_link_duplex_type_to_string(duplex)
-                     : nm_platform_link_duplex_type_to_string(link_duplex),
-              duplex ? "" : "*");
+              speed,
+              nm_platform_link_duplex_type_to_string(duplex));
     }
 
     if (!priv->ethtool_prev_set) {
         /* remember the values we had before setting it. */
         priv->ethtool_prev_autoneg = link_autoneg;
-        priv->ethtool_prev_speed   = link_speed;
-        priv->ethtool_prev_duplex  = link_duplex;
-        priv->ethtool_prev_set     = TRUE;
+        if (link_autoneg) {
+            /* with autoneg, we only support advertising one speed/duplex. Likewise
+             * our nm_platform_ethtool_get_link_settings() can only return the current
+             * speed/duplex, but not all the modes that we were advertising.
+             *
+             * Do the best we can do: remember to re-enable autoneg, but don't restrict
+             * the mode. */
+            priv->ethtool_prev_speed  = 0;
+            priv->ethtool_prev_duplex = NM_PLATFORM_LINK_DUPLEX_UNKNOWN;
+        } else {
+            priv->ethtool_prev_speed  = link_speed;
+            priv->ethtool_prev_duplex = link_duplex;
+        }
+        priv->ethtool_prev_set = TRUE;
     }
 
     if (!nm_platform_ethtool_set_link_settings(nm_device_get_platform(device),
diff --git a/src/core/nm-active-connection.c b/src/core/nm-active-connection.c
index bf2c4a39..40fe3c96 100644
--- a/src/core/nm-active-connection.c
+++ b/src/core/nm-active-connection.c
@@ -678,6 +678,7 @@ nm_active_connection_set_device(NMActiveConnection *self, NMDevice *device)
 {
     NMActiveConnectionPrivate *priv;
     gs_unref_object NMDevice *old_device = NULL;
+    NMMetered                 old_metered, new_metered;
 
     g_return_val_if_fail(NM_IS_ACTIVE_CONNECTION(self), FALSE);
     g_return_val_if_fail(!device || NM_IS_DEVICE(device), FALSE);
@@ -695,6 +696,8 @@ nm_active_connection_set_device(NMActiveConnection *self, NMDevice *device)
           device);
 
     old_device = priv->device ? g_object_ref(priv->device) : NULL;
+
+    old_metered = old_device ? nm_device_get_metered(old_device) : NM_METERED_UNKNOWN;
     _device_cleanup(self);
 
     if (device) {
@@ -730,7 +733,11 @@ nm_active_connection_set_device(NMActiveConnection *self, NMDevice *device)
     }
     _notify(self, PROP_INT_DEVICE);
 
+    new_metered = priv->device ? nm_device_get_metered(priv->device) : NM_METERED_UNKNOWN;
+
     g_signal_emit(self, signals[DEVICE_CHANGED], 0, priv->device, old_device);
+    if (new_metered != old_metered)
+        g_signal_emit(self, signals[DEVICE_METERED_CHANGED], 0, new_metered);
 
     _notify(self, PROP_DEVICES);
 
diff --git a/src/core/nm-ip4-config.c b/src/core/nm-ip4-config.c
index 90531d02..52a8faa7 100644
--- a/src/core/nm-ip4-config.c
+++ b/src/core/nm-ip4-config.c
@@ -543,7 +543,7 @@ nm_ip4_config_capture(NMDedupMultiIndex *multi_idx, NMPlatform *platform, int if
 
     head_entry = nm_platform_lookup_object(platform, NMP_OBJECT_TYPE_IP4_ADDRESS, ifindex);
     if (head_entry) {
-        nmp_cache_iter_for_each_reverse (&iter, head_entry, &plobj) {
+        nmp_cache_iter_for_each (&iter, head_entry, &plobj) {
             if (!_nm_ip_config_add_obj(priv->multi_idx,
                                        &priv->idx_ip4_addresses_,
                                        ifindex,
diff --git a/src/core/settings/nm-settings-connection.c b/src/core/settings/nm-settings-connection.c
index 36ef6acb..b423bf5b 100644
--- a/src/core/settings/nm-settings-connection.c
+++ b/src/core/settings/nm-settings-connection.c
@@ -2379,11 +2379,11 @@ _nm_settings_connection_register_kf_dbs(NMSettingsConnection *self,
                 priv->seen_bssids_hash = _seen_bssids_hash_new();
 
             entry = _seen_bssid_entry_new_stale_bin(&addr_bin);
+            c_list_link_tail(&priv->seen_bssids_lst_head, &entry->seen_bssids_lst);
             if (!g_hash_table_insert(priv->seen_bssids_hash, entry, entry)) {
                 /* duplicate detected! The @entry key was freed by g_hash_table_insert(). */
                 continue;
             }
-            c_list_link_tail(&priv->seen_bssids_lst_head, &entry->seen_bssids_lst);
             result_len++;
         }
         if (result_len > 0) {