Search Linux Wireless

[PATCH 3/3] mac80211: remove BSS from cfg80211 list when leaving IBSS

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

 



Remove BSS from cfg80211 BSS list if we are only member in IBSS when
leaving it.

Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@xxxxxxxxx>
---
 net/mac80211/ibss.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index ff91265..6d5489b 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -969,6 +969,39 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
 {
 	struct sk_buff *skb;
 
+	struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
+	struct ieee80211_local *local = sdata->local;
+	struct cfg80211_bss *cbss;
+	struct ieee80211_channel *chan = NULL;
+	const u8 *bssid = NULL;
+	u16 capability;
+	int active_ibss = 0;
+
+
+	active_ibss = ieee80211_sta_active_ibss(sdata);
+
+	if (!active_ibss) {
+		capability = WLAN_CAPABILITY_IBSS;
+		if (ifibss->privacy)
+			capability |= WLAN_CAPABILITY_PRIVACY;
+		if (ifibss->fixed_bssid)
+			bssid = ifibss->bssid;
+		if (ifibss->fixed_channel)
+			chan = ifibss->channel;
+		if (!is_zero_ether_addr(ifibss->bssid))
+			bssid = ifibss->bssid;
+		cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid,
+					ifibss->ssid, ifibss->ssid_len,
+					WLAN_CAPABILITY_IBSS |
+					WLAN_CAPABILITY_PRIVACY,
+					capability);
+
+		if (cbss) {
+			cfg80211_unlink_bss(local->hw.wiphy, cbss);
+			cfg80211_put_bss(cbss);
+		}
+	}
+
 	del_timer_sync(&sdata->u.ibss.timer);
 	clear_bit(IEEE80211_IBSS_REQ_RUN, &sdata->u.ibss.request);
 	cancel_work_sync(&sdata->u.ibss.work);
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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