summary refs log tree commit diff
path: root/src/libnm-platform
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2023-03-09 19:06:14 +0100
committerMichael Biebl <biebl@debian.org>2023-03-09 19:06:14 +0100
commitdfaaf221cfee4ffcc507d793dae051d402646679 (patch)
treec218fc9b1ef10cfa7d2acf0ce401b6d97db2401f /src/libnm-platform
parentb22a7b55d0bc5a7999dccaeacdde745f5ace9d66 (diff)
New upstream version 1.42.4 upstream/1.42.4
Diffstat (limited to 'src/libnm-platform')
-rw-r--r--src/libnm-platform/nm-linux-platform.c37
-rw-r--r--src/libnm-platform/nm-platform.c2
-rw-r--r--src/libnm-platform/nmp-global-tracker.c2
3 files changed, 25 insertions, 16 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c
index d4ab36f9..30ad1275 100644
--- a/src/libnm-platform/nm-linux-platform.c
+++ b/src/libnm-platform/nm-linux-platform.c
@@ -9213,15 +9213,27 @@ get_ext_data(NMPlatform *platform, int ifindex)
     return obj->_link.ext_data;
 }
 
+#define get_ext_data_check(platform, ifindex, is_check)      \
+    ({                                                       \
+        GObject *_obj = get_ext_data((platform), (ifindex)); \
+                                                             \
+        _obj &&is_check(_obj) ? ((gpointer) _obj) : NULL;    \
+    })
+
 /*****************************************************************************/
 
-#define WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, retval) \
-    nm_auto_pop_netns NMPNetns *netns = NULL;                          \
-    NMWifiUtils                *wifi_data;                             \
-    if (!nm_platform_netns_push(platform, &netns))                     \
-        return retval;                                                 \
-    wifi_data = NM_WIFI_UTILS(get_ext_data(platform, ifindex));        \
-    if (!wifi_data)                                                    \
+#define WIFI_GET_WIFI_DATA(wifi_data, platform, ifindex, retval)                      \
+    NMWifiUtils *wifi_data = get_ext_data_check(platform, ifindex, NM_IS_WIFI_UTILS); \
+    if (!wifi_data)                                                                   \
+        return retval;
+
+#define WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, retval)   \
+    nm_auto_pop_netns NMPNetns *netns = NULL;                            \
+    NMWifiUtils                *wifi_data;                               \
+    if (!nm_platform_netns_push(platform, &netns))                       \
+        return retval;                                                   \
+    wifi_data = get_ext_data_check(platform, ifindex, NM_IS_WIFI_UTILS); \
+    if (!wifi_data)                                                      \
         return retval;
 
 static gboolean
@@ -9390,9 +9402,9 @@ mesh_set_ssid(NMPlatform *platform, int ifindex, const guint8 *ssid, gsize len)
 
 /*****************************************************************************/
 
-#define WPAN_GET_WPAN_DATA(wpan_data, platform, ifindex, retval)             \
-    NMWpanUtils *wpan_data = NM_WPAN_UTILS(get_ext_data(platform, ifindex)); \
-    if (!wpan_data)                                                          \
+#define WPAN_GET_WPAN_DATA(wpan_data, platform, ifindex, retval)                      \
+    NMWpanUtils *wpan_data = get_ext_data_check(platform, ifindex, NM_IS_WPAN_UTILS); \
+    if (!wpan_data)                                                                   \
         return retval;
 
 static guint16
@@ -9444,10 +9456,7 @@ link_get_wake_on_lan(NMPlatform *platform, int ifindex)
     if (type == NM_LINK_TYPE_ETHERNET)
         return nmp_utils_ethtool_get_wake_on_lan(ifindex);
     else if (type == NM_LINK_TYPE_WIFI) {
-        NMWifiUtils *wifi_data = NM_WIFI_UTILS(get_ext_data(platform, ifindex));
-
-        if (!wifi_data)
-            return FALSE;
+        WIFI_GET_WIFI_DATA(wifi_data, platform, ifindex, FALSE);
 
         return !NM_IN_SET(nm_wifi_utils_get_wake_on_wlan(wifi_data),
                           _NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE,
diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c
index c80d9648..2e9e940c 100644
--- a/src/libnm-platform/nm-platform.c
+++ b/src/libnm-platform/nm-platform.c
@@ -7951,6 +7951,7 @@ int
 nm_platform_lnk_bond_cmp(const NMPlatformLnkBond *a, const NMPlatformLnkBond *b)
 {
     NM_CMP_SELF(a, b);
+    NM_CMP_FIELD(a, b, arp_ip_targets_num);
     NM_CMP_FIELD_MEMCMP_LEN(a,
                             b,
                             arp_ip_target,
@@ -7972,7 +7973,6 @@ nm_platform_lnk_bond_cmp(const NMPlatformLnkBond *a, const NMPlatformLnkBond *b)
     NM_CMP_FIELD_MEMCMP(a, b, ad_actor_system);
     NM_CMP_FIELD(a, b, ad_select);
     NM_CMP_FIELD(a, b, all_ports_active);
-    NM_CMP_FIELD(a, b, arp_ip_targets_num);
     NM_CMP_FIELD(a, b, fail_over_mac);
     NM_CMP_FIELD(a, b, lacp_rate);
     NM_CMP_FIELD(a, b, num_grat_arp);
diff --git a/src/libnm-platform/nmp-global-tracker.c b/src/libnm-platform/nmp-global-tracker.c
index 122ba0ea..3fd31e4e 100644
--- a/src/libnm-platform/nmp-global-tracker.c
+++ b/src/libnm-platform/nmp-global-tracker.c
@@ -26,7 +26,7 @@
  * view. That is mainly, because such objects are themselves tied to an ifindex.
  *
  * However, for certain objects that's not the case. For example, policy routing
- * rules, certain route types (blackhole, unavailable, prohibit, throw) and MPTCP
+ * rules, certain route types (blackhole, unreachable, prohibit, throw) and MPTCP
  * endpoints require a holistic view of the system. That is, because rules and
  * these route types have no ifindex. For MPTCP endpoints, they have an ifindex,
  * however we can only configure a small number of them at a time, so we need a