]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Filter global events based on wiphy
authorSriram R <srirrama@qti.qualcomm.com>
Mon, 20 Nov 2017 12:48:41 +0000 (18:18 +0530)
committerJouni Malinen <j@w1.fi>
Sun, 26 Nov 2017 10:42:56 +0000 (12:42 +0200)
Avoid same interface processing nl80211 events when at least one of
IFIDX, WDEV, or WIPHY index attribute is available in the nl80211 event
message.

Previously, a same interface processes events when ifidx and wdev id
attribute were not available in the nl80211 message. This is extended to
check the presence of wiphy index attribute as well since some radar
notifications include only WIPHY index attrbute in the nl80211 message.

Signed-off-by: Sriram R <srirrama@qti.qualcomm.com>
src/drivers/driver_nl80211_event.c

index e6bc2548dc4d854c7bc3d7074b0a8816aaef177b..14a6d92e37a33b51f69baa0080b4e4f151cc2294 100644 (file)
@@ -2387,10 +2387,11 @@ int process_global_event(struct nl_msg *msg, void *arg)
        struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
        struct nlattr *tb[NL80211_ATTR_MAX + 1];
        struct wpa_driver_nl80211_data *drv, *tmp;
-       int ifidx = -1;
+       int ifidx = -1, wiphy_idx = -1, wiphy_idx_rx = -1;
        struct i802_bss *bss;
        u64 wdev_id = 0;
        int wdev_id_set = 0;
+       int wiphy_idx_set = 0;
 
        nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
                  genlmsg_attrlen(gnlh, 0), NULL);
@@ -2400,13 +2401,19 @@ int process_global_event(struct nl_msg *msg, void *arg)
        else if (tb[NL80211_ATTR_WDEV]) {
                wdev_id = nla_get_u64(tb[NL80211_ATTR_WDEV]);
                wdev_id_set = 1;
+       } else if (tb[NL80211_ATTR_WIPHY]) {
+               wiphy_idx_rx = nla_get_u32(tb[NL80211_ATTR_WIPHY]);
+               wiphy_idx_set = 1;
        }
 
        dl_list_for_each_safe(drv, tmp, &global->interfaces,
                              struct wpa_driver_nl80211_data, list) {
                for (bss = drv->first_bss; bss; bss = bss->next) {
-                       if ((ifidx == -1 && !wdev_id_set) ||
+                       if (wiphy_idx_set)
+                               wiphy_idx = nl80211_get_wiphy_index(bss);
+                       if ((ifidx == -1 && !wiphy_idx_set && !wdev_id_set) ||
                            ifidx == bss->ifindex ||
+                           (wiphy_idx_set && wiphy_idx == wiphy_idx_rx) ||
                            (wdev_id_set && bss->wdev_id_set &&
                             wdev_id == bss->wdev_id)) {
                                do_process_drv_event(bss, gnlh->cmd, tb);