hostapd: Fix eapol packet drop in bridged mode
When AP interface needs to do scan for some reason, for instance: HT
SCAN for bandwidth check. It needs to configure interface mode to STA.
In bridged mode, the STA interface doesn't allow to link to bridged
interface. In current hostapd design, it will remove bridged link in
temporary. And add it back when scan done. But it doesn't add ifindex
link back between bridged interface and AP interface. It will cause
eapol rx packet drop in hostapd because eapol packet is received from
bridged interface. And eapol rx handling will check if ifindex exist
in current hostapd but it doesn't exist because it was removed when
re-configure mode to STA.
Fix: Add ifindex link back when do reset to AP mode.
Bug: 183577766
Test: Manual Test, client can connect to wpa2 bridged AP.
Change-Id: Ide9e110f1b208e175ccc58f1f23c4b2084e38fa3
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index ba2599e..5d4f71e 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6809,6 +6809,7 @@
{
struct wpa_driver_nl80211_data *drv = bss->drv;
int was_ap = is_ap_interface(drv->nlmode);
+ int br_ifindex;
wpa_driver_nl80211_set_mode(bss, drv->ap_scan_as_station);
if (!was_ap && is_ap_interface(drv->ap_scan_as_station) &&
@@ -6823,6 +6824,8 @@
"nl80211: Failed to add interface %s into bridge %s: %s",
bss->ifname, bss->brname, strerror(errno));
}
+ br_ifindex = if_nametoindex(bss->brname);
+ add_ifidx(drv, br_ifindex, drv->ifindex);
}
drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED;
}