diff options
| author | Michael Biebl <biebl@debian.org> | 2023-03-09 19:07:28 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2023-03-09 19:07:28 +0100 |
| commit | 0829d7c18b0c99511de316ce551ed1930a400ca6 (patch) | |
| tree | 3822530717417783d3d6ba9fb08309ed55982a32 /src/libnm-platform/nm-linux-platform.c | |
| parent | 22d6ee88e62404d127054bfee20c28da1ee324ce (diff) | |
| parent | dfaaf221cfee4ffcc507d793dae051d402646679 (diff) | |
Update upstream source from tag 'upstream/1.42.4'
Update to upstream version '1.42.4' with Debian dir 0dae05faaf02396619ae5080a3de6ac980b94990
Diffstat (limited to 'src/libnm-platform/nm-linux-platform.c')
| -rw-r--r-- | src/libnm-platform/nm-linux-platform.c | 37 |
1 files changed, 23 insertions, 14 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, |