Re: [PATCH V3 2/9] mac80211: add multiple bssid support to interface handling

Johannes Berg
2020-08-27T13:08:42Z

> + struct {
> + struct ieee80211_vif *parent;
> + struct list_head list;
> + bool non_transmitted;
> + } multiple_bssid;

Oh, and also - surely parent isn't set for the transmitted BSSID, so the
bool non_transmitted is redundant? It's basically the same as !!parent?

Which also applies at the cfg80211 level.

> +static int ieee80211_set_multiple_bssid_options(struct ieee80211_sub_if_data *sdata,
> + struct vif_params *params)
> +{
> + struct ieee80211_local *local = sdata->local;
> + struct wiphy *wiphy = local->hw.wiphy;
> + struct net_device *parent;
> + struct ieee80211_sub_if_data *psdata;
> +
> + if (!ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID_AP))
> + return 0;

That was probably meant to be an error? Otherwise the function can be
void.

> +++ b/net/mac80211/iface.c
> @@ -810,6 +810,13 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
> bool cancel_scan;
> struct cfg80211_nan_func *func;
>
> + if (sdata->vif.type == NL80211_IFTYPE_AP &&
> + sdata->vif.multiple_bssid.non_transmitted)
> + /* make sure the parent is already down */
> + if (sdata->vif.multiple_bssid.parent &&
> + ieee80211_sdata_running(vif_to_sdata(sdata->vif.multiple_bssid.parent)))
> + dev_close(vif_to_sdata(sdata->vif.multiple_bssid.parent)->wdev.netdev);
> +
>

This is nice but somewhere you also need to actually NULL the pointer.
As it is now, it seems you could set up two interfaces, say

wlan_nontx
wlan_tx

then ifup both, then delete wlan_tx (forcing wlan_nontx down) and then
set wlan_nontx back up and back down or whatever, but the parent pointer
wasn't cleared so ... bad things will happen?

Maybe this stuff could even happen at the cfg80211 level? Might be
useful for others too.

johannes