From a66a402da471f6230ab8674fd2c1df6d918773b5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 11 Jan 2021 23:36:42 +0900 Subject: [PATCH] wifi-util: do not ignore wifi iftype when SSID is not set Previously, if an interface does not have SSID, e.g. run in mesh-point type, then the wifi iftype obtained by the netlink call was ignored. Fixes #18059. --- src/shared/wifi-util.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/shared/wifi-util.c b/src/shared/wifi-util.c index c83e817dbc9..2ac88460043 100644 --- a/src/shared/wifi-util.c +++ b/src/shared/wifi-util.c @@ -29,8 +29,10 @@ int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftyp } if (r < 0) return log_debug_errno(r, "Failed to request information about wifi interface %d: %m", ifindex); - if (!reply) + if (!reply) { + log_debug_errno(r, "No reply received to request for information about wifi interface %d, ignoring.", ifindex); goto nodata; + } r = sd_netlink_message_get_errno(reply); if (r < 0) @@ -56,8 +58,8 @@ int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftyp if (ssid) { r = sd_netlink_message_read_string_strdup(reply, NL80211_ATTR_SSID, ssid); if (r == -ENODATA) - goto nodata; - if (r < 0) + *ssid = NULL; + else if (r < 0) return log_debug_errno(r, "Failed to get NL80211_ATTR_SSID attribute: %m"); } @@ -95,8 +97,10 @@ int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid) { r = sd_netlink_call(genl, m, 0, &reply); if (r < 0) return log_debug_errno(r, "Failed to request information about wifi station: %m"); - if (!reply) + if (!reply) { + log_debug_errno(r, "No reply received to request for information about wifi station, ignoring."); goto nodata; + } r = sd_netlink_message_get_errno(reply); if (r < 0)