[PATCH mac80211] cfg80211: fix channel configuration in IBSS join

Kalle Valo kvalo at qca.qualcomm.com
Tue Jan 28 05:13:22 EST 2014


Antonio Quartulli <antonio at meshcoding.com> writes:

> From: Antonio Quartulli <antonio at open-mesh.com>
>
> When receiving an IBSS_JOINED event select the BSS object
> based on the {bssid, channel} couple rather than the bssid
> only.
>
> With the current approach if another cell having the same
> BSSID (but using a different channel) exists then cfg80211
> picks up the wrong BSS object.
> The result is a mismatching channel configuration between
> cfg80211 and the driver, that can lead to any sort of
> problem.
>
> The issue can be triggered by having an IBSS sitting on
> given channel and then asking the driver to create a new
> cell using the same BSSID but with a different frequency.
>
> By passing the channel to cfg80211_get_bss() we can solve
> this ambiguity and retrieve/create the correct BSS object.
>
> All the users of cfg80211_ibss_joined() have been changed
> accordingly.
>
> Cc: Kalle Valo <kvalo at qca.qualcomm.com>
> Cc: Arend van Spriel <arend at broadcom.com>
> Cc: Bing Zhao <bzhao at marvell.com>
> Cc: Jussi Kivilinna <jussi.kivilinna at iki.fi>
> Cc: libertas-dev at lists.infradead.org
> Signed-off-by: Antonio Quartulli <antonio at meshcoding.com>

[...]

> --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
> +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
> @@ -790,7 +790,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
>  	if (nw_type & ADHOC_NETWORK) {
>  		ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "ad-hoc %s selected\n",
>  			   nw_type & ADHOC_CREATOR ? "creator" : "joiner");
> -		cfg80211_ibss_joined(vif->ndev, bssid, GFP_KERNEL);
> +		cfg80211_ibss_joined(vif->ndev, bssid, chan, GFP_KERNEL);
>  		cfg80211_put_bss(ar->wiphy, bss);
>  		return;
>  	}
> @@ -867,7 +867,7 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason,
>  			return;
>  		}
>  		memset(bssid, 0, ETH_ALEN);
> -		cfg80211_ibss_joined(vif->ndev, bssid, GFP_KERNEL);
> +		cfg80211_ibss_joined(vif->ndev, bssid, NULL, GFP_KERNEL);
>  		return;
>  	}

For the ath6kl part:

Acked-by: Kalle Valo <kvalo at qca.qualcomm.com>

> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -3895,6 +3895,7 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
>   *
>   * @dev: network device
>   * @bssid: the BSSID of the IBSS joined
> + * @channel: the channel of the IBSS joined
>   * @gfp: allocation flags
>   *
>   * This function notifies cfg80211 that the device joined an IBSS or
> @@ -3904,7 +3905,8 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
>   * with the locally generated beacon -- this guarantees that there is
>   * always a scan result for this IBSS. cfg80211 will handle the rest.
>   */
> -void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
> +void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
> +			  struct ieee80211_channel *channel, gfp_t gfp);

It would be good to document what happens when channel is NULL (which
apparently is allowed). That's not obvious to me.

-- 
Kalle Valo



More information about the libertas-dev mailing list