diff options
| author | Jouni Malinen <j@w1.fi> | 2014-10-04 16:20:38 +0300 |
|---|---|---|
| committer | Jouni Malinen <j@w1.fi> | 2014-10-04 16:21:03 +0300 |
| commit | 5dfbd725a95d50475c63ab3a2e85031afd68614b (patch) | |
| tree | dca3e9606bce0ba35bf9b6864d74ac5763200eac | |
| parent | f1a613118ed51f3ecbaab8940744f4ff205c2e67 (diff) | |
| download | hostap-5dfbd725a95d50475c63ab3a2e85031afd68614b.tar.gz | |
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>
| -rw-r--r-- | src/drivers/driver_nl80211.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index c212a1969..d962637b8 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -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); |
