[PATCH v2] nl80211: fix EAPOL frames not being delivered
Jouni Malinen
j
Wed Mar 26 07:40:36 PDT 2014
On Wed, Mar 26, 2014 at 08:19:19AM +0100, Maxime Bizon wrote:
> you're right, I misread the first for loop in add_ifidx() and
> thought it was an opencoded has_ifidx() to avoid duplicate entries
>
> what about adding has_ifidx() at the beginning ?
Sounds fine to me.
> wpa_driver_nl80211_if_add() has many error paths, and I did not want
> to add 'if (added) del_ifidx()' everywhere
Well, it would be added == 0 in this case and the added == 1 case needs
to already be covered. Anyway, I see that this would add complexity. I'm
currently considering follow changes. Please note that the if_remove()
case needed to get similar del_ifidx() call to address this special
bss->added_if == 0 case.
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index bc4b7e3..6f3c85d 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -9486,6 +9486,11 @@ static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx)
wpa_printf(MSG_DEBUG, "nl80211: Add own interface ifindex %d",
ifidx);
+ if (have_ifidx(drv, ifidx)) {
+ wpa_printf(MSG_DEBUG, "nl80211: ifindex %d already in the list",
+ ifidx);
+ return;
+ }
for (i = 0; i < drv->num_if_indices; i++) {
if (drv->if_indices[i] == 0) {
drv->if_indices[i] = ifidx;
@@ -9965,6 +9970,9 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
if (drv->global)
drv->global->if_add_ifindex = ifidx;
+ if (ifidx > 0)
+ add_ifidx(drv, ifidx);
+
return 0;
}
@@ -9980,6 +9988,8 @@ static int wpa_driver_nl80211_if_remove(struct i802_bss *bss,
__func__, type, ifname, ifindex, bss->added_if);
if (ifindex > 0 && (bss->added_if || bss->ifindex != ifindex))
nl80211_remove_iface(drv, ifindex);
+ else if (ifindex > 0 && !bss->added_if)
+ del_ifidx(drv, ifindex);
if (type != WPA_IF_AP_BSS)
return 0;
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list