mirror of
https://github.com/systemd/systemd.git
synced 2025-01-06 17:18:12 +03:00
Merge pull request #18204 from yuwata/wifi-util-fix-18059
wifi-util: do not ignore wifi iftype when the interface does not have SSID
This commit is contained in:
commit
e2645ca619
@ -1,12 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <linux/nl80211.h>
|
||||
|
||||
#include "sd-bus.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "netlink-util.h"
|
||||
#include "wifi-util.h"
|
||||
|
||||
int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid) {
|
||||
@ -35,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)
|
||||
@ -62,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");
|
||||
}
|
||||
|
||||
@ -101,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)
|
||||
|
@ -3,8 +3,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <linux/nl80211.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include "netlink-util.h"
|
||||
#include "sd-netlink.h"
|
||||
|
||||
int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid);
|
||||
int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid);
|
||||
|
Loading…
Reference in New Issue
Block a user