From d1bb7aeda4c374a856cf4b1b0564ba7d249a7401 Mon Sep 17 00:00:00 2001 From: Jithu Jance Date: Tue, 17 Jun 2014 00:40:55 +0300 Subject: [PATCH] nl80211: Fix non-hostapd interface addition to not call add_ifidx() Commit b36935be1a14341771b0fd5491808c3f6fdcb603 ('nl80211: Fix EAPOL frames not being delivered') and commit 147848ec4d26613d5a117d4b35dbc7ff98dd65d1 ('nl80211: Do not add all virtual interfaces to drv->if_indices') were not fully in sync and it was possible for some non-hostapd use cases to end up adding undesired ifindexes into the list of interfaces from which events and EAPOL frames are processed on the parent interface. This could result, e.g., in P2P Device management interface on getting unexpected events, including RTM_NEWLINK event that could end up getting interpreted as an indication of the interface being down and unavailable. Make both add_ifidx() calls use the same criteria for adding interfaces to the local list. This is not really a complete solution, but it is good enough for now to fix the most visible side effects of this issue. Signed-off-by: Jithu Jance --- src/drivers/driver_nl80211.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 756865387..aa2cd04af 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -10177,7 +10177,15 @@ 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) + /* + * Some virtual interfaces need to process EAPOL packets and events on + * the parent interface. This is used mainly with hostapd. + */ + if (ifidx > 0 && + (drv->hostapd || + nlmode == NL80211_IFTYPE_AP_VLAN || + nlmode == NL80211_IFTYPE_WDS || + nlmode == NL80211_IFTYPE_MONITOR)) add_ifidx(drv, ifidx); return 0;