diff options
| author | Michael Biebl <biebl@debian.org> | 2022-08-16 18:25:29 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-08-16 18:25:29 +0200 |
| commit | e8c0c4050b07c08cc0f34d41cdff98f2cdc1cc93 (patch) | |
| tree | 79a3d9572e508d4b193ea175c8ed103b2024f727 /src/libnm-platform/wifi | |
| parent | 49ac65f875a36d7ebcbc8270cf0fc60acbb2e052 (diff) | |
| parent | 0018d1f3cf71d680d7b6bceda55a5717244d8b26 (diff) | |
Update upstream source from tag 'upstream/1.39.90'
Update to upstream version '1.39.90' with Debian dir 898f1bfdb7bf17595463e4195c78d8455df545e6
Diffstat (limited to 'src/libnm-platform/wifi')
| -rw-r--r-- | src/libnm-platform/wifi/nm-wifi-utils-nl80211.c | 45 | ||||
| -rw-r--r-- | src/libnm-platform/wifi/nm-wifi-utils-nl80211.h | 2 | ||||
| -rw-r--r-- | src/libnm-platform/wifi/nm-wifi-utils.c | 6 | ||||
| -rw-r--r-- | src/libnm-platform/wifi/nm-wifi-utils.h | 5 |
4 files changed, 27 insertions, 31 deletions
diff --git a/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c b/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c index 475b8a39..37edd928 100644 --- a/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c +++ b/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c @@ -9,14 +9,13 @@ #include "nm-wifi-utils-nl80211.h" +#include "libnm-std-aux/nm-linux-compat.h" + #include <sys/ioctl.h> -#include <net/ethernet.h> #include <unistd.h> #include <linux/nl80211.h> #include <linux/if.h> -#include "linux-headers/nl80211-vnd-intel.h" - #include "libnm-log-core/nm-logging.h" #include "libnm-platform/nm-netlink.h" #include "nm-wifi-utils-private.h" @@ -46,9 +45,9 @@ typedef struct { NMWifiUtils parent; struct nl_sock *nl_sock; guint32 *freqs; - int id; int num_freqs; int phy; + guint16 genl_family_id; bool can_wowlan : 1; } NMWifiUtilsNl80211; @@ -59,7 +58,7 @@ typedef struct { G_DEFINE_TYPE(NMWifiUtilsNl80211, nm_wifi_utils_nl80211, NM_TYPE_WIFI_UTILS) static int -ack_handler(struct nl_msg *msg, void *arg) +ack_handler(const struct nl_msg *msg, void *arg) { int *done = arg; *done = 1; @@ -67,7 +66,7 @@ ack_handler(struct nl_msg *msg, void *arg) } static int -finish_handler(struct nl_msg *msg, void *arg) +finish_handler(const struct nl_msg *msg, void *arg) { int *done = arg; *done = 1; @@ -75,7 +74,7 @@ finish_handler(struct nl_msg *msg, void *arg) } static int -error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg) +error_handler(const struct sockaddr_nl *nla, const struct nlmsgerr *err, void *arg) { int *done = arg; *done = err->error; @@ -83,12 +82,12 @@ error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg) } static struct nl_msg * -_nl80211_alloc_msg(int id, int ifindex, int phy, guint32 cmd, guint32 flags) +_nl80211_alloc_msg(guint16 genl_family_id, int ifindex, int phy, uint8_t cmd, uint16_t flags) { nm_auto_nlmsg struct nl_msg *msg = NULL; msg = nlmsg_alloc(); - genlmsg_put(msg, 0, 0, id, 0, flags, cmd, 0); + genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, genl_family_id, 0, flags, cmd, 0); NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex); if (phy != -1) NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, phy); @@ -99,15 +98,15 @@ nla_put_failure: } static struct nl_msg * -nl80211_alloc_msg(NMWifiUtilsNl80211 *self, guint32 cmd, guint32 flags) +nl80211_alloc_msg(NMWifiUtilsNl80211 *self, uint8_t cmd, uint16_t flags) { - return _nl80211_alloc_msg(self->id, self->parent.ifindex, self->phy, cmd, flags); + return _nl80211_alloc_msg(self->genl_family_id, self->parent.ifindex, self->phy, cmd, flags); } static int nl80211_send_and_recv(NMWifiUtilsNl80211 *self, struct nl_msg *msg, - int (*valid_handler)(struct nl_msg *, void *), + int (*valid_handler)(const struct nl_msg *, void *), void *valid_data) { int err; @@ -168,7 +167,7 @@ struct nl80211_iface_info { }; static int -nl80211_iface_info_handler(struct nl_msg *msg, void *arg) +nl80211_iface_info_handler(const struct nl_msg *msg, void *arg) { struct nl80211_iface_info *info = arg; struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); @@ -270,7 +269,7 @@ nla_put_failure: } static int -nl80211_get_wake_on_wlan_handler(struct nl_msg *msg, void *arg) +nl80211_get_wake_on_wlan_handler(const struct nl_msg *msg, void *arg) { _NMSettingWirelessWakeOnWLan *wowl = arg; struct nlattr *attrs[NL80211_ATTR_MAX + 1]; @@ -423,7 +422,7 @@ struct nl80211_station_info { }; static int -nl80211_station_dump_handler(struct nl_msg *msg, void *arg) +nl80211_station_dump_handler(const struct nl_msg *msg, void *arg) { static const struct nla_policy stats_policy[] = { [NL80211_STA_INFO_INACTIVE_TIME] = {.type = NLA_U32}, @@ -577,7 +576,7 @@ struct nl80211_device_info { #define WLAN_CIPHER_SUITE_SMS4 0x00147201 static int -nl80211_wiphy_info_handler(struct nl_msg *msg, void *arg) +nl80211_wiphy_info_handler(const struct nl_msg *msg, void *arg) { static const struct nla_policy freq_policy[] = { [NL80211_FREQUENCY_ATTR_FREQ] = {.type = NLA_U32}, @@ -817,7 +816,7 @@ struct nl80211_csme_conn_info { }; static int -nl80211_csme_conn_event_handler(struct nl_msg *msg, void *arg) +nl80211_csme_conn_event_handler(const struct nl_msg *msg, void *arg) { struct nl80211_csme_conn_info *info = arg; NMPlatformCsmeConnInfo *out_conn_info = info->conn_info; @@ -945,7 +944,7 @@ nm_wifi_utils_nl80211_class_init(NMWifiUtilsNl80211Class *klass) } NMWifiUtils * -nm_wifi_utils_nl80211_new(int ifindex, struct nl_sock *genl) +nm_wifi_utils_nl80211_new(struct nl_sock *genl, guint16 genl_family_id, int ifindex) { gs_unref_object NMWifiUtilsNl80211 *self = NULL; nm_auto_nlmsg struct nl_msg *msg = NULL; @@ -954,16 +953,14 @@ nm_wifi_utils_nl80211_new(int ifindex, struct nl_sock *genl) if (!genl) return NULL; + if (genl_family_id == 0) + return NULL; + self = g_object_new(NM_TYPE_WIFI_UTILS_NL80211, NULL); self->parent.ifindex = ifindex; self->nl_sock = genl; - - self->id = genl_ctrl_resolve(self->nl_sock, "nl80211"); - if (self->id < 0) { - _LOGD("genl_ctrl_resolve: failed to resolve \"nl80211\""); - return NULL; - } + self->genl_family_id = genl_family_id; self->phy = -1; diff --git a/src/libnm-platform/wifi/nm-wifi-utils-nl80211.h b/src/libnm-platform/wifi/nm-wifi-utils-nl80211.h index 4a633307..4783c572 100644 --- a/src/libnm-platform/wifi/nm-wifi-utils-nl80211.h +++ b/src/libnm-platform/wifi/nm-wifi-utils-nl80211.h @@ -24,6 +24,6 @@ GType nm_wifi_utils_nl80211_get_type(void); -NMWifiUtils *nm_wifi_utils_nl80211_new(int ifindex, struct nl_sock *genl); +NMWifiUtils *nm_wifi_utils_nl80211_new(struct nl_sock *genl, guint16 genl_family_id, int ifindex); #endif /* __WIFI_UTILS_NL80211_H__ */ diff --git a/src/libnm-platform/wifi/nm-wifi-utils.c b/src/libnm-platform/wifi/nm-wifi-utils.c index 08a8ec4f..0238b74a 100644 --- a/src/libnm-platform/wifi/nm-wifi-utils.c +++ b/src/libnm-platform/wifi/nm-wifi-utils.c @@ -32,16 +32,16 @@ nm_wifi_utils_class_init(NMWifiUtilsClass *klass) {} NMWifiUtils * -nm_wifi_utils_new(int ifindex, struct nl_sock *genl, gboolean check_scan) +nm_wifi_utils_new(struct nl_sock *genl, guint16 genl_family_id, int ifindex, gboolean check_scan) { NMWifiUtils *ret; g_return_val_if_fail(ifindex > 0, NULL); - ret = nm_wifi_utils_nl80211_new(ifindex, genl); + ret = nm_wifi_utils_nl80211_new(genl, genl_family_id, ifindex); #if HAVE_WEXT - if (ret == NULL) + if (!ret) ret = nm_wifi_utils_wext_new(ifindex, check_scan); #endif diff --git a/src/libnm-platform/wifi/nm-wifi-utils.h b/src/libnm-platform/wifi/nm-wifi-utils.h index 0d30c1a1..fd636418 100644 --- a/src/libnm-platform/wifi/nm-wifi-utils.h +++ b/src/libnm-platform/wifi/nm-wifi-utils.h @@ -7,8 +7,6 @@ #ifndef __WIFI_UTILS_H__ #define __WIFI_UTILS_H__ -#include <net/ethernet.h> - #include "libnm-platform/nm-netlink.h" #include "libnm-base/nm-base.h" @@ -27,7 +25,8 @@ GType nm_wifi_utils_get_type(void); gboolean nm_wifi_utils_is_wifi(int dirfd, const char *ifname); -NMWifiUtils *nm_wifi_utils_new(int ifindex, struct nl_sock *genl, gboolean check_scan); +NMWifiUtils * +nm_wifi_utils_new(struct nl_sock *genl, guint16 genl_family_id, int ifindex, gboolean check_scan); _NMDeviceWifiCapabilities nm_wifi_utils_get_caps(NMWifiUtils *data); |