]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
wifi-util: do not ignore wifi iftype when SSID is not set 18204/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 11 Jan 2021 14:36:42 +0000 (23:36 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 11 Jan 2021 16:12:37 +0000 (01:12 +0900)
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

index c83e817dbc96666ce96ea2f0b5d09ad29650f458..2ac8846004335ed2e2e0474a8bcc9c0a2f37bbbf 100644 (file)
@@ -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)