nl80211: Add get_bss_ifindex() helper
This can be used to fetch a BSS entry based on interface index. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
f1a613118e
commit
5dfbd725a9
1 changed files with 15 additions and 4 deletions
|
@ -588,6 +588,20 @@ static int is_p2p_net_interface(enum nl80211_iftype nlmode)
|
|||
}
|
||||
|
||||
|
||||
static struct i802_bss * get_bss_ifindex(struct wpa_driver_nl80211_data *drv,
|
||||
int ifindex)
|
||||
{
|
||||
struct i802_bss *bss;
|
||||
|
||||
for (bss = drv->first_bss; bss; bss = bss->next) {
|
||||
if (bss->ifindex == ifindex)
|
||||
return bss;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void nl80211_mark_disconnected(struct wpa_driver_nl80211_data *drv)
|
||||
{
|
||||
if (drv->associated)
|
||||
|
@ -1688,10 +1702,7 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
|
|||
return;
|
||||
|
||||
ifidx = nla_get_u32(ifindex);
|
||||
for (bss = drv->first_bss; bss; bss = bss->next)
|
||||
if (bss->ifindex == ifidx)
|
||||
break;
|
||||
|
||||
bss = get_bss_ifindex(drv, ifidx);
|
||||
if (bss == NULL) {
|
||||
wpa_printf(MSG_WARNING, "nl80211: Unknown ifindex (%d) for channel switch, ignoring",
|
||||
ifidx);
|
||||
|
|
Loading…
Reference in a new issue