Skip to contentSkip to conversation

cfg80211: on ibss_joined use the channel to get the proper bss object

PATCH In review Antonio Quartulli 2 participants 7 messages Oct 14, 2013 – Oct 17, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cfg80211: on ibss_joined use the channel to get the proper bss object

From: Antonio Quartulli <[email protected]>

It may be the case that the same IBSS (same bssid and essid) exists on two different channels (i.e. two IBSSes created with different but fixed freq) and therefore the latter must be also used to distinguish them.

Fix wdev->current_bss assignment by passing the channel to cfg80211_get_bss() on ibss_joined.
This ensures that cfg80211_get_bss() picks up the proper bss object.

---
 net/wireless/ibss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/ibss.c +1 -1
index 403fe29..12c878b 100644
@@ -28,7 +28,7 @@ void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid)
 	if (!wdev->ssid_len)
 		return;
 
-	bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid,
+	bss = cfg80211_get_bss(wdev->wiphy, wdev->channel, bssid,
 			       wdev->ssid, wdev->ssid_len,
 			       WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
 
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 2/2 mac80211: store the channel in wdev upon ibss_join

From: Antonio Quartulli <[email protected]>

To allow cfg80211 to use the real channel to pick up the proper (i)bss object, store the used channel in wdev->channel during ibss_join

---
 net/mac80211/ibss.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/mac80211/ibss.c +6 -0
index a12afe7..2b5aa4b 100644
@@ -331,6 +331,12 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
 	bss = cfg80211_inform_bss_width_frame(local->hw.wiphy, chan,
 					      scan_width, mgmt,
 					      presp->head_len, 0, GFP_KERNEL);
+
+	/* store the channel so that it can be used by cfg80211 to retrieve the
+	 * correct bss object
+	 */
+	sdata->wdev.channel = chan;
+
 	cfg80211_put_bss(local->hw.wiphy, bss);
 	netif_carrier_on(sdata->dev);
 	cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL);
Signature · 1 line
1.8.3.2
maintainer
#2 lore raw

Re: [PATCH 2/2] mac80211: store the channel in wdev upon ibss_join

Quoted 5 lines · Antonio Quartulli

From: Antonio Quartulli <[email protected]>

To allow cfg80211 to use the real channel to pick up the proper (i)bss object, store the used channel in wdev->channel during ibss_join

WTF? No, mac80211 can't just randomly modify cfg80211-owned data.

johannes

#3 lore raw

Re: [PATCH 2/2] mac80211: store the channel in wdev upon ibss_join

Quoted 8 lines · Johannes Berg
Quoted 5 lines · Antonio Quartulli

From: Antonio Quartulli <[email protected]>

To allow cfg80211 to use the real channel to pick up the proper (i)bss object, store the used channel in wdev->channel during ibss_join

WTF? No, mac80211 can't just randomly modify cfg80211-owned data.

Mh, ok. :)

What about setting wdev->channel in __cfg80211_join_ibss() right after having set wdev->ssid ?
This way we leave mac80211 out and we totally handle this thing in cfg80211 only.

(I think with this change patch 1/2 makes more sense?)

Signature · 1 line
Antonio Quartulli
maintainer
#4 lore raw

Re: [PATCH 2/2] mac80211: store the channel in wdev upon ibss_join

Quoted 8 lines · Antonio Quartulli
Quoted 7 lines · Johannes Berg
Quoted 5 lines · Antonio Quartulli

From: Antonio Quartulli <[email protected]>

To allow cfg80211 to use the real channel to pick up the proper (i)bss object, store the used channel in wdev->channel during ibss_join

Quoted 8 lines
Quoted 1 line

WTF? No, mac80211 can't just randomly modify cfg80211-owned data.

Mh, ok. :)

What about setting wdev->channel in __cfg80211_join_ibss() right after having set wdev->ssid ?
This way we leave mac80211 out and we totally handle this thing in cfg80211 only.

Locking might be problematic though. I also don't know where else the channel might be used?

johannes

#5 lore raw

Re: [PATCH 2/2] mac80211: store the channel in wdev upon ibss_join

Quoted 13 lines · Johannes Berg
Quoted 12 lines · Antonio Quartulli
Quoted 8 lines · Johannes Berg
Quoted 5 lines · Antonio Quartulli

From: Antonio Quartulli <[email protected]>

To allow cfg80211 to use the real channel to pick up the proper (i)bss object, store the used channel in wdev->channel during ibss_join

WTF? No, mac80211 can't just randomly modify cfg80211-owned data.

Mh, ok. :)

Quoted 7 lines
Quoted 4 lines

What about setting wdev->channel in __cfg80211_join_ibss() right after having set wdev->ssid ?
This way we leave mac80211 out and we totally handle this thing in cfg80211 only.

Locking might be problematic though. I also don't know where else the channel might be used?

I don't think it is used elsewhere in IBSS mode

Signature · 1 line
Antonio Quartulli
maintainer
#6 lore raw
In reply to Antonio Quartulli
Quoted 11 lines · Antonio Quartulli

From: Antonio Quartulli <[email protected]>

It may be the case that the same IBSS (same bssid and essid) exists on two different channels (i.e. two IBSSes created with different but fixed freq) and therefore the latter must be also used to distinguish them.

Fix wdev->current_bss assignment by passing the channel to cfg80211_get_bss() on ibss_joined.
This ensures that cfg80211_get_bss() picks up the proper bss object.

This makes no sense, wdev->channel should always be NULL (unless the same wdev was in AP or mesh mode first and that somehow leaked out?)

johannes