3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

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.
This commit is contained in:
James Prestwood 2021-01-29 09:28:18 -08:00 committed by Denis Kenzior
parent 7429b2162d
commit 32028f6daf

View File

@ -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;
}
}