Re: [PATCH] nl80211: Fix bridge option for non first-bss

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 21, 2022 at 03:01:19PM +0200, Mateusz Bajorski wrote:
> 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.

I was unable to reproduce any visible problem in that type of a
scenario. wpa_driver_nl80211_if_add() did not add the bridge ifindex
with add_ifidx(), but wpa_driver_nl80211_event_rtm_newlink() did this
when processing the RTM_NEWLINK message indicating that the BSS netdev
was added to a bridge.

Is there a sequence where the RTM_NEWLINK mechanism does not address
this? That would seem to require the netdev of the second BSS to already
exist and be in the bridge, but even when trying that kind of a
sequence, I saw the RTM_NEWLINK event taking care of this when hostapd
started operating the interface.

> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> @@ -7998,19 +7999,28 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,

> +		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);

Is that del_ifidx() correct thing to do? What if there had been some
other BSSs that were already in that bridge? Shouldn't they remain
functional even if something goes wrong with this new BSS addition?

>  		if (linux_set_iface_flags(drv->global->ioctl_sock, ifname, 1))
>  		{
> +			if (br_ifindex)
> +				del_ifidx(drv, br_ifindex, ifidx);

Same here..

-- 
Jouni Malinen                                            PGP id EFC895FA

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux