Skip to contentSkip to conversation

mac80211: split IBSS/managed code

PATCH Superseded Johannes Berg 2 participants 8 messages Feb 11, 2009 – Feb 16, 2009 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: split IBSS/managed code

This patch splits out the ibss code and data from managed (station) mode. The reason to do this is to better separate the state machines, and have the code be contained better so it gets easier to determine what exactly a given change will affect, that in turn makes it easier to understand.

This is quite some churn, especially because I split sdata->u.sta into sdata->u.mgd and sdata->u.ibss, but I think it's easier to maintain that way. I've also shuffled around some code -- null function sending is only applicable to managed interfaces so put that into that file, some other functions are needed from various places so put them into util, and also rearranged the prototypes in ieee80211_i.h accordingly.

---
This passed my, fairly rigorous, testing:
* associate to AP
* create IBSS
* create different IBSS
* down
* up
* create another IBSS
* associate to AP
without any trouble. Now even with network manager (after Dan kindly helped me figure out why NM wasn't working in IBSS for me)

It somewhat paves the way to making managed mode entirely optional should that ever be desired. I didn't do it because that would add a lot of #ifdefs especially in the wext code.

 net/mac80211/Makefile         |    1 
 net/mac80211/agg-rx.c         |    6 
 net/mac80211/agg-tx.c         |    5 
 net/mac80211/cfg.c            |   45 -
 net/mac80211/debugfs_netdev.c |   48 -
 net/mac80211/ht.c             |    6 
 net/mac80211/ibss.c           |  883 ++++++++++++++++++++++
 net/mac80211/ieee80211_i.h    |  111 +-
 net/mac80211/iface.c          |   76 +
 net/mac80211/key.c            |    2 
 net/mac80211/main.c           |    9 
 net/mac80211/mlme.c           | 1642 ++++++++++--------------------------------
 net/mac80211/rx.c             |   37 
 net/mac80211/scan.c           |   43 -
 net/mac80211/spectmgmt.c      |   26 
 net/mac80211/tx.c             |   11 
 net/mac80211/util.c           |  176 ++++
 net/mac80211/wext.c           |  141 ++-
 18 files changed, 1790 insertions(+), 1478 deletions(-)
net/mac80211/Makefile +1 -0
@@ -9,6 +9,7 @@ mac80211-y := \
 	wpa.o \
 	scan.o \
 	ht.o agg-tx.o agg-rx.o \
+	ibss.o \
 	mlme.o \
 	iface.o \
 	rate.o \
net/mac80211/ibss.c new file +883 -0

883 lines not on this page · raw message

net/mac80211/ieee80211_i.h +78 -33

179 lines not on this page · raw message

net/mac80211/main.c +5 -4
@@ -169,9 +169,10 @@ int ieee80211_if_config(struct ieee80211
 
 	memset(&conf, 0, sizeof(conf));
 
-	if (sdata->vif.type == NL80211_IFTYPE_STATION ||
-	    sdata->vif.type == NL80211_IFTYPE_ADHOC)
-		conf.bssid = sdata->u.sta.bssid;
+	if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		conf.bssid = sdata->u.mgd.bssid;
+	else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
+		conf.bssid = sdata->u.ibss.bssid;
 	else if (sdata->vif.type == NL80211_IFTYPE_AP)
 		conf.bssid = sdata->dev->dev_addr;
 	else if (ieee80211_vif_is_mesh(&sdata->vif)) {
@@ -210,7 +211,7 @@ int ieee80211_if_config(struct ieee80211
 					!!rcu_dereference(sdata->u.ap.beacon);
 				break;
 			case NL80211_IFTYPE_ADHOC:
-				conf.enable_beacon = !!sdata->u.sta.probe_resp;
+				conf.enable_beacon = !!sdata->u.ibss.probe_resp;
 				break;
 			case NL80211_IFTYPE_MESH_POINT:
 				conf.enable_beacon = true;
net/mac80211/tx.c +5 -6
@@ -1633,7 +1633,7 @@ int ieee80211_subif_start_xmit(struct sk
 	case NL80211_IFTYPE_STATION:
 		fc |= cpu_to_le16(IEEE80211_FCTL_TODS);
 		/* BSSID SA DA */
-		memcpy(hdr.addr1, sdata->u.sta.bssid, ETH_ALEN);
+		memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN);
 		memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
 		memcpy(hdr.addr3, skb->data, ETH_ALEN);
 		hdrlen = 24;
@@ -1642,7 +1642,7 @@ int ieee80211_subif_start_xmit(struct sk
 		/* DA SA BSSID */
 		memcpy(hdr.addr1, skb->data, ETH_ALEN);
 		memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
-		memcpy(hdr.addr3, sdata->u.sta.bssid, ETH_ALEN);
+		memcpy(hdr.addr3, sdata->u.ibss.bssid, ETH_ALEN);
 		hdrlen = 24;
 		break;
 	default:
@@ -1928,7 +1928,6 @@ struct sk_buff *ieee80211_beacon_get(str
 	struct ieee80211_tx_info *info;
 	struct ieee80211_sub_if_data *sdata = NULL;
 	struct ieee80211_if_ap *ap = NULL;
-	struct ieee80211_if_sta *ifsta = NULL;
 	struct beacon_data *beacon;
 	struct ieee80211_supported_band *sband;
 	enum ieee80211_band band = local->hw.conf.channel->band;
@@ -1980,13 +1979,13 @@ struct sk_buff *ieee80211_beacon_get(str
 		} else
 			goto out;
 	} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
+		struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
 		struct ieee80211_hdr *hdr;
-		ifsta = &sdata->u.sta;
 
-		if (!ifsta->probe_resp)
+		if (!ifibss->probe_resp)
 			goto out;
 
-		skb = skb_copy(ifsta->probe_resp, GFP_ATOMIC);
+		skb = skb_copy(ifibss->probe_resp, GFP_ATOMIC);
 		if (!skb)
 			goto out;
 
net/mac80211/wext.c +80 -61

294 lines not on this page · raw message

net/mac80211/agg-rx.c +3 -3
@@ -129,7 +129,6 @@ static void ieee80211_send_addba_resp(st
 				      u8 dialog_token, u16 status, u16 policy,
 				      u16 buf_size, u16 timeout)
 {
-	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
 	struct ieee80211_local *local = sdata->local;
 	struct sk_buff *skb;
 	struct ieee80211_mgmt *mgmt;
@@ -151,8 +150,9 @@ static void ieee80211_send_addba_resp(st
 	if (sdata->vif.type == NL80211_IFTYPE_AP ||
 	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
 		memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
-	else
-		memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
+
 	mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 					  IEEE80211_STYPE_ACTION);
 
net/mac80211/agg-tx.c +2 -3
@@ -49,7 +49,6 @@ static void ieee80211_send_addba_request
 					 u16 agg_size, u16 timeout)
 {
 	struct ieee80211_local *local = sdata->local;
-	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
 	struct sk_buff *skb;
 	struct ieee80211_mgmt *mgmt;
 	u16 capab;
@@ -69,8 +68,8 @@ static void ieee80211_send_addba_request
 	if (sdata->vif.type == NL80211_IFTYPE_AP ||
 	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
 		memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
-	else
-		memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
 
 	mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 					  IEEE80211_STYPE_ACTION);
net/mac80211/ht.c +3 -3
@@ -169,7 +169,6 @@ void ieee80211_send_delba(struct ieee802
 			  u16 initiator, u16 reason_code)
 {
 	struct ieee80211_local *local = sdata->local;
-	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
 	struct sk_buff *skb;
 	struct ieee80211_mgmt *mgmt;
 	u16 params;
@@ -190,8 +189,9 @@ void ieee80211_send_delba(struct ieee802
 	if (sdata->vif.type == NL80211_IFTYPE_AP ||
 	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
 		memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
-	else
-		memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
+
 	mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 					  IEEE80211_STYPE_ACTION);
 
net/mac80211/scan.c +7 -36

79 lines not on this page · raw message

net/mac80211/iface.c +44 -32

126 lines not on this page · raw message

net/mac80211/mlme.c +419 -1223

1,319 lines not on this page · raw message

net/mac80211/cfg.c +22 -23

45 lines not on this page · raw message

net/mac80211/debugfs_netdev.c +26 -22

48 lines not on this page · raw message

net/mac80211/key.c +1 -1

Lines of this file are not shown. View the raw message.

net/mac80211/rx.c +22 -15

Lines of this file are not shown. View the raw message.

net/mac80211/spectmgmt.c +13 -13

Lines of this file are not shown. View the raw message.

net/mac80211/util.c +176 -0

176 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw

Hello,

this patch is broken.

* In IBSS beaconing doesn't work.

* If you create a new IBSS network it
scans for other networks to often
3 times a second.

[  844.752425] wlan0: sta_find_ibss (active_ibss=3D0)
[  844.752435]    did not try to join ibss
[  844.752449] wlan0: No active IBSS STAs - trying to scan for other IB=
SS networks with same SSID (merge)
[  846.032344] wlan0: sta_find_ibss (active_ibss=3D0)
[  846.032356]    did not try to join ibss
[  846.051622] wlan0: No active IBSS STAs - trying to scan for other IB=
SS networks with same SSID (merge)
[  847.214000] wlan0: sta_find_ibss (active_ibss=3D0)
[  847.214009]    did not try to join ibss
[  847.214025] wlan0: No active IBSS STAs - trying to scan for other IB=

SS networks with same SSID (merge)

* If you join an existent IBSS it does
the following strange things:

[ 5238.150840] wlan5: expiring inactive STA ffff8800bb800340
[ 5238.150847] phy0: Removed STA ffff8800bb800340
[ 5238.161306] phy0: Destroyed STA ffff8800bb800340
[ 5238.161316] wlan5: No active IBSS STAs - trying to scan for other IB=
SS networks with same SSID (merge)
[ 5238.223183] phy0: Adding new IBSS station ffff8800bb81a04a (dev=3Dwl=
an5)
[ 5238.223205] phy0: Allocated STA ffff8800bb800340
[ 5238.223213] phy0: Inserted STA ffff8800bb800340
[ 5238.855114] wlan5: sta_find_ibss (active_ibss=3D0)
[ 5238.855147]    sta_find_ibss: selected ffff88009942f040 current ffff=
8800bc0219f0
[ 5238.855150]    did not try to join ibss
[ 5238.867113] wlan5: expiring inactive STA ffff8800bb800340
[ 5238.867122] phy0: Removed STA ffff8800bb800340
[ 5238.880673] phy0: Destroyed STA ffff8800bb800340
[ 5238.880684] wlan5: No active IBSS STAs - trying to scan for other IB=
SS networks with same SSID (merge)
[ 5238.943194] phy0: Adding new IBSS station ffff8800bb83a04a (dev=3Dwl=
an5)
[ 5238.943218] phy0: Allocated STA ffff8800bb800340
[ 5238.943226] phy0: Inserted STA ffff8800bb800340
[ 5239.572256] wlan5: sta_find_ibss (active_ibss=3D0)
[ 5239.572282]    sta_find_ibss: selected ffff880099539640 current ffff=
8800bc0219f0
[ 5239.572285]    did not try to join ibss

Regards
Alina

--=20
Psssst! Schon vom neuen GMX MultiMessenger geh=F6rt? Der kann`s mit all=
en: http://www.gmx.net/de/go/multimessenger01
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#2 lore raw
Quoted 5 lines · Alina Friedrichsen

Hello,

this patch is broken.

* In IBSS beaconing doesn't work.

Odd, I'm sure that worked for me. What hw are you using?

Quoted 4 lines

* If you create a new IBSS network it
scans for other networks to often
3 times a second.

Quoted 9 lines
[  844.752425] wlan0: sta_find_ibss (active_ibss=0)
[  844.752435]    did not try to join ibss
[  844.752449] wlan0: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)
[  846.032344] wlan0: sta_find_ibss (active_ibss=0)
[  846.032356]    did not try to join ibss
[  846.051622] wlan0: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)
[  847.214000] wlan0: sta_find_ibss (active_ibss=0)
[  847.214009]    did not try to join ibss
[  847.214025] wlan0: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)

That might've happened here too, but given that I never used ibss usually I didn't realise it was wrong ;)

Quoted 15 lines

* If you join an existent IBSS it does
the following strange things:

[ 5238.150840] wlan5: expiring inactive STA ffff8800bb800340
[ 5238.150847] phy0: Removed STA ffff8800bb800340
[ 5238.161306] phy0: Destroyed STA ffff8800bb800340
[ 5238.161316] wlan5: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)
[ 5238.223183] phy0: Adding new IBSS station ffff8800bb81a04a (dev=wlan5)
[ 5238.223205] phy0: Allocated STA ffff8800bb800340
[ 5238.223213] phy0: Inserted STA ffff8800bb800340
[ 5238.855114] wlan5: sta_find_ibss (active_ibss=0)
[ 5238.855147]    sta_find_ibss: selected ffff88009942f040 current ffff8800bc0219f0
[ 5238.855150]    did not try to join ibss
[ 5238.867113] wlan5: expiring inactive STA ffff8800bb800340
[ 5238.867122] phy0: Removed STA ffff8800bb800340
Quoted 8 lines
[ 5238.880673] phy0: Destroyed STA ffff8800bb800340
[ 5238.880684] wlan5: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)
[ 5238.943194] phy0: Adding new IBSS station ffff8800bb83a04a (dev=wlan5)
[ 5238.943218] phy0: Allocated STA ffff8800bb800340
[ 5238.943226] phy0: Inserted STA ffff8800bb800340
[ 5239.572256] wlan5: sta_find_ibss (active_ibss=0)
[ 5239.572282]    sta_find_ibss: selected ffff880099539640 current ffff8800bc0219f0
[ 5239.572285]    did not try to join ibss

That does look a little strange, even if you disregard the fact that you're using compat without %pM :)

I'll take a look at it and fix it up.

johannes

#3 lore raw

Hello Johannes!

Quoted 3 lines
Quoted 1 line

* In IBSS beaconing doesn't work.

=20
Odd, I'm sure that worked for me. What hw are you using?

I have tested it with ath5k and atk9k. Without this patch (tag: master-= 2009-02-12) beaconing works fine. Have you test it with a passive scann= er like kismet?

Quoted 6 lines
Quoted 3 lines

* If you create a new IBSS network it
scans for other networks to often
3 times a second.

That might've happened here too, but given that I never used ibss usually I didn't realise it was wrong ;)

This is to fast consecutively, so it scans and scans but it is not list= ening on the working channel.

Quoted 4 lines
Quoted 2 lines

* If you join an existent IBSS it does
the following strange things:

That does look a little strange,

The STA information is expired much to fast. This is all the same STA/N= ode in an endless loop.

Quoted 2 lines

even if you disregard the fact that
you're using compat without %pM :)

Why is a strange pointer used to display a MAC address, why not %x:%x:%= x:%x:%x:%x? (?)

Quoted 1 line

I'll take a look at it and fix it up.

Thanks!

Regards
Alina

--=20
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL=20 f=FCr nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=3DOM.AD.PD003K11308T4=
569a
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#4 lore raw
Quoted 6 lines
Quoted 2 lines

Odd, I'm sure that worked for me. What hw are you using?

I have tested it with ath5k and atk9k. Without this patch (tag:
master-2009-02-12) beaconing works fine. Have you test it with a passive scanner like kismet?

No, only tried connecting it to my N810.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

* If you create a new IBSS network it
scans for other networks to often
3 times a second.

That might've happened here too, but given that I never used ibss usually I didn't realise it was wrong ;)

This is to fast consecutively, so it scans and scans but it is not listening on the working channel.

Absolutely.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

* If you join an existent IBSS it does
the following strange things:

That does look a little strange,

The STA information is expired much to fast. This is all the same STA/Node in an endless loop.

Right, probably some assignment missing to the last_update or something.

Quoted 4 lines
Quoted 2 lines

even if you disregard the fact that
you're using compat without %pM :)

Why is a strange pointer used to display a MAC address, why not %x:%x:%x:%x:%x:%x? (?)

Well, you're using compat, and that doesn't know how to do %pM in lib/.

johannes

author maintainer
#5 lore raw

PATCH v2 1/1 mac80211: split IBSS/managed code

In reply to Alina Friedrichsen

This patch splits out the ibss code and data from managed (station) mode. The reason to do this is to better separate the state machines, and have the code be contained better so it gets easier to determine what exactly a given change will affect, that in turn makes it easier to understand.

This is quite some churn, especially because I split sdata->u.sta into sdata->u.mgd and sdata->u.ibss, but I think it's easier to maintain that way. I've also shuffled around some code -- null function sending is only applicable to managed interfaces so put that into that file, some other functions are needed from various places so put them into util, and also rearranged the prototypes in ieee80211_i.h accordingly.

---
v2: fix bug with skb queue vs. internal state machine requests -- the reason
my initial testing worked fine regardless was that I didn't have any AP in the vicinity that would lead to beacon processing all the time. I have not found any indication that there's a problem with beaconing, in fact my N810 joins the IBSS fine when I disable probe responses.

This passed my, fairly rigorous, testing:
* associate to AP
* create IBSS
* create different IBSS
* down
* up
* create another IBSS
* associate to AP
without any trouble.

It somewhat paves the way to making managed mode entirely optional should that ever be desired. I didn't do it because that would add a lot of #ifdefs especially in the wext code.

 net/mac80211/Makefile         |    1 
 net/mac80211/agg-rx.c         |    6 
 net/mac80211/agg-tx.c         |    5 
 net/mac80211/cfg.c            |   45 -
 net/mac80211/debugfs_netdev.c |   48 -
 net/mac80211/ht.c             |    6 
 net/mac80211/ibss.c           |  888 ++++++++++++++++++++++
 net/mac80211/ieee80211_i.h    |  117 ++
 net/mac80211/iface.c          |   76 +
 net/mac80211/key.c            |    2 
 net/mac80211/main.c           |    9 
 net/mac80211/mlme.c           | 1642 ++++++++++--------------------------------
 net/mac80211/rx.c             |   37 
 net/mac80211/scan.c           |   43 -
 net/mac80211/spectmgmt.c      |   26 
 net/mac80211/tx.c             |   11 
 net/mac80211/util.c           |  176 ++++
 net/mac80211/wext.c           |  141 ++-
 18 files changed, 1801 insertions(+), 1478 deletions(-)
net/mac80211/Makefile +1 -0
@@ -9,6 +9,7 @@ mac80211-y := \
 	wpa.o \
 	scan.o \
 	ht.o agg-tx.o agg-rx.o \
+	ibss.o \
 	mlme.o \
 	iface.o \
 	rate.o \
net/mac80211/ibss.c new file +888 -0

888 lines not on this page · raw message

net/mac80211/ieee80211_i.h +84 -33

185 lines not on this page · raw message

net/mac80211/main.c +5 -4
@@ -169,9 +169,10 @@ int ieee80211_if_config(struct ieee80211
 
 	memset(&conf, 0, sizeof(conf));
 
-	if (sdata->vif.type == NL80211_IFTYPE_STATION ||
-	    sdata->vif.type == NL80211_IFTYPE_ADHOC)
-		conf.bssid = sdata->u.sta.bssid;
+	if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		conf.bssid = sdata->u.mgd.bssid;
+	else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
+		conf.bssid = sdata->u.ibss.bssid;
 	else if (sdata->vif.type == NL80211_IFTYPE_AP)
 		conf.bssid = sdata->dev->dev_addr;
 	else if (ieee80211_vif_is_mesh(&sdata->vif)) {
@@ -210,7 +211,7 @@ int ieee80211_if_config(struct ieee80211
 					!!rcu_dereference(sdata->u.ap.beacon);
 				break;
 			case NL80211_IFTYPE_ADHOC:
-				conf.enable_beacon = !!sdata->u.sta.probe_resp;
+				conf.enable_beacon = !!sdata->u.ibss.probe_resp;
 				break;
 			case NL80211_IFTYPE_MESH_POINT:
 				conf.enable_beacon = true;
net/mac80211/tx.c +5 -6
@@ -1633,7 +1633,7 @@ int ieee80211_subif_start_xmit(struct sk
 	case NL80211_IFTYPE_STATION:
 		fc |= cpu_to_le16(IEEE80211_FCTL_TODS);
 		/* BSSID SA DA */
-		memcpy(hdr.addr1, sdata->u.sta.bssid, ETH_ALEN);
+		memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN);
 		memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
 		memcpy(hdr.addr3, skb->data, ETH_ALEN);
 		hdrlen = 24;
@@ -1642,7 +1642,7 @@ int ieee80211_subif_start_xmit(struct sk
 		/* DA SA BSSID */
 		memcpy(hdr.addr1, skb->data, ETH_ALEN);
 		memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
-		memcpy(hdr.addr3, sdata->u.sta.bssid, ETH_ALEN);
+		memcpy(hdr.addr3, sdata->u.ibss.bssid, ETH_ALEN);
 		hdrlen = 24;
 		break;
 	default:
@@ -1928,7 +1928,6 @@ struct sk_buff *ieee80211_beacon_get(str
 	struct ieee80211_tx_info *info;
 	struct ieee80211_sub_if_data *sdata = NULL;
 	struct ieee80211_if_ap *ap = NULL;
-	struct ieee80211_if_sta *ifsta = NULL;
 	struct beacon_data *beacon;
 	struct ieee80211_supported_band *sband;
 	enum ieee80211_band band = local->hw.conf.channel->band;
@@ -1980,13 +1979,13 @@ struct sk_buff *ieee80211_beacon_get(str
 		} else
 			goto out;
 	} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
+		struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
 		struct ieee80211_hdr *hdr;
-		ifsta = &sdata->u.sta;
 
-		if (!ifsta->probe_resp)
+		if (!ifibss->probe_resp)
 			goto out;
 
-		skb = skb_copy(ifsta->probe_resp, GFP_ATOMIC);
+		skb = skb_copy(ifibss->probe_resp, GFP_ATOMIC);
 		if (!skb)
 			goto out;
 
net/mac80211/wext.c +80 -61

294 lines not on this page · raw message

net/mac80211/agg-rx.c +3 -3
@@ -129,7 +129,6 @@ static void ieee80211_send_addba_resp(st
 				      u8 dialog_token, u16 status, u16 policy,
 				      u16 buf_size, u16 timeout)
 {
-	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
 	struct ieee80211_local *local = sdata->local;
 	struct sk_buff *skb;
 	struct ieee80211_mgmt *mgmt;
@@ -151,8 +150,9 @@ static void ieee80211_send_addba_resp(st
 	if (sdata->vif.type == NL80211_IFTYPE_AP ||
 	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
 		memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
-	else
-		memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
+
 	mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 					  IEEE80211_STYPE_ACTION);
 
net/mac80211/agg-tx.c +2 -3
@@ -49,7 +49,6 @@ static void ieee80211_send_addba_request
 					 u16 agg_size, u16 timeout)
 {
 	struct ieee80211_local *local = sdata->local;
-	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
 	struct sk_buff *skb;
 	struct ieee80211_mgmt *mgmt;
 	u16 capab;
@@ -69,8 +68,8 @@ static void ieee80211_send_addba_request
 	if (sdata->vif.type == NL80211_IFTYPE_AP ||
 	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
 		memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
-	else
-		memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
 
 	mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 					  IEEE80211_STYPE_ACTION);
net/mac80211/ht.c +3 -3
@@ -169,7 +169,6 @@ void ieee80211_send_delba(struct ieee802
 			  u16 initiator, u16 reason_code)
 {
 	struct ieee80211_local *local = sdata->local;
-	struct ieee80211_if_sta *ifsta = &sdata->u.sta;
 	struct sk_buff *skb;
 	struct ieee80211_mgmt *mgmt;
 	u16 params;
@@ -190,8 +189,9 @@ void ieee80211_send_delba(struct ieee802
 	if (sdata->vif.type == NL80211_IFTYPE_AP ||
 	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
 		memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
-	else
-		memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
+		memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
+
 	mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 					  IEEE80211_STYPE_ACTION);
 
net/mac80211/scan.c +7 -36

79 lines not on this page · raw message

net/mac80211/iface.c +44 -32

126 lines not on this page · raw message

net/mac80211/mlme.c +419 -1223

1,308 lines not on this page · raw message

net/mac80211/cfg.c +22 -23

45 lines not on this page · raw message

net/mac80211/debugfs_netdev.c +26 -22

48 lines not on this page · raw message

net/mac80211/key.c +1 -1

Lines of this file are not shown. View the raw message.

net/mac80211/rx.c +22 -15

Lines of this file are not shown. View the raw message.

net/mac80211/spectmgmt.c +13 -13

Lines of this file are not shown. View the raw message.

net/mac80211/util.c +176 -0

176 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

author maintainer
#7 lore raw
Quoted 3 lines · Alina Friedrichsen

Hi Johannes,

as far as I have tested it, IBSS works again with this patch. :)

Alina, thanks for confirming!

johannes