Bridge interface was not added to ifidx list on non first-bss configuration. This commit adapts solution from first bss where bridge field is handled in i802_init function Issue occured when bridge interface already exist during adding bss. i802_check_bridge covers only scenario when bridge interface does not exist. Signed-off-by: Mateusz Bajorski <mbajorski@xxxxxxxxx> --- src/drivers/driver_nl80211.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 78c0658a0..76b57ba39 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -7912,6 +7912,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type, struct i802_bss *bss = priv; struct wpa_driver_nl80211_data *drv = bss->drv; int ifidx; + int br_ifindex = 0; int added = 1; if (addr) @@ -7998,19 +7999,28 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type, return -1; } - if (bridge && - i802_check_bridge(drv, new_bss, bridge, ifname) < 0) { - wpa_printf(MSG_ERROR, "nl80211: Failed to add the new " - "interface %s to a bridge %s", - ifname, bridge); - if (added) - nl80211_remove_iface(drv, ifidx); - os_free(new_bss); - return -1; + if (bridge) { + br_ifindex = if_nametoindex(bridge); + if (br_ifindex) + add_ifidx(drv, br_ifindex, ifidx); + + if (i802_check_bridge(drv, new_bss, bridge, ifname) < 0) { + wpa_printf(MSG_ERROR, "nl80211: Failed to add the new " + "interface %s to a bridge %s", + ifname, bridge); + if (br_ifindex) + del_ifidx(drv, br_ifindex, ifidx); + if (added) + nl80211_remove_iface(drv, ifidx); + os_free(new_bss); + return -1; + } } if (linux_set_iface_flags(drv->global->ioctl_sock, ifname, 1)) { + if (br_ifindex) + del_ifidx(drv, br_ifindex, ifidx); if (added) nl80211_remove_iface(drv, ifidx); os_free(new_bss); -- 2.36.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap