From b8ef64f6e3dde5caedb49727ad71235797c3bfd0 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Mon, 19 Apr 2021 16:31:42 -0500 Subject: [PATCH] frame-xchg: iftype changes to be managed by netdev Since netdev now keeps track of iftype changes, let it call frame_watch_wdev_remove on netdevs that it manages to clear frame registrations that should be cleared due to an iftype change. Note that P2P_DEVICE wdevs are not managed by any netdev object, but since their iftype cannot be changed, they should not be affected by this change. --- src/frame-xchg.c | 7 +------ src/netdev.c | 3 +++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/frame-xchg.c b/src/frame-xchg.c index 4a4db561..4ecfc45d 100644 --- a/src/frame-xchg.c +++ b/src/frame-xchg.c @@ -1313,7 +1313,6 @@ static void frame_xchg_config_notify(struct l_genl_msg *msg, void *user_data) if (!wdev) { wdev = l_new(struct wdev_info, 1); wdev->id = wdev_id; - wdev->iftype = iftype; if (!wdevs) wdevs = l_queue_new(); @@ -1322,11 +1321,7 @@ static void frame_xchg_config_notify(struct l_genl_msg *msg, void *user_data) break; } - if (wdev->iftype != iftype) { - wdev->iftype = iftype; - frame_watch_wdev_remove(wdev_id); - } - + wdev->iftype = iftype; break; case NL80211_CMD_DEL_INTERFACE: diff --git a/src/netdev.c b/src/netdev.c index 940e3c4b..eb0e467b 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -4877,8 +4877,10 @@ static void netdev_set_interface_event(struct l_genl_msg *msg, struct netdev *netdev) { uint32_t iftype; + uint64_t wdev_id; if (nl80211_parse_attrs(msg, NL80211_ATTR_IFTYPE, &iftype, + NL80211_ATTR_WDEV, &wdev_id, NL80211_ATTR_UNSPEC) < 0) return; @@ -4889,6 +4891,7 @@ static void netdev_set_interface_event(struct l_genl_msg *msg, netdev_iftype_to_string(netdev->type), netdev_iftype_to_string(iftype)); netdev->type = iftype; + frame_watch_wdev_remove(wdev_id); /* Set RSSI threshold for CQM notifications */ if (netdev->type == NL80211_IFTYPE_STATION)