commit 32028f6daf74096db247a6f4a944a65c0f19d881
parent 7429b2162df1a8d5da40bdff7d955bfaa215a7e7
Author: James Prestwood <prestwoj@gmail.com>
Date: Fri, 29 Jan 2021 09:28:18 -0800
ap: add DEL_STATION path to fullmac AP handling
This is how a fullmac card tells userspace that a station has
left. This fixes the issue where the same client cannot re-connect
to the same AP multiple times. ap_new_station was renamed to
ap_handle_new_station for consistency.
Diffstat:
| M | src/ap.c | | | 44 | ++++++++++++++++++++++++++++++++++++++++++-- |
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/src/ap.c b/src/ap.c
@@ -2238,7 +2238,7 @@ parse_error:
return false;
}
-static void ap_new_station(struct ap_state *ap, struct l_genl_msg *msg)
+static void ap_handle_new_station(struct ap_state *ap, struct l_genl_msg *msg)
{
struct sta_state *sta;
struct l_genl_attr attr;
@@ -2306,6 +2306,43 @@ static void ap_new_station(struct ap_state *ap, struct l_genl_msg *msg)
}
}
+static void ap_handle_del_station(struct ap_state *ap, struct l_genl_msg *msg)
+{
+ struct sta_state *sta;
+ struct l_genl_attr attr;
+ uint16_t type;
+ uint16_t len;
+ const void *data;
+ uint8_t mac[6];
+ uint16_t reason = MMPDU_REASON_CODE_UNSPECIFIED;
+
+ if (!l_genl_attr_init(&attr, msg))
+ return;
+
+ while (l_genl_attr_next(&attr, &type, &len, &data)) {
+ switch (type) {
+ case NL80211_ATTR_MAC:
+ if (len != 6)
+ return;
+
+ memcpy(mac, data, 6);
+ break;
+ case NL80211_ATTR_REASON_CODE:
+ if (len != 2)
+ return;
+
+ reason = l_get_u16(data);
+ }
+ }
+
+ sta = l_queue_find(ap->sta_states, ap_sta_match_addr, mac);
+ if (!sta)
+ return;
+
+ ap_del_station(sta, reason, true);
+ ap_remove_sta(sta);
+}
+
static void ap_mlme_notify(struct l_genl_msg *msg, void *user_data)
{
struct ap_state *ap = user_data;
@@ -2335,7 +2372,10 @@ static void ap_mlme_notify(struct l_genl_msg *msg, void *user_data)
l_free(ap);
break;
case NL80211_CMD_NEW_STATION:
- ap_new_station(ap, msg);
+ ap_handle_new_station(ap, msg);
+ break;
+ case NL80211_CMD_DEL_STATION:
+ ap_handle_del_station(ap, msg);
break;
}
}