wireless: consolidate on a single escape_essid implementation
PATCH 1/1 wireless: consolidate on a single escape_essid implementation
This is also an excuse to create the long rumored lib80211 module...
---
Wtf...
drivers/net/wireless/Kconfig | 1 + drivers/net/wireless/ipw2200.h | 1 + drivers/net/wireless/iwlwifi/Kconfig | 2 + drivers/net/wireless/iwlwifi/iwl-scan.c | 53 +++--------------------- drivers/net/wireless/iwlwifi/iwl3945-base.c | 48 ++-------------------- drivers/net/wireless/libertas/assoc.c | 2 + drivers/net/wireless/libertas/cmd.c | 1 + drivers/net/wireless/libertas/debugfs.c | 1 + drivers/net/wireless/libertas/decl.h | 4 -- drivers/net/wireless/libertas/main.c | 27 ------------ drivers/net/wireless/libertas/scan.c | 3 + drivers/net/wireless/libertas/wext.c | 1 + include/net/ieee80211.h | 20 --------- include/net/lib80211.h | 31 ++++++++++++++ net/ieee80211/Kconfig | 1 + net/ieee80211/ieee80211_module.c | 26 ------------ net/ieee80211/ieee80211_rx.c | 9 ++-- net/wireless/Kconfig | 10 +++++ net/wireless/Makefile | 1 + net/wireless/lib80211.c | 58 +++++++++++++++++++++++++++ 20 files changed, 128 insertions(+), 172 deletions(-) create mode 100644 include/net/lib80211.h create mode 100644 net/wireless/lib80211.c
drivers/net/wireless/Kconfig +1 -0
@@ -271,6 +271,7 @@ config LIBERTAS tristate "Marvell 8xxx Libertas WLAN driver support" depends on WLAN_80211 select WIRELESS_EXT + select LIB80211 select FW_LOADER ---help--- A library for Marvell Libertas 8xxx devices.
drivers/net/wireless/ipw2200.h +1 -0
@@ -48,6 +48,7 @@#include <linux/jiffies.h> #include <asm/io.h> +#include <net/lib80211.h> #include <net/ieee80211.h> #include <net/ieee80211_radiotap.h>
drivers/net/wireless/iwlwifi/Kconfig +2 -0
@@ -4,6 +4,7 @@ config IWLWIFI config IWLCORE tristate "Intel Wireless Wifi Core" depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL + select LIB80211 select IWLWIFI select MAC80211_LEDS if IWLWIFI_LEDS select LEDS_CLASS if IWLWIFI_LEDS
@@ -105,6 +106,7 @@ config IWL3945 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL select FW_LOADER + select LIB80211 select IWLWIFI select MAC80211_LEDS if IWL3945_LEDS select LEDS_CLASS if IWL3945_LEDS
drivers/net/wireless/iwlwifi/iwl-scan.c +6 -47
78 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl3945-base.c +4 -44
78 lines not on this page · raw message
drivers/net/wireless/libertas/assoc.c +2 -0
@@ -1,6 +1,8 @@/* Copyright (C) 2006, Red Hat, Inc. */ +#include <linux/types.h> #include <linux/etherdevice.h> +#include <net/lib80211.h> #include "assoc.h" #include "decl.h"
drivers/net/wireless/libertas/cmd.c +1 -0
@@ -4,6 +4,7 @@*/ #include <net/iw_handler.h> +#include <net/lib80211.h> #include <net/ieee80211.h> #include <linux/kfifo.h> #include "host.h"
drivers/net/wireless/libertas/debugfs.c +1 -0
@@ -5,6 +5,7 @@#include <linux/mm.h> #include <linux/string.h> #include <net/iw_handler.h> +#include <net/lib80211.h> #include "dev.h" #include "decl.h"
drivers/net/wireless/libertas/decl.h +0 -4
@@ -74,8 +74,4 @@ void lbs_host_to_card_done(struct lbs_private *priv);int lbs_update_channel (struct lbs_private *priv); -#ifndef CONFIG_IEEE80211 -const char *escape_essid (const char *essid,u8 essid_len); -#endif -#endif
drivers/net/wireless/libertas/main.c +0 -27
@@ -1647,33 +1647,6 @@ out:return ret; } -#ifndef CONFIG_IEEE80211 -const char *escape_essid (const char *essid,u8 essid_len) -{ -static char escaped[IW_ESSID_MAX_SIZE *2 +1 ]; -const char *s = essid; -char *d = escaped; - -if (ieee80211_is_empty_essid (essid, essid_len)) { -memcpy (escaped,"<hidden>" ,sizeof ("<hidden>" )); -return escaped; - } - - essid_len =min (essid_len, (u8 )IW_ESSID_MAX_SIZE ); -while (essid_len--) { -if (*s =='\0' ) { - *d++ ='\\' ; - *d++ ='0' ; - s++; - }else { - *d++ = *s++; - } - } - *d ='\0' ; -return escaped; -} -#endif -module_init (lbs_init_module);module_exit (lbs_exit_module);
drivers/net/wireless/libertas/scan.c +3 -0
@@ -4,9 +4,12 @@* IOCTL handlers as well as command preperation and response routines * for sending scan commands to the firmware. */ +#include <linux/types.h> #include <linux/etherdevice.h> #include <asm/unaligned.h> +#include <net/lib80211.h> +#include "host.h" #include "decl.h" #include "dev.h"
drivers/net/wireless/libertas/wext.c +1 -0
@@ -8,6 +8,7 @@#include <linux/wireless.h> #include <linux/bitops.h> +#include <net/lib80211.h> #include <net/ieee80211.h> #include <net/iw_handler.h>
include/net/ieee80211.h +0 -20
@@ -127,10 +127,6 @@ static inline bool ieee80211_ratelimit_debug(u32 level) }#endif /* CONFIG_IEEE80211_DEBUG */ -/* escape_essid() is intended to be used in debug (and possibly error) -* messages. It should never be used for passing essid to user space. */ -const char *escape_essid (const char *essid,u8 essid_len); -/* * To use the debug system: *
@@ -1139,22 +1135,6 @@ static inline void *ieee80211_priv(struct net_device *dev)return ((struct ieee80211_device *)netdev_priv (dev))->priv; } -static inline int ieee80211_is_empty_essid (const char *essid,int essid_len) -{ -/* Single white space is for Linksys APs */ -if (essid_len ==1 && essid[0 ] ==' ' ) -return 1 ; - -/* Otherwise, if the entire essid is 0, we assume it is hidden */ -while (essid_len) { - essid_len--; -if (essid[essid_len] !='\0' ) -return 0 ; - } - -return 1 ; -} -static inline int ieee80211_is_valid_mode (struct ieee80211_device *ieee,int mode) {
include/net/lib80211.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* lib80211.h -- common bits for IEEE802.11 wireless drivers +* +* Copyright (c) 2008, John W. Linville <[email protected]> +* +*/ + +#ifndef LIB80211_H +#define LIB80211_H + +/* escape_essid() is intended to be used in debug (and possibly error) +* messages. It should never be used for passing essid to user space. */ +const char *escape_essid (const char *essid,u8 essid_len); + +static inline int is_empty_essid (const char *essid,int essid_len) +{ +/* Single white space is for Linksys APs */ +if (essid_len ==1 && essid[0 ] ==' ' ) +return 1 ; + +/* Otherwise, if the entire essid is 0, we assume it is hidden */ +while (essid_len) { + essid_len--; +if (essid[essid_len] !='\0' ) +return 0 ; + } + +return 1 ; +} + +#endif /* LIB80211_H */
net/ieee80211/Kconfig +1 -0
@@ -1,5 +1,6 @@ config IEEE80211 tristate "Generic IEEE 802.11 Networking Stack (DEPRECATED)" + select LIB80211 ---help--- This option enables the hardware independent IEEE 802.11 networking stack. This component is deprecated in favor of the
net/ieee80211/ieee80211_module.c +0 -26
@@ -308,31 +308,5 @@ MODULE_PARM_DESC(debug, "debug output mask");module_exit (ieee80211_exit);module_init (ieee80211_init); -const char *escape_essid (const char *essid,u8 essid_len) -{ -static char escaped[IW_ESSID_MAX_SIZE *2 +1 ]; -const char *s = essid; -char *d = escaped; - -if (ieee80211_is_empty_essid (essid, essid_len)) { -memcpy (escaped,"<hidden>" ,sizeof ("<hidden>" )); -return escaped; - } - - essid_len =min (essid_len, (u8 )IW_ESSID_MAX_SIZE ); -while (essid_len--) { -if (*s =='\0' ) { - *d++ ='\\' ; - *d++ ='0' ; - s++; - }else { - *d++ = *s++; - } - } - *d ='\0' ; -return escaped; -} -EXPORT_SYMBOL (alloc_ieee80211);EXPORT_SYMBOL (free_ieee80211); -EXPORT_SYMBOL (escape_essid);
net/ieee80211/ieee80211_rx.c +5 -4
@@ -32,6 +32,7 @@#include <asm/uaccess.h> #include <linux/ctype.h> +#include <net/lib80211.h> #include <net/ieee80211.h> static void ieee80211_monitor_rx(struct ieee80211_device *ieee,
@@ -1166,8 +1167,8 @@ static int ieee80211_parse_info_param(struct ieee80211_info_elementswitch (info_element->id) {case MFIE_TYPE_SSID : -if (ieee80211_is_empty_essid (info_element->data, - info_element->len)) { +if (is_empty_essid (info_element->data, + info_element->len)) { network->flags |=NETWORK_EMPTY_ESSID ;break ; }
@@ -1411,7 +1412,7 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee network->mode |=IEEE_B ; } -if (ieee80211_is_empty_essid (network->ssid, network->ssid_len)) +if (is_empty_essid (network->ssid, network->ssid_len)) network->flags |=NETWORK_EMPTY_ESSID ;memcpy (&network->stats, stats,sizeof (network->stats));
@@ -1485,7 +1486,7 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021return 1 ; } -if (ieee80211_is_empty_essid (network->ssid, network->ssid_len)) +if (is_empty_essid (network->ssid, network->ssid_len)) network->flags |=NETWORK_EMPTY_ESSID ;memcpy (&network->stats, stats,sizeof (network->stats));
net/wireless/Kconfig +10 -0
@@ -73,3 +73,13 @@ config WIRELESS_EXT_SYSFS Say Y if you have programs using it, like old versions of hal. + +config LIB80211 + tristate "Common routines for IEEE802.11 drivers" + default n + help + This options enables a library of common routines used + by IEEE802.11 wireless LAN drivers. + + Drivers should select this themselves if needed. Say Y if + you want this built into your kernel.
net/wireless/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_WIRELESS_EXT) += wext.o obj-$(CONFIG_CFG80211) += cfg80211.o +obj-$(CONFIG_LIB80211) += lib80211.o cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o cfg80211-$(CONFIG_NL80211) += nl80211.o
net/wireless/lib80211.c new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.5.4.3
Quoted 1 line · John W. Linville
This is also an excuse to create the long rumored lib80211 module...
How about stuffing it in something like:
include/linux/wlandevice.h
Is there a benefit to having a module for it as this time?
Which reminds me, net/ieee80211/ should be ipw'ized now that the old softmac drivers are gone.
mcgrof@tesla ~/wireless-testing/drivers/net/wireless (git::v2.6.27-rc6)$ grep -nHr "#include <net/ieee80211.h>" * airo.c:50:#include <net/ieee80211.h>
atmel.c:70:#include <net/ieee80211.h>
hostap/hostap_main.c:29:#include <net/ieee80211.h>
hostap/hostap_hw.c:49:#include <net/ieee80211.h>
ipw2100.h:42:#include <net/ieee80211.h>
ipw2200.h:51:#include <net/ieee80211.h>
libertas/types.h:10:#include <net/ieee80211.h>
libertas/main.c:17:#include <net/ieee80211.h>
libertas/dev.h:13:#include <net/ieee80211.h>
libertas/wext.c:11:#include <net/ieee80211.h>
libertas/cmd.c:7:#include <net/ieee80211.h>
orinoco.c:88:#include <net/ieee80211.h>
rndis_wlan.c:44:#include <net/ieee80211.h>
wl3501.h:5:#include <net/ieee80211.h>
zd1201.c:24:#include <net/ieee80211.h>
Whatever these suckers are using can probably be slapped in there as well. But yea -- we just need to get it done huh.
Thoughts?
Luis
Quoted 8 lines · Luis R. Rodriguez
Quoted 1 line · John W. Linville
This is also an excuse to create the long rumored lib80211 module...
How about stuffing it in something like:
include/linux/wlandevice.hIs there a benefit to having a module for it as this time?
The escape_essid function is currently not inlined. Are you arguing that it should be? Otherwise it needs to live _somewhere_. The cfg80211 module might make sense, except that the libertas, ipw2100, and ipw2200 drivers don't use cfg80211 (at least for now).
Besides, you have to start _somewhere_. I have a feeling that this happened in the first place because there was nowhere for drivers to share bits of code like this (other than mac80211 or iee80211).
Quoted 20 lines
Which reminds me,
net/ieee80211/should be ipw'ized now that the old softmac drivers are gone.mcgrof@tesla ~/wireless-testing/drivers/net/wireless (git::v2.6.27-rc6)$ grep -nHr "#include <
net/ieee80211.h>" * airo.c:50:#include <net/ieee80211.h>
atmel.c:70:#include <net/ieee80211.h>
hostap/hostap_main.c:29:#include <net/ieee80211.h>
hostap/hostap_hw.c:49:#include <net/ieee80211.h>
ipw2100.h:42:#include <net/ieee80211.h>
ipw2200.h:51:#include <net/ieee80211.h>
libertas/types.h:10:#include <net/ieee80211.h>
libertas/main.c:17:#include <net/ieee80211.h>
libertas/dev.h:13:#include <net/ieee80211.h>
libertas/wext.c:11:#include <net/ieee80211.h>
libertas/cmd.c:7:#include <net/ieee80211.h>
orinoco.c:88:#include <net/ieee80211.h>
rndis_wlan.c:44:#include <net/ieee80211.h>
wl3501.h:5:#include <net/ieee80211.h>
zd1201.c:24:#include <net/ieee80211.h>
Quoted 4 lines
Whatever these suckers are using can probably be slapped in there as well. But yea -- we just need to get it done huh.
Thoughts?
I figure there are probably other bits that can be shared, but most of them probably require at least _some_ recoding. This is a no-brainer and it "breaks the ice" for more follow-on work.
John
Signature · 2 lines
John W. Linville Linux should be at the core [email protected] of your literate lifestyle.
Quoted 4 lines · John W. Linville
Quoted 3 lines · Luis R. Rodriguez
Quoted 1 line · John W. Linville
This is also an excuse to create the long rumored lib80211 module...
Quoted 8 lines
Quoted 5 lines
How about stuffing it in something like:
include/linux/wlandevice.hIs there a benefit to having a module for it as this time?
The
escape_essidfunction is currently not inlined. Are you arguing that it should be?
Just an idea, yes, but that's just because it didn't seem that escape_essid() in itself was enough reason to create a shiny new module.
Quoted 3 lines
Otherwise it needs to live _somewhere_.
The cfg80211 module might make sense, except that the libertas, ipw2100, and ipw2200 drivers don't use cfg80211 (at least for now).
If we want a framework for FullMAC drivers I think cfg80211 can play that role just fine as I believe it was designed that way. We could potentialy just add non-wiphy helper routines in there for now as well if all we need is a home for them. What if we want to make use of some of these in other cfg80211 drivers or maybe mac80211?
Quoted 3 lines
Besides, you have to start _somewhere_. I have a feeling that this happened in the first place because there was nowhere for drivers to share bits of code like this (other than mac80211 or iee80211).
Agreed, although I do like to think cfg80211 can play this role as well, unless we want to remain strict about requiring a wiphy for all its callers.
Quoted 20 lines
Quoted 20 lines
Which reminds me,
net/ieee80211/should be ipw'ized now that the old softmac drivers are gone.mcgrof@tesla ~/wireless-testing/drivers/net/wireless (git::v2.6.27-rc6)$ grep -nHr "#include <
net/ieee80211.h>" * airo.c:50:#include <net/ieee80211.h>
atmel.c:70:#include <net/ieee80211.h>
hostap/hostap_main.c:29:#include <net/ieee80211.h>
hostap/hostap_hw.c:49:#include <net/ieee80211.h>
ipw2100.h:42:#include <net/ieee80211.h>
ipw2200.h:51:#include <net/ieee80211.h>
libertas/types.h:10:#include <net/ieee80211.h>
libertas/main.c:17:#include <net/ieee80211.h>
libertas/dev.h:13:#include <net/ieee80211.h>
libertas/wext.c:11:#include <net/ieee80211.h>
libertas/cmd.c:7:#include <net/ieee80211.h>
orinoco.c:88:#include <net/ieee80211.h>
rndis_wlan.c:44:#include <net/ieee80211.h>
wl3501.h:5:#include <net/ieee80211.h>
zd1201.c:24:#include <net/ieee80211.h>
Quoted 8 lines
Quoted 4 lines
Whatever these suckers are using can probably be slapped in there as well. But yea -- we just need to get it done huh.
Thoughts?
I figure there are probably other bits that can be shared, but most of them probably require at least _some_ recoding. This is a no-brainer and it "breaks the ice" for more follow-on work.
Sure, my vote goes towards cfg80211 with helpers which are non wiphy specific. The reason being that these drivers *could* also potentially be ported to use cfg80211 eventually and in fact I think this should be encouraged to help cfg80211 move forward to support them and so eventually [if/once] we have a Linux 3.0 we can ditch Wireless Extensions completely.
I think an lib80211 would provide for more excuses for people to stuff things in there and help them never cross the line into cfg80211.
Luis
Quoted 9 lines · Luis R. Rodriguez
Quoted 8 lines · John W. Linville
Quoted 7 lines · Luis R. Rodriguez
Quoted 1 line · John W. Linville
This is also an excuse to create the long rumored lib80211 module...
How about stuffing it in something like:
include/linux/wlandevice.h
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Is there a benefit to having a module for it as this time?
The
escape_essidfunction is currently not inlined. Are you arguing that it should be?Just an idea, yes, but that's just because it didn't seem that
escape_essid()in itself was enough reason to create a shiny new module.
Is there some huge cost I'm overlooking? If you are afraid of wasting a page then build it into the kernel. Hopefully this module eventually gets bigger anyway.
Quoted 9 lines
Quoted 3 lines
Otherwise it needs to live _somewhere_.
The cfg80211 module might make sense, except that the libertas, ipw2100, and ipw2200 drivers don't use cfg80211 (at least for now).If we want a framework for FullMAC drivers I think cfg80211 can play that role just fine as I believe it was designed that way. We could potentialy just add non-wiphy helper routines in there for now as well if all we need is a home for them. What if we want to make use of some of these in other cfg80211 drivers or maybe mac80211?
Nothing stops that whether or not they are in a different module.
Quoted 7 lines
Quoted 3 lines
Besides, you have to start _somewhere_. I have a feeling that this happened in the first place because there was nowhere for drivers to share bits of code like this (other than mac80211 or iee80211).
Agreed, although I do like to think cfg80211 can play this role as well, unless we want to remain strict about requiring a wiphy for all its callers.
Sure, it could. Does it make a difference?
<snip>
Quoted 11 lines
Quoted 3 lines
I figure there are probably other bits that can be shared, but most of them probably require at least _some_ recoding. This is a no-brainer and it "breaks the ice" for more follow-on work.
Sure, my vote goes towards cfg80211 with helpers which are non wiphy specific. The reason being that these drivers *could* also potentially be ported to use cfg80211 eventually and in fact I think this should be encouraged to help cfg80211 move forward to support them and so eventually [if/once] we have a Linux 3.0 we can ditch Wireless Extensions completely.
Quoted 2 lines
I think an lib80211 would provide for more excuses for people to stuff things in there and help them never cross the line into cfg80211.
I don't really see where this affects that. What are 'they' going to stuff in there as an alternative to cfg80211 anyway? If drivers suddenly find ways to share WEXT code, that would seem to make migrating them to cfg80211 that much easier.
In the meantime, this is currently my bikeshed and I'd prefer to paint it like this. :-)
John
Signature · 2 lines
John W. Linville Linux should be at the core [email protected] of your literate lifestyle.
Quoted 3 lines · John W. Linville
Is there some huge cost I'm overlooking? If you are afraid of wasting a page then build it into the kernel. Hopefully this module eventually gets bigger anyway.
Like I said, just a thought, in general a module for just one routine seems like complete overkill to me.
Quoted 11 lines
Quoted 9 lines
Quoted 3 lines
Otherwise it needs to live _somewhere_.
The cfg80211 module might make sense, except that the libertas, ipw2100, and ipw2200 drivers don't use cfg80211 (at least for now).If we want a framework for FullMAC drivers I think cfg80211 can play that role just fine as I believe it was designed that way. We could potentialy just add non-wiphy helper routines in there for now as well if all we need is a home for them. What if we want to make use of some of these in other cfg80211 drivers or maybe mac80211?
Nothing stops that whether or not they are in a different module.
Right, but my point was more towards that if it lives in cfg80211 you don't have to have yet another module loaded -- specially for this just one routine.
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
Besides, you have to start _somewhere_. I have a feeling that this happened in the first place because there was nowhere for drivers to share bits of code like this (other than mac80211 or iee80211).
Agreed, although I do like to think cfg80211 can play this role as well, unless we want to remain strict about requiring a wiphy for all its callers.
Sure, it could. Does it make a difference?
I don't see a point to a "lib80211" for just one routine for now.
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
I figure there are probably other bits that can be shared, but most of them probably require at least _some_ recoding. This is a no-brainer and it "breaks the ice" for more follow-on work.
Sure, my vote goes towards cfg80211 with helpers which are non wiphy specific. The reason being that these drivers *could* also potentially be ported to use cfg80211 eventually and in fact I think this should be encouraged to help cfg80211 move forward to support them and so eventually [if/once] we have a Linux 3.0 we can ditch Wireless Extensions completely.
Quoted 7 lines
Quoted 2 lines
I think an lib80211 would provide for more excuses for people to stuff things in there and help them never cross the line into cfg80211.
I don't really see where this affects that. What are 'they' going to stuff in there as an alternative to cfg80211 anyway? If drivers suddenly find ways to share WEXT code, that would seem to make migrating them to cfg80211 that much easier.
So what will lib80211 be then exactly? If its not some sort of infrastructure for drivers then why not just stash useful generic stuff into headers and where appropriate cfg80211? -- Why do we need another module for this?
Quoted 2 lines
In the meantime, this is currently my bikeshed and I'd prefer to paint it like this. :-)
Heh, this is why I said its just my vote.
Luis
Quoted 2 lines
the libertas, ipw2100, and ipw2200 drivers don't use cfg80211 (at least for now).
Yeah, Dan once spoke about using cfg80211 for libertas, but at that time I didn't saw the point.
Hmm, I actually don't see the point now :-)
But libertas (with debug code compiled in) uses escape_essid() and thus can easily be using the lib80211.
Johannes Berg
maintainerQuoted 7 lines · Holger Schurig
Quoted 2 lines
the libertas, ipw2100, and ipw2200 drivers don't use cfg80211 (at least for now).
Yeah, Dan once spoke about using cfg80211 for libertas, but at that time I didn't saw the point.
Hmm, I actually don't see the point now :-)
Well, you'll want to take advantage of the regulatory code and the scanning stuff I'm working on...
johannes
Quoted 11 lines · Johannes Berg
Quoted 7 lines · Holger Schurig
Quoted 2 lines
the libertas, ipw2100, and ipw2200 drivers don't use cfg80211 (at least for now).
Yeah, Dan once spoke about using cfg80211 for libertas, but at that time I didn't saw the point.
Hmm, I actually don't see the point now :-)
Well, you'll want to take advantage of the regulatory code and the scanning stuff I'm working on...
Yes. I want common regulatory code, if nothing else then common functions for:
channel <-> frequency conversion
common regulatory domains and their restrictions
common BSS structure for scan results
common scan result translation handlers
Two options for scan result handling:
--------------------------------------------------------------------------
1) common GIWSCAN processing function that takes a callback. This callback would be executed until it returns FALSE to signify no further scan results. Callback prototype:
bool scan_res_hook(struct common_bss *bss, void *user_data);
'bss' would simply be a _single_ common bss structure allocated at the start of iteration, and zeroed each time before calling the hook. The scan hook then fills that common BSS structure with information from its own internal scan list. The GIWSCAN processor then handles translation into the actual WEXT event stream or nl80211 formats.
--------------------------------------------------------------------------
2) common GIWSCAN processing function that takes a list of common BSS structures that the driver stores internally. The common BSS structure would have a "void *driver_data" pointer in which the driver could keep driver-specific data items, but the driver would be responsible for setting all available information in the common BSS structure when the firmware provides scan results. lib80211 provides common allocation, deallocation, bss entry aging, ref/unref, and free-list fetching.
This would remove a good chunk of code from airo, atmel, and libertas at least, which are the drivers that I've converted to this sort of scan results handling system in the past. Most of the old ieee80211's BSS structure stuff was applicable, but it had too many Intel-specific bits in it too (like the SECLEVEL stuff).
Thoughts?
Dan
Johannes Berg
maintainerQuoted 1 line · Dan Williams
channel <-> frequency conversion
have that in cfg80211
Quoted 1 line
common regulatory domains and their restrictions
that too
Quoted 4 lines
common BSS structure for scan results
common scan result translation handlersTwo options for scan result handling:
Can you look at the RFC patch I posted?
Quoted 13 lines
--------------------------------------------------------------------------
1) common GIWSCAN processing function that takes a callback. This callback would be executed until it returns FALSE to signify no further scan results. Callback prototype:bool
scan_res_hook(struct common_bss *bss, void *user_data);'bss' would simply be a _single_ common bss structure allocated at the start of iteration, and zeroed each time before calling the hook. The scan hook then fills that common BSS structure with information from its own internal scan list. The GIWSCAN processor then handles translation into the actual WEXT event stream or nl80211 formats.
Quoted 8 lines
--------------------------------------------------------------------------
2) common GIWSCAN processing function that takes a list of common BSS structures that the driver stores internally. The common BSS structure would have a "void*driver_data" pointer in which the driver could keep driver-specific data items, but the driver would be responsible for setting all available information in the common BSS structure when the firmware provides scan results. lib80211 provides common allocation, deallocation, bss entry aging, ref/unref, and free-list fetching.
I had something like this option 2 in mind when I wrote my patch, can you take a look at it? The only thing missing now is quality/signal/noise handling. Here's the most recent version:
http://johannes.sipsolutions.net/patches/kernel/all/2008-09-26-11%3a08/020-cfg80211-scan.patch
johannes
Johannes Berg
maintainerQuoted 8 lines · Johannes Berg
Quoted 7 lines
2) common GIWSCAN processing function that takes a list of common BSS structures that the driver stores internally. The common BSS structure would have a "void
*driver_data" pointer in which the driver could keep driver-specific data items, but the driver would be responsible for setting all available information in the common BSS structure when the firmware provides scan results. lib80211 provides common allocation, deallocation, bss entry aging, ref/unref, and free-list fetching.
Quoted 5 lines
I had something like this option 2 in mind when I wrote my patch, can you take a look at it? The only thing missing now is quality/signal/noise handling. Here's the most recent version:
http://johannes.sipsolutions.net/patches/kernel/all/2008-09-26-11%3a08/020-cfg80211-scan.patch
That version no longer applies; some rejects you can ignore safely though for purposes of this thread, but here's a new version anyway:
http://johannes.sipsolutions.net/patches/kernel/all/2008-09-26-13%3a11/008-cfg80211-scan.patch
johannes
Johannes Berg
maintainerOn Thu, 2008-09-25 at 12:57 -0400, Dan Williams wrote:
Let me elaborate a bit on what my patch does
Quoted 4 lines
2) common GIWSCAN processing function that takes a list of common BSS structures that the driver stores internally. The common BSS structure would have a "void
*driver_data" pointer in which the driver could keep driver-specific data items,
I actually am allocating space for it in the same struct, rather small difference though.
Quoted 4 lines
but the driver would be responsible for
setting all available information in the common BSS structure when the firmware provides scan results. lib80211 provides common allocation, deallocation, bss entry aging, ref/unref, and free-list fetching.
What cfg80211 with my patch does is bind it to the wiphy, which you really want to have anyway when taking advantage of the regulatory stuff etc. It's currently not providing any deallocation function, but is providing allocation (currently only based on a beacon/proberesp frame but a new version can be provided), entry aging, ref/unref. List fetching is notably absent, I was thinking an iterator function should be provided if at all necessary, maybe the "find me an entry with these characteristics" functions should just be expanded to have more optional parameters. Then again, you may need to make decisions based on security etc.
I have not so far thought about splitting out the information and stuffed it all into an information element list that I'm internally handling, for speed the SSID IE should probably be pointered explicitly though.
johannes
Quoted 8 lines · Luis R. Rodriguez
Which reminds me,
net/ieee80211/should be ipw'ized now that the old softmac drivers are gone.mcgrof@tesla ~/wireless-testing/drivers/net/wireless (git::v2.6.27-rc6)$ grep -nHr "#include <
net/ieee80211.h>" * orinoco.c:88:#include <net/ieee80211.h>Whatever these suckers are using can probably be slapped in there as well. But yea -- we just need to get it done huh.
Almost all of what orinoco uses can now be sourced from <linux/ieee80211.h> instead. However there are the following constants:
Missing:MAX_WPA_IE_LEN (64)WEP_KEYS (4)
Possible alternative, but change in value:IEEE80211_FRAME_LEN (2334) != IEEE80211_MAX_FRAME_LEN (2352)
Obviously these can be defined locally if we're not sure if they should be global, or where they belong.
Regards,
Dave.
Johannes Berg
maintainerQuoted 1 line · John W. Linville
This is also an excuse to create the long rumored lib80211 module...
Let's also take the chance to clean up the mess Intel has, once again, created here.
net/ieee80211/ieee80211_rx.c static int ieee80211_parse_info_param(struct ieee80211_info_element · line 1174
Quoted 9 lines
net/ieee80211/ieee80211_rx.c +2
-2switch (info_element->id) {case MFIE_TYPE_SSID : -if (ieee80211_is_empty_essid (info_element->data, - info_element->len)) { +if (is_empty_essid (info_element->data, + info_element->len)) { network->flags |=NETWORK_EMPTY_ESSID ;break ; }
You can remove the whole NETWORK_EMPTY_ESSID flag and this whole test; the code slightly below needs to take care to actually escape the SSID for the debug output.
net/ieee80211/ieee80211_rx.c static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee · line 1416
Quoted 7 lines
net/ieee80211/ieee80211_rx.c +1
-1@@ -1411,7 +1412,7 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee network->mode |=IEEE_B ; } -if (ieee80211_is_empty_essid (network->ssid, network->ssid_len)) +if (is_empty_essid (network->ssid, network->ssid_len)) network->flags |=NETWORK_EMPTY_ESSID ;
drop the whole if
net/ieee80211/ieee80211_rx.c static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee · line 1416
Quoted 4 lines
net/ieee80211/ieee80211_rx.c +1
-1-if (ieee80211_is_empty_essid (network->ssid, network->ssid_len)) +if (is_empty_essid (network->ssid, network->ssid_len)) network->flags |=NETWORK_EMPTY_ESSID ;
ditto.
that leaves once place using the NETWORK_EMPTY_ESSID flag, in ieee80211_wx.c:
/* Add the ESSID */
iwe.cmd = SIOCGIWESSID;
iwe.u.data.flags = 1;
if (network->flags & NETWORK_EMPTY_ESSID) {
iwe.u.data.length = sizeof("<hidden>");
start = iwe_stream_add_point(info, start, stop,
&iwe, "<hidden>");
} else {
iwe.u.data.length = min(network->ssid_len, (u8) 32);
start = iwe_stream_add_point(info, start, stop,
&iwe, network->ssid);
}which is of course *completely* *wrong*. There's no excuse for messing up the values passed to userspace like that.
net/wireless/lib80211.c line 30
Quoted 10 lines
net/wireless/lib80211.c new file +10
-0+const char *escape_essid (const char *essid,u8 essid_len) +{ +static char escaped[IW_ESSID_MAX_SIZE *2 +1 ]; +const char *s = essid; +char *d = escaped; + +if (is_empty_essid (essid, essid_len)) { +memcpy (escaped,"<hidden>" ,sizeof ("<hidden>" )); +return escaped; + }
Once you've done the above, is_empty_essid is only used here. I'll leave it to you whether you want to print <hidden> or not, I'd prefer if the function was to just escape the ASCII-NULs as normal since then you can actually distinguish the various forms of hidden SSIDs which might help. Maybe that needs quotes around the escaped SSID then.
Quoted 4 lines
net/wireless/lib80211.c new file +4
-0+ essid_len =min (essid_len, (u8 )IW_ESSID_MAX_SIZE ); +while (essid_len--) { +if (*s =='\0' ) { + *d++ ='\\' ;
net/wireless/lib80211.c line 45
Quoted 10 lines
net/wireless/lib80211.c new file +10
-0+ *d++ ='0' ; + s++; + }else { + *d++ = *s++; + } + } + *d ='\0' ; +return escaped; +} +EXPORT_SYMBOL (escape_essid);
Also, we could take the chance to stop making Jean's mistake in calling this thing the _E_SSID, there's no such thing, it's Jean's invention, based on his misguided thought that this might somehow be less confusing to the user.
johannes
Johannes Berg
maintainerQuoted 6 lines · Johannes Berg
Quoted 6 lines
net/wireless/lib80211.c new file +6
-0+ essid_len =min (essid_len, (u8 )IW_ESSID_MAX_SIZE ); +while (essid_len--) { +if (*s =='\0' ) { + *d++ ='\\' ; + *d++ ='0' ; + s++;
Quoted 8 lines
net/wireless/lib80211.c line 45
Quoted 8 lines
net/wireless/lib80211.c new file +8
-0+ }else { + *d++ = *s++; + } + } + *d ='\0' ; +return escaped; +} +EXPORT_SYMBOL (escape_essid);
Also, it seems like this should escape any non-printable characters, not just NUL?
johannes
Quoted 11 lines · Johannes Berg
Quoted 9 lines · Johannes Berg
Quoted 9 lines
net/wireless/lib80211.c new file +9
-0+ essid_len =min (essid_len, (u8 )IW_ESSID_MAX_SIZE ); +while (essid_len--) { +if (*s =='\0' ) { + *d++ ='\\' ; + *d++ ='0' ; + s++; + }else { + *d++ = *s++; + }
Quoted 8 lines
Quoted 5 lines
net/wireless/lib80211.c line 45
Quoted 5 lines
net/wireless/lib80211.c new file +5
-0+ } + *d ='\0' ; +return escaped; +} +EXPORT_SYMBOL (escape_essid);Also, it seems like this should escape any non-printable characters, not just NUL?
Yes, it should escape any _non-ASCII_ characters.
Dan
Quoted 84 lines · Johannes Berg
Quoted 1 line · John W. Linville
This is also an excuse to create the long rumored lib80211 module...
Let's also take the chance to clean up the mess Intel has, once again, created here.
net/ieee80211/ieee80211_rx.c static int ieee80211_parse_info_param(struct ieee80211_info_element · line 1174
Quoted 9 lines
net/ieee80211/ieee80211_rx.c +2
-2switch (info_element->id) {case MFIE_TYPE_SSID : -if (ieee80211_is_empty_essid (info_element->data, - info_element->len)) { +if (is_empty_essid (info_element->data, + info_element->len)) { network->flags |=NETWORK_EMPTY_ESSID ;break ; }You can remove the whole
NETWORK_EMPTY_ESSIDflag and this whole test; the code slightly below needs to take care to actually escape the SSID for the debug output.net/ieee80211/ieee80211_rx.c static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee · line 1416
Quoted 7 lines
net/ieee80211/ieee80211_rx.c +1
-1@@ -1411,7 +1412,7 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee network->mode |=IEEE_B ; } -if (ieee80211_is_empty_essid (network->ssid, network->ssid_len)) +if (is_empty_essid (network->ssid, network->ssid_len)) network->flags |=NETWORK_EMPTY_ESSID ;drop the whole if
net/ieee80211/ieee80211_rx.c static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee · line 1416
Quoted 4 lines
net/ieee80211/ieee80211_rx.c +1
-1-if (ieee80211_is_empty_essid (network->ssid, network->ssid_len)) +if (is_empty_essid (network->ssid, network->ssid_len)) network->flags |=NETWORK_EMPTY_ESSID ;ditto.
that leaves once place using the
NETWORK_EMPTY_ESSIDflag, inieee80211_wx.c:/* Add the ESSID */ iwe.cmd = SIOCGIWESSID; iwe.u.data.flags = 1; if (network->flags & NETWORK_EMPTY_ESSID) { iwe.u.data.length = sizeof("<hidden>"); start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>"); } else { iwe.u.data.length = min(network->ssid_len, (u8) 32); start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); }which is of course *completely* *wrong*. There's no excuse for messing up the values passed to userspace like that.
net/wireless/lib80211.c line 30
Quoted 10 lines
net/wireless/lib80211.c new file +10
-0+const char *escape_essid (const char *essid,u8 essid_len) +{ +static char escaped[IW_ESSID_MAX_SIZE *2 +1 ]; +const char *s = essid; +char *d = escaped; + +if (is_empty_essid (essid, essid_len)) { +memcpy (escaped,"<hidden>" ,sizeof ("<hidden>" )); +return escaped; + }Once you've done the above,
is_empty_essidis only used here. I'll leave it to you whether you want to print <hidden> or not, I'd prefer if the function was to just escape the ASCII-NULs as normal since then you can actually distinguish the various forms of hidden SSIDs which might help. Maybe that needs quotes around the escaped SSID then.Quoted 11 lines
net/wireless/lib80211.c new file +11
-0+ essid_len =min (essid_len, (u8 )IW_ESSID_MAX_SIZE ); +while (essid_len--) { +if (*s =='\0' ) { + *d++ ='\\' ; + *d++ ='0' ; + s++; + }else { + *d++ = *s++; + } + } + *d ='\0' ;
Quoted 8 lines
net/wireless/lib80211.c line 45
Quoted 3 lines
net/wireless/lib80211.c new file +3
-0+return escaped; +} +EXPORT_SYMBOL (escape_essid);Also, we could take the chance to stop making Jean's mistake in calling this thing the
_E_SSID, there's no such thing, it's Jean's invention, based on his misguided thought that this might somehow be less confusing to the user.
+1
Dan
net/wireless/lib80211.c line 9
Quoted 13 lines · John W. Linville
This is also an excuse to create the long rumored lib80211 module...
+++
b/net/wireless/lib80211.cnet/wireless/lib80211.c new file +9
-0@@ -0,0 +1,58 @@ +/* +* lib80211 -- common bits for IEEE802.11 drivers +* +* Copyright(c) 2008 John W. Linville <[email protected]> +* +*/ + +#include <linux/module.h> +#include <linux/wireless.h>
Alternatively #include <linux/ieee80211.h>, and avoid the WE header/constants? Or would you expect WE helpers in this file as well?
net/wireless/lib80211.c line 23
Quoted 3 lines
net/wireless/lib80211.c new file +3
-0+const char *escape_essid (const char *essid,u8 essid_len) +{ +static char escaped[IW_ESSID_MAX_SIZE *2 +1 ];
[IEEE80211_SSID_MAX_LEN * 2 + 1]
net/wireless/lib80211.c line 32
Quoted 9 lines
net/wireless/lib80211.c new file +9
-0+const char *s = essid; +char *d = escaped; + +if (is_empty_essid (essid, essid_len)) { +memcpy (escaped,"<hidden>" ,sizeof ("<hidden>" )); +return escaped; + } + + essid_len =min (essid_len, (u8 )IW_ESSID_MAX_SIZE );
IEEE80211_SSID_MAX_LEN
Also, are we worried about drivers interrupting each other and getting the others SSID? In which case maybe something like print_mac:
/* in lib80211.h */
#define DECLARE_SSID_BUF(x) char x[IEEE80211_SSID_MAX_LEN * 2 + 1]
const char *print_ssid(char *escaped, const char *ssid, u8 ssid_len);
Regards,
Dave.
cover wireless: single escape_essid implementation and related cleanups
In reply to John W. LinvilleThis is a repost of my escape_essid consolidation. Also included are some suggested changes from the original post and a few cleanups. There is still plenty to be done -- of course, this isn't really high priority work either...
[PATCH 1/5] wireless: consolidate on a single escape_essid implementation [PATCH 2/5] wireless: remove NETWORK_EMPTY_ESSID flag
[PATCH 3/5] wireless: escape_ssid should handle non-printables [PATCH 4/5] wireless: use individual buffers for printing ssid values [PATCH 5/5] wireless: avoid some net/ieee80211.h vs. linux/ieee80211.h conflicts
Comments welcome!
John
--
John W. Linville Linux should be at the core
[email protected] of your literate lifestyle.
PATCH 1/5 wireless: consolidate on a single escape_essid implementation
--- drivers/net/wireless/Kconfig | 1 + drivers/net/wireless/ipw2100.c | 10 +- drivers/net/wireless/ipw2200.c | 126 +++++++++++++------------- drivers/net/wireless/ipw2200.h | 1 + drivers/net/wireless/iwlwifi/Kconfig | 2 + drivers/net/wireless/iwlwifi/iwl-scan.c | 53 ++---------- drivers/net/wireless/iwlwifi/iwl3945-base.c | 48 +--------- drivers/net/wireless/libertas/assoc.c | 14 ++-- drivers/net/wireless/libertas/cmd.c | 3 +- drivers/net/wireless/libertas/debugfs.c | 3 +- drivers/net/wireless/libertas/decl.h | 4 - drivers/net/wireless/libertas/main.c | 27 ------ drivers/net/wireless/libertas/scan.c | 11 ++- drivers/net/wireless/libertas/wext.c | 3 +- include/net/ieee80211.h | 20 ---- include/net/lib80211.h | 31 +++++++ net/ieee80211/Kconfig | 1 + net/ieee80211/ieee80211_module.c | 26 ------ net/ieee80211/ieee80211_rx.c | 31 ++++--- net/ieee80211/ieee80211_wx.c | 6 +- net/wireless/Kconfig | 10 ++ net/wireless/Makefile | 1 + net/wireless/lib80211.c | 58 ++++++++++++ 23 files changed, 223 insertions(+), 267 deletions(-) create mode 100644 include/net/lib80211.h create mode 100644 net/wireless/lib80211.c
drivers/net/wireless/Kconfig +1 -0
@@ -271,6 +271,7 @@ config LIBERTAS tristate "Marvell 8xxx Libertas WLAN driver support" depends on WLAN_80211 select WIRELESS_EXT + select LIB80211 select FW_LOADER ---help--- A library for Marvell Libertas 8xxx devices.
drivers/net/wireless/ipw2100.c +5 -5
@@ -1977,7 +1977,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)IPW_DEBUG_INFO ("%s: Associated with '%s' at %s, channel %d (BSSID=" "%s)\n" , - priv->net_dev->name,escape_essid (essid, essid_len), + priv->net_dev->name,escape_ssid (essid, essid_len), txratename, chan,print_mac (mac, bssid));/* now we copy read ssid into dev */
@@ -2005,7 +2005,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, };int err; -IPW_DEBUG_HC ("SSID: '%s'\n" ,escape_essid (essid, ssid_len)); +IPW_DEBUG_HC ("SSID: '%s'\n" ,escape_ssid (essid, ssid_len));if (ssid_len)memcpy (cmd.host_command_parameters, essid, ssid_len);
@@ -2050,7 +2050,7 @@ static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status)IPW_DEBUG (IPW_DL_NOTIF |IPW_DL_STATE |IPW_DL_ASSOC ,"disassociated: '%s' %s \n" , -escape_essid (priv->essid, priv->essid_len), +escape_ssid (priv->essid, priv->essid_len),print_mac (mac, priv->bssid)); priv->status &= ~(STATUS_ASSOCIATED |STATUS_ASSOCIATING );
@@ -7000,7 +7000,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, goto done; } -IPW_DEBUG_WX ("Setting ESSID: '%s' (%d)\n" ,escape_essid (essid, length), +IPW_DEBUG_WX ("Setting ESSID: '%s' (%d)\n" ,escape_ssid (essid, length), length); priv->essid_len = length;
@@ -7027,7 +7027,7 @@ static int ipw2100_wx_get_essid(struct net_device *dev,* configured ESSID then return that; otherwise return ANY */ if (priv->config &CFG_STATIC_ESSID || priv->status &STATUS_ASSOCIATED ) {IPW_DEBUG_WX ("Getting essid: '%s'\n" , -escape_essid (priv->essid, priv->essid_len)); +escape_ssid (priv->essid, priv->essid_len));memcpy (extra, priv->essid, priv->essid_len); wrqu->essid.length = priv->essid_len; wrqu->essid.flags =1 ;/* active */
drivers/net/wireless/ipw2200.c +63 -63
388 lines not on this page · raw message
drivers/net/wireless/ipw2200.h +1 -0
@@ -48,6 +48,7 @@#include <linux/jiffies.h> #include <asm/io.h> +#include <net/lib80211.h> #include <net/ieee80211.h> #include <net/ieee80211_radiotap.h>
drivers/net/wireless/iwlwifi/Kconfig +2 -0
@@ -4,6 +4,7 @@ config IWLWIFI config IWLCORE tristate "Intel Wireless Wifi Core" depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL + select LIB80211 select IWLWIFI select MAC80211_LEDS if IWLWIFI_LEDS select LEDS_CLASS if IWLWIFI_LEDS
@@ -105,6 +106,7 @@ config IWL3945 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL select FW_LOADER + select LIB80211 select IWLWIFI select MAC80211_LEDS if IWL3945_LEDS select LEDS_CLASS if IWL3945_LEDS
drivers/net/wireless/iwlwifi/iwl-scan.c +6 -47
78 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl3945-base.c +4 -44
78 lines not on this page · raw message
drivers/net/wireless/libertas/assoc.c +8 -6
@@ -1,6 +1,8 @@/* Copyright (C) 2006, Red Hat, Inc. */ +#include <linux/types.h> #include <linux/etherdevice.h> +#include <net/lib80211.h> #include "assoc.h" #include "decl.h"
@@ -158,11 +160,11 @@ static int lbs_adhoc_join(struct lbs_private *priv,lbs_deb_enter (LBS_DEB_ASSOC );lbs_deb_join ("current SSID '%s', ssid length %u\n" , -escape_essid (priv->curbssparams.ssid, +escape_ssid (priv->curbssparams.ssid, priv->curbssparams.ssid_len), priv->curbssparams.ssid_len);lbs_deb_join ("requested ssid '%s', ssid length %u\n" , -escape_essid (bss->ssid, bss->ssid_len), +escape_ssid (bss->ssid, bss->ssid_len), bss->ssid_len);/* check if the requested SSID is already joined */
@@ -326,7 +328,7 @@ static int lbs_adhoc_start(struct lbs_private *priv,memcpy (cmd.ssid, assoc_req->ssid, assoc_req->ssid_len);lbs_deb_join ("ADHOC_START: SSID '%s', ssid length %u\n" , -escape_essid (assoc_req->ssid, assoc_req->ssid_len), +escape_ssid (assoc_req->ssid, assoc_req->ssid_len), assoc_req->ssid_len); cmd.bsstype =CMD_BSS_TYPE_IBSS ;
@@ -705,7 +707,7 @@ static int assoc_helper_essid(struct lbs_private *priv, channel = assoc_req->channel;lbs_deb_assoc ("SSID '%s' requested\n" , -escape_essid (assoc_req->ssid, assoc_req->ssid_len)); +escape_ssid (assoc_req->ssid, assoc_req->ssid_len));if (assoc_req->mode ==IW_MODE_INFRA ) {lbs_send_specific_ssid_scan (priv, assoc_req->ssid, assoc_req->ssid_len);
@@ -1232,7 +1234,7 @@ void lbs_association_worker(struct work_struct *work)" secinfo: %s%s%s\n" " auth_mode: %d\n" , assoc_req->flags, -escape_essid (assoc_req->ssid, assoc_req->ssid_len), +escape_ssid (assoc_req->ssid, assoc_req->ssid_len), assoc_req->channel, assoc_req->band, assoc_req->mode,print_mac (mac, assoc_req->bssid), assoc_req->secinfo.WPAenabled ? " WPA" : "",
@@ -1820,7 +1822,7 @@ static int lbs_adhoc_post(struct lbs_private *priv, struct cmd_header *resp)wireless_send_event (priv->dev,SIOCGIWAP , &wrqu,NULL );lbs_deb_join ("ADHOC_RESP: Joined/started '%s', BSSID %s, channel %d\n" , -escape_essid (bss->ssid, bss->ssid_len), +escape_ssid (bss->ssid, bss->ssid_len),print_mac (mac, priv->curbssparams.bssid), priv->curbssparams.channel);
drivers/net/wireless/libertas/cmd.c +2 -1
@@ -4,6 +4,7 @@*/ #include <net/iw_handler.h> +#include <net/lib80211.h> #include <net/ieee80211.h> #include <linux/kfifo.h> #include "host.h"
@@ -1091,7 +1092,7 @@ int lbs_mesh_config(struct lbs_private *priv, uint16_t action, uint16_t chan) }lbs_deb_cmd ("mesh config action %d type %x channel %d SSID %s\n" , action, priv->mesh_tlv, chan, -escape_essid (priv->mesh_ssid, priv->mesh_ssid_len)); +escape_ssid (priv->mesh_ssid, priv->mesh_ssid_len));return __lbs_mesh_config_send (priv, &cmd, action, priv->mesh_tlv); }
drivers/net/wireless/libertas/debugfs.c +2 -1
@@ -5,6 +5,7 @@#include <linux/mm.h> #include <linux/string.h> #include <net/iw_handler.h> +#include <net/lib80211.h> #include "dev.h" #include "decl.h"
@@ -87,7 +88,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf, spectrum_mgmt ? 'S' : ' '); pos +=snprintf (buf+pos, len-pos," %04d |" ,SCAN_RSSI (iter_bss->rssi)); pos +=snprintf (buf+pos, len-pos," %s\n" , -escape_essid (iter_bss->ssid, iter_bss->ssid_len)); +escape_ssid (iter_bss->ssid, iter_bss->ssid_len)); numscansdone++; }
drivers/net/wireless/libertas/decl.h +0 -4
@@ -74,8 +74,4 @@ void lbs_host_to_card_done(struct lbs_private *priv);int lbs_update_channel (struct lbs_private *priv); -#ifndef CONFIG_IEEE80211 -const char *escape_essid (const char *essid,u8 essid_len); -#endif -#endif
drivers/net/wireless/libertas/main.c +0 -27
@@ -1647,33 +1647,6 @@ out:return ret; } -#ifndef CONFIG_IEEE80211 -const char *escape_essid (const char *essid,u8 essid_len) -{ -static char escaped[IW_ESSID_MAX_SIZE *2 +1 ]; -const char *s = essid; -char *d = escaped; - -if (ieee80211_is_empty_essid (essid, essid_len)) { -memcpy (escaped,"<hidden>" ,sizeof ("<hidden>" )); -return escaped; - } - - essid_len =min (essid_len, (u8 )IW_ESSID_MAX_SIZE ); -while (essid_len--) { -if (*s =='\0' ) { - *d++ ='\\' ; - *d++ ='0' ; - s++; - }else { - *d++ = *s++; - } - } - *d ='\0' ; -return escaped; -} -#endif -module_init (lbs_init_module);module_exit (lbs_exit_module);
drivers/net/wireless/libertas/scan.c +7 -4
@@ -4,9 +4,12 @@* IOCTL handlers as well as command preperation and response routines * for sending scan commands to the firmware. */ +#include <linux/types.h> #include <linux/etherdevice.h> #include <asm/unaligned.h> +#include <net/lib80211.h> +#include "host.h" #include "decl.h" #include "dev.h"
@@ -453,7 +456,7 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan)list_for_each_entry (iter, &priv->network_list, list)lbs_deb_scan ("%02d: BSSID %s, RSSI %d, SSID '%s'\n" , i++,print_mac (mac, iter->bssid), iter->rssi, -escape_essid (iter->ssid, iter->ssid_len)); +escape_ssid (iter->ssid, iter->ssid_len));mutex_unlock (&priv->lock);#endif
@@ -601,7 +604,7 @@ static int lbs_process_bss(struct bss_descriptor *bss, bss->ssid_len = elem->len;memcpy (bss->ssid, elem->data, elem->len);lbs_deb_scan ("got SSID IE: '%s', len %u\n" , -escape_essid (bss->ssid, bss->ssid_len), +escape_ssid (bss->ssid, bss->ssid_len), bss->ssid_len);break ;
@@ -744,7 +747,7 @@ int lbs_send_specific_ssid_scan(struct lbs_private *priv, uint8_t *ssid,int ret =0 ;lbs_deb_enter_args (LBS_DEB_SCAN ,"SSID '%s'\n" , -escape_essid (ssid, ssid_len)); +escape_ssid (ssid, ssid_len));if (!ssid_len) goto out;
@@ -968,7 +971,7 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, priv->scan_ssid_len = req->essid_len;memcpy (priv->scan_ssid, req->essid, priv->scan_ssid_len);lbs_deb_wext ("set_scan, essid '%s'\n" , -escape_essid (priv->scan_ssid, priv->scan_ssid_len)); +escape_ssid (priv->scan_ssid, priv->scan_ssid_len)); }else { priv->scan_ssid_len =0 ; }
drivers/net/wireless/libertas/wext.c +2 -1
@@ -8,6 +8,7 @@#include <linux/wireless.h> #include <linux/bitops.h> +#include <net/lib80211.h> #include <net/ieee80211.h> #include <net/iw_handler.h>
@@ -2005,7 +2006,7 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,lbs_deb_wext ("requested any SSID\n" ); }else {lbs_deb_wext ("requested SSID '%s'\n" , -escape_essid (ssid, ssid_len)); +escape_ssid (ssid, ssid_len)); } out:
include/net/ieee80211.h +0 -20
@@ -127,10 +127,6 @@ static inline bool ieee80211_ratelimit_debug(u32 level) }#endif /* CONFIG_IEEE80211_DEBUG */ -/* escape_essid() is intended to be used in debug (and possibly error) -* messages. It should never be used for passing essid to user space. */ -const char *escape_essid (const char *essid,u8 essid_len); -/* * To use the debug system: *
@@ -1135,22 +1131,6 @@ static inline void *ieee80211_priv(struct net_device *dev)return ((struct ieee80211_device *)netdev_priv (dev))->priv; } -static inline int ieee80211_is_empty_essid (const char *essid,int essid_len) -{ -/* Single white space is for Linksys APs */ -if (essid_len ==1 && essid[0 ] ==' ' ) -return 1 ; - -/* Otherwise, if the entire essid is 0, we assume it is hidden */ -while (essid_len) { - essid_len--; -if (essid[essid_len] !='\0' ) -return 0 ; - } - -return 1 ; -} -static inline int ieee80211_is_valid_mode (struct ieee80211_device *ieee,int mode) {
include/net/lib80211.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* lib80211.h -- common bits for IEEE802.11 wireless drivers +* +* Copyright (c) 2008, John W. Linville <[email protected]> +* +*/ + +#ifndef LIB80211_H +#define LIB80211_H + +/* escape_ssid() is intended to be used in debug (and possibly error) +* messages. It should never be used for passing ssid to user space. */ +const char *escape_ssid (const char *ssid,u8 ssid_len); + +static inline int is_empty_ssid (const char *ssid,int ssid_len) +{ +/* Single white space is for Linksys APs */ +if (ssid_len ==1 && ssid[0 ] ==' ' ) +return 1 ; + +/* Otherwise, if the entire ssid is 0, we assume it is hidden */ +while (ssid_len) { + ssid_len--; +if (ssid[ssid_len] !='\0' ) +return 0 ; + } + +return 1 ; +} + +#endif /* LIB80211_H */
net/ieee80211/Kconfig +1 -0
@@ -1,5 +1,6 @@ config IEEE80211 tristate "Generic IEEE 802.11 Networking Stack (DEPRECATED)" + select LIB80211 ---help--- This option enables the hardware independent IEEE 802.11 networking stack. This component is deprecated in favor of the
net/ieee80211/ieee80211_module.c +0 -26
@@ -308,31 +308,5 @@ MODULE_PARM_DESC(debug, "debug output mask");module_exit (ieee80211_exit);module_init (ieee80211_init); -const char *escape_essid (const char *essid,u8 essid_len) -{ -static char escaped[IW_ESSID_MAX_SIZE *2 +1 ]; -const char *s = essid; -char *d = escaped; - -if (ieee80211_is_empty_essid (essid, essid_len)) { -memcpy (escaped,"<hidden>" ,sizeof ("<hidden>" )); -return escaped; - } - - essid_len =min (essid_len, (u8 )IW_ESSID_MAX_SIZE ); -while (essid_len--) { -if (*s =='\0' ) { - *d++ ='\\' ; - *d++ ='0' ; - s++; - }else { - *d++ = *s++; - } - } - *d ='\0' ; -return escaped; -} -EXPORT_SYMBOL (alloc_ieee80211);EXPORT_SYMBOL (free_ieee80211); -EXPORT_SYMBOL (escape_essid);
net/ieee80211/ieee80211_rx.c +16 -15
@@ -32,6 +32,7 @@#include <asm/uaccess.h> #include <linux/ctype.h> +#include <net/lib80211.h> #include <net/ieee80211.h> static void ieee80211_monitor_rx(struct ieee80211_device *ieee,
@@ -1166,8 +1167,8 @@ static int ieee80211_parse_info_param(struct ieee80211_info_elementswitch (info_element->id) {case MFIE_TYPE_SSID : -if (ieee80211_is_empty_essid (info_element->data, - info_element->len)) { +if (is_empty_ssid (info_element->data, + info_element->len)) { network->flags |=NETWORK_EMPTY_ESSID ;break ; }
@@ -1411,7 +1412,7 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee network->mode |=IEEE_B ; } -if (ieee80211_is_empty_essid (network->ssid, network->ssid_len)) +if (is_empty_ssid (network->ssid, network->ssid_len)) network->flags |=NETWORK_EMPTY_ESSID ;memcpy (&network->stats, stats,sizeof (network->stats));
@@ -1479,13 +1480,13 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021if (network->mode ==0 ) {IEEE80211_DEBUG_SCAN ("Filtered out '%s (%s)' " "network.\n" , -escape_essid (network->ssid, - network->ssid_len), +escape_ssid (network->ssid, + network->ssid_len),print_mac (mac, network->bssid));return 1 ; } -if (ieee80211_is_empty_essid (network->ssid, network->ssid_len)) +if (is_empty_ssid (network->ssid, network->ssid_len)) network->flags |=NETWORK_EMPTY_ESSID ;memcpy (&network->stats, stats,sizeof (network->stats));
@@ -1601,7 +1602,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device IEEE80211_DEBUG_SCAN("'%s' (%s" "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", - escape_essid(info_element->data, info_element->len), + escape_ssid(info_element->data, info_element->len), print_mac(mac, beacon->header.addr3), (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0', (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0',
@@ -1622,8 +1623,8 @@ static void ieee80211_process_probe_response(struct ieee80211_deviceif (ieee80211_network_init (ieee, beacon, &network, stats)) {IEEE80211_DEBUG_SCAN ("Dropped '%s' (%s) via %s.\n" , -escape_essid (info_element->data, - info_element->len), +escape_ssid (info_element->data, + info_element->len),print_mac (mac, beacon->header.addr3),is_beacon (beacon->header.frame_ctl) ?"BEACON" :"PROBE RESPONSE" );
@@ -1660,8 +1661,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device target = oldest;IEEE80211_DEBUG_SCAN ("Expired '%s' (%s) from " "network list.\n" , -escape_essid (target->ssid, - target->ssid_len), +escape_ssid (target->ssid, + target->ssid_len),print_mac (mac, target->bssid));ieee80211_network_reset (target); }else {
@@ -1673,8 +1674,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device#ifdef CONFIG_IEEE80211_DEBUG IEEE80211_DEBUG_SCAN ("Adding '%s' (%s) via %s.\n" , -escape_essid (network.ssid, - network.ssid_len), +escape_ssid (network.ssid, + network.ssid_len),print_mac (mac, network.bssid),is_beacon (beacon->header.frame_ctl) ?"BEACON" :"PROBE RESPONSE" );
@@ -1684,8 +1685,8 @@ static void ieee80211_process_probe_response(struct ieee80211_devicelist_add_tail (&target->list, &ieee->network_list); }else {IEEE80211_DEBUG_SCAN ("Updating '%s' (%s) via %s.\n" , -escape_essid (target->ssid, - target->ssid_len), +escape_ssid (target->ssid, + target->ssid_len),print_mac (mac, target->bssid),is_beacon (beacon->header.frame_ctl) ?"BEACON" :"PROBE RESPONSE" );
net/ieee80211/ieee80211_wx.c +3 -3
@@ -284,8 +284,8 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, else IEEE80211_DEBUG_SCAN("Not showing network '%s (" "%s)' due to age (%dms).\n", - escape_essid(network->ssid, - network->ssid_len), + escape_ssid(network->ssid, + network->ssid_len), print_mac(mac, network->bssid), jiffies_to_msecs(jiffies - network->
@@ -409,7 +409,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,memset (sec.keys[key] + erq->length,0 , len - erq->length);IEEE80211_DEBUG_WX ("Setting key %d to '%s' (%d:%d bytes)\n" , - key,escape_essid (sec.keys[key], len), + key,escape_ssid (sec.keys[key], len), erq->length, len); sec.key_sizes[key] = len;if (*crypt)
net/wireless/Kconfig +10 -0
@@ -73,3 +73,13 @@ config WIRELESS_EXT_SYSFS Say Y if you have programs using it, like old versions of hal. + +config LIB80211 + tristate "Common routines for IEEE802.11 drivers" + default n + help + This options enables a library of common routines used + by IEEE802.11 wireless LAN drivers. + + Drivers should select this themselves if needed. Say Y if + you want this built into your kernel.
net/wireless/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_WIRELESS_EXT) += wext.o obj-$(CONFIG_CFG80211) += cfg80211.o +obj-$(CONFIG_LIB80211) += lib80211.o cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o cfg80211-$(CONFIG_NL80211) += nl80211.o
net/wireless/lib80211.c new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.5.4.3
PATCH 2/5 wireless: remove NETWORK_EMPTY_ESSID flag
It is unnecessary and of questionable value. Also remove is_empty_ssid, as it is also unnecessary.
--- drivers/net/wireless/ipw2200.c | 23 +---------------------- include/net/ieee80211.h | 1 - include/net/lib80211.h | 16 ---------------- net/ieee80211/ieee80211_rx.c | 15 ++------------- net/ieee80211/ieee80211_wx.c | 12 +++--------- net/wireless/lib80211.c | 5 ----- 6 files changed, 6 insertions(+), 66 deletions(-)
drivers/net/wireless/ipw2200.c +1 -22
@@ -5443,16 +5443,6 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,return 0 ; } -/* If we do not have an ESSID for this AP, we can not associate with -* it */ -if (network->flags &NETWORK_EMPTY_ESSID ) { -IPW_DEBUG_MERGE ("Network '%s (%s)' excluded " -"because of hidden ESSID.\n" , -escape_ssid (network->ssid, network->ssid_len), -print_mac (mac, network->bssid)); -return 0 ; - } -if (unlikely (roaming)) {/* If we are roaming, then ensure check if this is a valid * network to try and roam to */
@@ -5658,16 +5648,6 @@ static int ipw_best_network(struct ipw_priv *priv,return 0 ; } -/* If we do not have an ESSID for this AP, we can not associate with -* it */ -if (network->flags &NETWORK_EMPTY_ESSID ) { -IPW_DEBUG_ASSOC ("Network '%s (%s)' excluded " -"because of hidden ESSID.\n" , -escape_ssid (network->ssid, network->ssid_len), -print_mac (mac, network->bssid)); -return 0 ; - } -if (unlikely (roaming)) {/* If we are roaming, then ensure check if this is a valid * network to try and roam to */
@@ -6892,8 +6872,7 @@ static int ipw_qos_handle_probe_response(struct ipw_priv *priv, if ((priv->status & STATUS_ASSOCIATED) && (priv->ieee->iw_mode == IW_MODE_ADHOC) && (active_network == 0)) { if (memcmp(network->bssid, priv->bssid, ETH_ALEN)) - if ((network->capability & WLAN_CAPABILITY_IBSS) && - !(network->flags & NETWORK_EMPTY_ESSID)) + if (network->capability & WLAN_CAPABILITY_IBSS) if ((network->ssid_len == priv->assoc_network->ssid_len) && !memcmp(network->ssid,
include/net/ieee80211.h +0 -1
@@ -729,7 +729,6 @@ struct ieee80211_txb {#define MAX_WPA_IE_LEN 64 -#define NETWORK_EMPTY_ESSID (1<<0)#define NETWORK_HAS_OFDM (1<<1)#define NETWORK_HAS_CCK (1<<2)
include/net/lib80211.h +0 -16
@@ -12,20 +12,4 @@* messages. It should never be used for passing ssid to user space. */ const char *escape_ssid (const char *ssid,u8 ssid_len); -static inline int is_empty_ssid (const char *ssid,int ssid_len) -{ -/* Single white space is for Linksys APs */ -if (ssid_len ==1 && ssid[0 ] ==' ' ) -return 1 ; - -/* Otherwise, if the entire ssid is 0, we assume it is hidden */ -while (ssid_len) { - ssid_len--; -if (ssid[ssid_len] !='\0' ) -return 0 ; - } - -return 1 ; -} -#endif /* LIB80211_H */
net/ieee80211/ieee80211_rx.c +2 -13
@@ -1167,12 +1167,6 @@ static int ieee80211_parse_info_param(struct ieee80211_info_elementswitch (info_element->id) {case MFIE_TYPE_SSID : -if (is_empty_ssid (info_element->data, - info_element->len)) { - network->flags |=NETWORK_EMPTY_ESSID ; -break ; - } - network->ssid_len =min (info_element->len, (u8 )IW_ESSID_MAX_SIZE ); memcpy(network->ssid, info_element->data,
@@ -1182,7 +1176,8 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element IW_ESSID_MAX_SIZE - network->ssid_len);IEEE80211_DEBUG_MGMT ("MFIE_TYPE_SSID: '%s' len=%d.\n" , - network->ssid, network->ssid_len); +escape_ssid (network->ssid), + network->ssid_len);break ;case MFIE_TYPE_RATES :
@@ -1412,9 +1407,6 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee network->mode |=IEEE_B ; } -if (is_empty_ssid (network->ssid, network->ssid_len)) - network->flags |=NETWORK_EMPTY_ESSID ; -memcpy (&network->stats, stats,sizeof (network->stats));if (ieee->handle_assoc_response !=NULL )
@@ -1486,9 +1478,6 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021return 1 ; } -if (is_empty_ssid (network->ssid, network->ssid_len)) - network->flags |=NETWORK_EMPTY_ESSID ; -memcpy (&network->stats, stats,sizeof (network->stats));return 0 ;
net/ieee80211/ieee80211_wx.c +3 -9
@@ -65,15 +65,9 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee,/* Add the ESSID */ iwe.cmd =SIOCGIWESSID ; iwe.u.data.flags =1 ; -if (network->flags &NETWORK_EMPTY_ESSID ) { - iwe.u.data.length =sizeof ("<hidden>" ); - start =iwe_stream_add_point (info, start, stop, - &iwe,"<hidden>" ); - }else { - iwe.u.data.length =min (network->ssid_len, (u8 )32 ); - start =iwe_stream_add_point (info, start, stop, - &iwe, network->ssid); - } + iwe.u.data.length =min (network->ssid_len, (u8 )32 ); + start =iwe_stream_add_point (info, start, stop, + &iwe, network->ssid);/* Add the protocol name */ iwe.cmd =SIOCGIWNAME ;
net/wireless/lib80211.c +0 -5
@@ -24,11 +24,6 @@ const char *escape_ssid(const char *ssid, u8 ssid_len)const char *s = ssid;char *d = escaped; -if (is_empty_ssid (ssid, ssid_len)) { -memcpy (escaped,"<hidden>" ,sizeof ("<hidden>" )); -return escaped; - } - ssid_len =min_t (u8, ssid_len,IEEE80211_MAX_SSID_LEN );while (ssid_len--) {if (*s =='\0' ) {
Signature · 1 line
1.5.4.3
PATCH 3/5 wireless: escape_ssid should handle non-printables
Also use common backslash sequences like \t, \n, \r, and \\ as well as \0.
--- net/wireless/lib80211.c | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-)
net/wireless/lib80211.c +19 -6
@@ -6,6 +6,7 @@*/ #include <linux/module.h> +#include <linux/ctype.h> #include <linux/ieee80211.h> #include <net/lib80211.h>
@@ -20,19 +21,31 @@ MODULE_LICENSE("GPL");const char *escape_ssid (const char *ssid,u8 ssid_len) { -static char escaped[IEEE80211_MAX_SSID_LEN *2 +1 ]; +static char escaped[IEEE80211_MAX_SSID_LEN *4 +1 ];const char *s = ssid;char *d = escaped; ssid_len =min_t (u8, ssid_len,IEEE80211_MAX_SSID_LEN );while (ssid_len--) { -if (*s =='\0' ) { - *d++ ='\\' ; - *d++ ='0' ; - s++; - }else { +if (isprint (*s)) { *d++ = *s++; +continue ; } + + *d++ ='\\' ; +if (*s =='\0' ) + *d++ ='0' ; +else if (*s =='\n' ) + *d++ ='n' ; +else if (*s =='\r' ) + *d++ ='r' ; +else if (*s =='\t' ) + *d++ ='t' ; +else if (*s =='\\' ) + *d++ ='\\' ; +else + d +=snprintf (d,3 ,"%03o" , *s); + s++; } *d ='\0' ;return escaped;
Signature · 1 line
1.5.4.3
PATCH 4/5 wireless: use individual buffers for printing ssid values
Also change escape_ssid to print_ssid to match print_mac semantics.
--- drivers/net/wireless/ipw2100.c | 19 +++- drivers/net/wireless/ipw2200.c | 153 ++++++++++++++++----------- drivers/net/wireless/iwlwifi/iwl-scan.c | 7 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 9 +- drivers/net/wireless/libertas/assoc.c | 17 ++- drivers/net/wireless/libertas/cmd.c | 3 +- drivers/net/wireless/libertas/debugfs.c | 4 +- drivers/net/wireless/libertas/scan.c | 12 ++- drivers/net/wireless/libertas/wext.c | 3 +- include/linux/ieee80211.h | 6 +- include/net/lib80211.h | 5 +- net/ieee80211/ieee80211_rx.c | 18 ++-- net/ieee80211/ieee80211_wx.c | 6 +- net/wireless/lib80211.c | 9 +- 14 files changed, 165 insertions(+), 106 deletions(-)
drivers/net/wireless/ipw2100.c +13 -6
@@ -163,6 +163,8 @@ that only one external action is invoked at a time.#include <linux/ctype.h> #include <linux/pm_qos_params.h> +#include <net/lib80211.h> +#include "ipw2100.h" #define IPW2100_VERSION "git-1.2.2"
@@ -1915,6 +1917,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)char *txratename;u8 bssid[ETH_ALEN ];DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid);/* * TBD: BSSID is usually 00:00:00:00:00:00 here and not
@@ -1977,7 +1980,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)IPW_DEBUG_INFO ("%s: Associated with '%s' at %s, channel %d (BSSID=" "%s)\n" , - priv->net_dev->name,escape_ssid (essid, essid_len), + priv->net_dev->name,print_ssid (ssid, essid, essid_len), txratename, chan,print_mac (mac, bssid));/* now we copy read ssid into dev */
@@ -2004,8 +2007,9 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, .host_command_length = ssid_len };int err; +DECLARE_SSID_BUF (ssid); -IPW_DEBUG_HC ("SSID: '%s'\n" ,escape_ssid (essid, ssid_len)); +IPW_DEBUG_HC ("SSID: '%s'\n" ,print_ssid (ssid, essid, ssid_len));if (ssid_len)memcpy (cmd.host_command_parameters, essid, ssid_len);
@@ -2047,10 +2051,11 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,static void isr_indicate_association_lost (struct ipw2100_priv *priv,u32 status) {DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid);IPW_DEBUG (IPW_DL_NOTIF |IPW_DL_STATE |IPW_DL_ASSOC ,"disassociated: '%s' %s \n" , -escape_ssid (priv->essid, priv->essid_len), +print_ssid (ssid, priv->essid, priv->essid_len),print_mac (mac, priv->bssid)); priv->status &= ~(STATUS_ASSOCIATED |STATUS_ASSOCIATING );
@@ -6971,6 +6976,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev,char *essid ="" ;/* ANY */ int length =0 ;int err =0 ; +DECLARE_SSID_BUF (ssid);mutex_lock (&priv->action_mutex);if (!(priv->status &STATUS_INITIALIZED )) {
@@ -7000,8 +7006,8 @@ static int ipw2100_wx_set_essid(struct net_device *dev, goto done; } -IPW_DEBUG_WX ("Setting ESSID: '%s' (%d)\n" ,escape_ssid (essid, length), - length); +IPW_DEBUG_WX ("Setting ESSID: '%s' (%d)\n" , +print_ssid (ssid, essid, length), length); priv->essid_len = length;memcpy (priv->essid, essid, priv->essid_len);
@@ -7022,12 +7028,13 @@ static int ipw2100_wx_get_essid(struct net_device *dev,*/ struct ipw2100_priv *priv =ieee80211_priv (dev); +DECLARE_SSID_BUF (ssid);/* If we are associated, trying to associate, or have a statically * configured ESSID then return that; otherwise return ANY */ if (priv->config &CFG_STATIC_ESSID || priv->status &STATUS_ASSOCIATED ) {IPW_DEBUG_WX ("Getting essid: '%s'\n" , -escape_ssid (priv->essid, priv->essid_len)); +print_ssid (ssid, priv->essid, priv->essid_len));memcpy (extra, priv->essid, priv->essid_len); wrqu->essid.length = priv->essid_len; wrqu->essid.flags =1 ;/* active */
drivers/net/wireless/ipw2200.c +91 -62
457 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-scan.c +4 -3
@@ -663,6 +663,7 @@ static void iwl_bg_request_scan(struct work_struct *data)enum ieee80211_band band;u8 n_probes =2 ;u8 rx_chain =0x7 ;/* bitmap: ABC chains */ +DECLARE_SSID_BUF (ssid); conf =ieee80211_get_hw_conf (priv->hw);
@@ -755,8 +756,8 @@ static void iwl_bg_request_scan(struct work_struct *data)/* We should add the ability for user to lock to PASSIVE ONLY */ if (priv->one_direct_scan) {IWL_DEBUG_SCAN ("Start direct scan for '%s'\n" , -escape_ssid (priv->direct_ssid, - priv->direct_ssid_len)); +print_ssid (ssid, priv->direct_ssid, + priv->direct_ssid_len)); scan->direct_scan[0 ].id =WLAN_EID_SSID ; scan->direct_scan[0 ].len = priv->direct_ssid_len; memcpy(scan->direct_scan[0].ssid,
@@ -764,7 +765,7 @@ static void iwl_bg_request_scan(struct work_struct *data) n_probes++; }else if (!iwl_is_associated (priv) && priv->essid_len) {IWL_DEBUG_SCAN ("Start direct scan for '%s' (not associated)\n" , -escape_ssid (priv->essid, priv->essid_len)); +print_ssid (ssid, priv->essid, priv->essid_len)); scan->direct_scan[0 ].id =WLAN_EID_SSID ; scan->direct_scan[0 ].len = priv->essid_len;memcpy (scan->direct_scan[0 ].ssid, priv->essid, priv->essid_len);
drivers/net/wireless/iwlwifi/iwl3945-base.c +6 -3
@@ -6063,6 +6063,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)struct ieee80211_conf *conf =NULL ;u8 n_probes =2 ;enum ieee80211_band band; +DECLARE_SSID_BUF (ssid); conf =ieee80211_get_hw_conf (priv->hw);
@@ -6163,7 +6164,8 @@ static void iwl3945_bg_request_scan(struct work_struct *data)if (priv->one_direct_scan) {IWL_DEBUG_SCAN ("Kicking off one direct scan for '%s'\n" , -escape_ssid (priv->direct_ssid, priv->direct_ssid_len)); +print_ssid (ssid, priv->direct_ssid, + priv->direct_ssid_len)); scan->direct_scan[0 ].id =WLAN_EID_SSID ; scan->direct_scan[0 ].len = priv->direct_ssid_len; memcpy(scan->direct_scan[0].ssid,
@@ -6172,7 +6174,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) }else if (!iwl3945_is_associated (priv) && priv->essid_len) {IWL_DEBUG_SCAN ("Kicking off one direct scan for '%s' when not associated\n" , -escape_ssid (priv->essid, priv->essid_len)); +print_ssid (ssid, priv->essid, priv->essid_len)); scan->direct_scan[0 ].id =WLAN_EID_SSID ; scan->direct_scan[0 ].len = priv->essid_len;memcpy (scan->direct_scan[0 ].ssid, priv->essid, priv->essid_len);
@@ -6958,6 +6960,7 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)int rc =0 ;unsigned long flags;struct iwl3945_priv *priv = hw->priv; +DECLARE_SSID_BUF (ssid_buf);IWL_DEBUG_MAC80211 ("enter\n" );
@@ -6991,7 +6994,7 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) }if (len) {IWL_DEBUG_SCAN ("direct scan for %s [%d]\n " , -escape_ssid (ssid, len), (int )len); +print_ssid (ssid_buf, ssid, len), (int )len); priv->one_direct_scan =1 ; priv->direct_ssid_len = (u8)
drivers/net/wireless/libertas/assoc.c +11 -6
@@ -154,17 +154,18 @@ static int lbs_adhoc_join(struct lbs_private *priv,struct bss_descriptor *bss = &assoc_req->bss;u8 preamble =RADIO_PREAMBLE_LONG ;DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid);u16 ratesize =0 ;int ret =0 ;lbs_deb_enter (LBS_DEB_ASSOC );lbs_deb_join ("current SSID '%s', ssid length %u\n" , -escape_ssid (priv->curbssparams.ssid, +print_ssid (ssid, priv->curbssparams.ssid, priv->curbssparams.ssid_len), priv->curbssparams.ssid_len);lbs_deb_join ("requested ssid '%s', ssid length %u\n" , -escape_ssid (bss->ssid, bss->ssid_len), +print_ssid (ssid, bss->ssid, bss->ssid_len), bss->ssid_len);/* check if the requested SSID is already joined */
@@ -309,6 +310,7 @@ static int lbs_adhoc_start(struct lbs_private *priv,size_t ratesize =0 ;u16 tmpcap =0 ;int ret =0 ; +DECLARE_SSID_BUF (ssid);lbs_deb_enter (LBS_DEB_ASSOC );
@@ -328,7 +330,7 @@ static int lbs_adhoc_start(struct lbs_private *priv,memcpy (cmd.ssid, assoc_req->ssid, assoc_req->ssid_len);lbs_deb_join ("ADHOC_START: SSID '%s', ssid length %u\n" , -escape_ssid (assoc_req->ssid, assoc_req->ssid_len), +print_ssid (ssid, assoc_req->ssid, assoc_req->ssid_len), assoc_req->ssid_len); cmd.bsstype =CMD_BSS_TYPE_IBSS ;
@@ -696,6 +698,7 @@ static int assoc_helper_essid(struct lbs_private *priv,int ret =0 ;struct bss_descriptor * bss;int channel =-1 ; +DECLARE_SSID_BUF (ssid);lbs_deb_enter (LBS_DEB_ASSOC );
@@ -707,7 +710,7 @@ static int assoc_helper_essid(struct lbs_private *priv, channel = assoc_req->channel;lbs_deb_assoc ("SSID '%s' requested\n" , -escape_ssid (assoc_req->ssid, assoc_req->ssid_len)); +print_ssid (ssid, assoc_req->ssid, assoc_req->ssid_len));if (assoc_req->mode ==IW_MODE_INFRA ) {lbs_send_specific_ssid_scan (priv, assoc_req->ssid, assoc_req->ssid_len);
@@ -1211,6 +1214,7 @@ void lbs_association_worker(struct work_struct *work)int ret =0 ;int find_any_ssid =0 ;DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid);lbs_deb_enter (LBS_DEB_ASSOC );
@@ -1234,7 +1238,7 @@ void lbs_association_worker(struct work_struct *work)" secinfo: %s%s%s\n" " auth_mode: %d\n" , assoc_req->flags, -escape_ssid (assoc_req->ssid, assoc_req->ssid_len), +print_ssid (ssid, assoc_req->ssid, assoc_req->ssid_len), assoc_req->channel, assoc_req->band, assoc_req->mode,print_mac (mac, assoc_req->bssid), assoc_req->secinfo.WPAenabled ? " WPA" : "",
@@ -1773,6 +1777,7 @@ static int lbs_adhoc_post(struct lbs_private *priv, struct cmd_header *resp)union iwreq_data wrqu;struct bss_descriptor *bss;DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid);lbs_deb_enter (LBS_DEB_JOIN );
@@ -1822,7 +1827,7 @@ static int lbs_adhoc_post(struct lbs_private *priv, struct cmd_header *resp)wireless_send_event (priv->dev,SIOCGIWAP , &wrqu,NULL );lbs_deb_join ("ADHOC_RESP: Joined/started '%s', BSSID %s, channel %d\n" , -escape_ssid (bss->ssid, bss->ssid_len), +print_ssid (ssid, bss->ssid, bss->ssid_len),print_mac (mac, priv->curbssparams.bssid), priv->curbssparams.channel);
drivers/net/wireless/libertas/cmd.c +2 -1
@@ -1062,6 +1062,7 @@ int lbs_mesh_config(struct lbs_private *priv, uint16_t action, uint16_t chan) {struct cmd_ds_mesh_config cmd;struct mrvl_meshie *ie; +DECLARE_SSID_BUF (ssid);memset (&cmd,0 ,sizeof (cmd)); cmd.channel =cpu_to_le16 (chan);
@@ -1092,7 +1093,7 @@ int lbs_mesh_config(struct lbs_private *priv, uint16_t action, uint16_t chan) }lbs_deb_cmd ("mesh config action %d type %x channel %d SSID %s\n" , action, priv->mesh_tlv, chan, -escape_ssid (priv->mesh_ssid, priv->mesh_ssid_len)); +print_ssid (ssid, priv->mesh_ssid, priv->mesh_ssid_len));return __lbs_mesh_config_send (priv, &cmd, action, priv->mesh_tlv); }
drivers/net/wireless/libertas/debugfs.c +3 -1
@@ -67,6 +67,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,unsigned long addr =get_zeroed_page (GFP_KERNEL );char *buf = (char *)addr;DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid);struct bss_descriptor * iter_bss; pos += snprintf(buf+pos, len-pos,
@@ -88,7 +89,8 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf, spectrum_mgmt ? 'S' : ' '); pos +=snprintf (buf+pos, len-pos," %04d |" ,SCAN_RSSI (iter_bss->rssi)); pos +=snprintf (buf+pos, len-pos," %s\n" , -escape_ssid (iter_bss->ssid, iter_bss->ssid_len)); +print_ssid (ssid, iter_bss->ssid, + iter_bss->ssid_len)); numscansdone++; }
drivers/net/wireless/libertas/scan.c +8 -4
@@ -363,6 +363,7 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan)struct bss_descriptor *iter;int i =0 ;DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid);#endif lbs_deb_enter_args (LBS_DEB_SCAN ,"full_scan %d" , full_scan);
@@ -456,7 +457,7 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan)list_for_each_entry (iter, &priv->network_list, list)lbs_deb_scan ("%02d: BSSID %s, RSSI %d, SSID '%s'\n" , i++,print_mac (mac, iter->bssid), iter->rssi, -escape_ssid (iter->ssid, iter->ssid_len)); +print_ssid (ssid, iter->ssid, iter->ssid_len));mutex_unlock (&priv->lock);#endif
@@ -516,6 +517,7 @@ static int lbs_process_bss(struct bss_descriptor *bss,struct ieeetypes_cfparamset *pCF;struct ieeetypes_ibssparamset *pibss;DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid);struct ieeetypes_countryinfoset *pcountryinfo;uint8_t *pos, *end, *p;uint8_t n_ex_rates =0 , got_basic_rates =0 , n_basic_rates =0 ;
@@ -604,7 +606,7 @@ static int lbs_process_bss(struct bss_descriptor *bss, bss->ssid_len = elem->len;memcpy (bss->ssid, elem->data, elem->len);lbs_deb_scan ("got SSID IE: '%s', len %u\n" , -escape_ssid (bss->ssid, bss->ssid_len), +print_ssid (ssid, bss->ssid, bss->ssid_len), bss->ssid_len);break ;
@@ -744,10 +746,11 @@ done:int lbs_send_specific_ssid_scan (struct lbs_private *priv,uint8_t *ssid,uint8_t ssid_len) { +DECLARE_SSID_BUF (ssid_buf);int ret =0 ;lbs_deb_enter_args (LBS_DEB_SCAN ,"SSID '%s'\n" , -escape_ssid (ssid, ssid_len)); +print_ssid (ssid_buf, ssid, ssid_len));if (!ssid_len) goto out;
@@ -942,6 +945,7 @@ out:int lbs_set_scan (struct net_device *dev,struct iw_request_info *info,union iwreq_data *wrqu,char *extra) { +DECLARE_SSID_BUF (ssid);struct lbs_private *priv = dev->priv;int ret =0 ;
@@ -971,7 +975,7 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, priv->scan_ssid_len = req->essid_len;memcpy (priv->scan_ssid, req->essid, priv->scan_ssid_len);lbs_deb_wext ("set_scan, essid '%s'\n" , -escape_ssid (priv->scan_ssid, priv->scan_ssid_len)); +print_ssid (ssid, priv->scan_ssid, priv->scan_ssid_len)); }else { priv->scan_ssid_len =0 ; }
drivers/net/wireless/libertas/wext.c +2 -1
@@ -1978,6 +1978,7 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,u8 ssid_len =0 ;struct assoc_request * assoc_req;int in_ssid_len = dwrq->length; +DECLARE_SSID_BUF (ssid_buf);lbs_deb_enter (LBS_DEB_WEXT );
@@ -2006,7 +2007,7 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,lbs_deb_wext ("requested any SSID\n" ); }else {lbs_deb_wext ("requested SSID '%s'\n" , -escape_ssid (ssid, ssid_len)); +print_ssid (ssid_buf, ssid, ssid_len)); } out:
include/linux/ieee80211.h +3 -3
@@ -12,8 +12,8 @@* published by the Free Software Foundation. */ -#ifndef IEEE80211_H -#define IEEE80211_H +#ifndef LINUX_IEEE80211_H +#define LINUX_IEEE80211_H #include <linux/types.h> #include <asm/byteorder.h>
@@ -1057,4 +1057,4 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) return hdr->addr1; } -#endif /* IEEE80211_H */ +#endif /* LINUX_IEEE80211_H */
include/net/lib80211.h +3 -2
@@ -8,8 +8,9 @@#ifndef LIB80211_H #define LIB80211_H -/* escape_ssid() is intended to be used in debug (and possibly error) +/* print_ssid() is intended to be used in debug (and possibly error) * messages. It should never be used for passing ssid to user space. */ -const char *escape_ssid (const char *ssid,u8 ssid_len); +const char *print_ssid (char *buf,const char *ssid,u8 ssid_len); +#define DECLARE_SSID_BUF (var) char var[32 * 4 + 1]#endif /* LIB80211_H */
net/ieee80211/ieee80211_rx.c +11 -7
@@ -1145,6 +1145,7 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element *info_element, u16 length, struct ieee80211_network *network) { +DECLARE_SSID_BUF (ssid);u8 i;#ifdef CONFIG_IEEE80211_DEBUG char rates_str[64 ];
@@ -1176,7 +1177,8 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element IW_ESSID_MAX_SIZE - network->ssid_len);IEEE80211_DEBUG_MGMT ("MFIE_TYPE_SSID: '%s' len=%d.\n" , -escape_ssid (network->ssid), + print_ssid(ssid, network->ssid, + network->ssid_len); network->ssid_len);break ;
@@ -1423,6 +1425,7 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021 struct ieee80211_rx_stats *stats) {DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid); network->qos_data.active =0 ; network->qos_data.supported =0 ;
@@ -1472,7 +1475,7 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021if (network->mode ==0 ) {IEEE80211_DEBUG_SCAN ("Filtered out '%s (%s)' " "network.\n" , -escape_ssid (network->ssid, +print_ssid (ssid, network->ssid, network->ssid_len),print_mac (mac, network->bssid));return 1 ;
@@ -1588,10 +1591,11 @@ static void ieee80211_process_probe_response(struct ieee80211_device#endif unsigned long flags;DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid); IEEE80211_DEBUG_SCAN("'%s' (%s" "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", - escape_ssid(info_element->data, info_element->len), + print_ssid(ssid, info_element->data, info_element->len), print_mac(mac, beacon->header.addr3), (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0', (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0',
@@ -1612,7 +1616,7 @@ static void ieee80211_process_probe_response(struct ieee80211_deviceif (ieee80211_network_init (ieee, beacon, &network, stats)) { IEEE80211_DEBUG_SCAN("Dropped '%s' (%s) via %s.\n", - escape_ssid(info_element->data, + print_ssid(ssid, info_element->data, info_element->len), print_mac(mac, beacon->header.addr3), is_beacon(beacon->header.frame_ctl) ?
@@ -1650,7 +1654,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device target = oldest;IEEE80211_DEBUG_SCAN ("Expired '%s' (%s) from " "network list.\n" , -escape_ssid (target->ssid, +print_ssid (ssid, target->ssid, target->ssid_len),print_mac (mac, target->bssid));ieee80211_network_reset (target);
@@ -1663,7 +1667,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device#ifdef CONFIG_IEEE80211_DEBUG IEEE80211_DEBUG_SCAN("Adding '%s' (%s) via %s.\n", - escape_ssid(network.ssid, + print_ssid(ssid, network.ssid, network.ssid_len), print_mac(mac, network.bssid), is_beacon(beacon->header.frame_ctl) ?
@@ -1674,7 +1678,7 @@ static void ieee80211_process_probe_response(struct ieee80211_devicelist_add_tail (&target->list, &ieee->network_list); }else { IEEE80211_DEBUG_SCAN("Updating '%s' (%s) via %s.\n", - escape_ssid(target->ssid, + print_ssid(ssid, target->ssid, target->ssid_len), print_mac(mac, target->bssid), is_beacon(beacon->header.frame_ctl) ?
net/ieee80211/ieee80211_wx.c +4 -2
@@ -34,6 +34,7 @@#include <linux/module.h> #include <linux/jiffies.h> +#include <net/lib80211.h> #include <net/ieee80211.h> #include <linux/wireless.h>
@@ -259,6 +260,7 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,char *stop = ev + wrqu->data.length;int i =0 ;DECLARE_MAC_BUF (mac); +DECLARE_SSID_BUF (ssid);IEEE80211_DEBUG_WX ("Getting scan\n" );
@@ -278,7 +280,7 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,else IEEE80211_DEBUG_SCAN("Not showing network '%s (" "%s)' due to age (%dms).\n", - escape_ssid(network->ssid, + print_ssid(ssid, network->ssid, network->ssid_len), print_mac(mac, network->bssid), jiffies_to_msecs(jiffies -
@@ -403,7 +405,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,memset (sec.keys[key] + erq->length,0 , len - erq->length);IEEE80211_DEBUG_WX ("Setting key %d to '%s' (%d:%d bytes)\n" , - key,escape_ssid (sec.keys[key], len), + key,print_ssid (ssid, sec.keys[key], len), erq->length, len); sec.key_sizes[key] = len;if (*crypt)
net/wireless/lib80211.c +4 -5
@@ -19,11 +19,10 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION);MODULE_AUTHOR ("John W. Linville <[email protected]>" );MODULE_LICENSE ("GPL" ); -const char *escape_ssid (const char *ssid,u8 ssid_len) +const char *print_ssid (char *buf,const char *ssid,u8 ssid_len) { -static char escaped[IEEE80211_MAX_SSID_LEN *4 +1 ];const char *s = ssid; -char *d = escaped; +char *d = buf; ssid_len =min_t (u8, ssid_len,IEEE80211_MAX_SSID_LEN );while (ssid_len--) {
@@ -48,9 +47,9 @@ const char *escape_ssid(const char *ssid, u8 ssid_len) s++; } *d ='\0' ; -return escaped; +return buf; } -EXPORT_SYMBOL (escape_ssid); +EXPORT_SYMBOL (print_ssid);static int __init ieee80211_init (void ) {
Signature · 1 line
1.5.4.3
PATCH 5/5 wireless: avoid some net/ieee80211.h vs. linux/ieee80211.h conflicts
There is quite a lot of overlap in definitions between these headers...
--- drivers/net/wireless/hostap/hostap_common.h | 13 --- drivers/net/wireless/ipw2200.c | 24 +++--- include/net/ieee80211.h | 112 +-------------------------- include/net/lib80211.h | 4 +- net/ieee80211/ieee80211_rx.c | 2 +- 5 files changed, 18 insertions(+), 137 deletions(-)
drivers/net/wireless/hostap/hostap_common.h +0 -13
@@ -6,19 +6,6 @@/* IEEE 802.11 defines */ -/* Information Element IDs */ -#define WLAN_EID_SSID 0 -#define WLAN_EID_SUPP_RATES 1 -#define WLAN_EID_FH_PARAMS 2 -#define WLAN_EID_DS_PARAMS 3 -#define WLAN_EID_CF_PARAMS 4 -#define WLAN_EID_TIM 5 -#define WLAN_EID_IBSS_PARAMS 6 -#define WLAN_EID_CHALLENGE 16 -#define WLAN_EID_RSN 48 -#define WLAN_EID_GENERIC 221 - -/* HFA384X Configuration RIDs */ #define HFA384X_RID_CNFPORTTYPE 0xFC00#define HFA384X_RID_CNFOWNMACADDR 0xFC01
drivers/net/wireless/ipw2200.c +12 -12
@@ -4450,7 +4450,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,#ifdef CONFIG_IPW2200_QOS #define IPW_GET_PACKET_STYPE (x) WLAN_FC_GET_STYPE( \ - le16_to_cpu(((struct ieee80211_hdr *)(x))->frame_ctl)) + le16_to_cpu(((struct ieee80211_hdr *)(x))->frame_control))if ((priv->status &STATUS_AUTH ) && (IPW_GET_PACKET_STYPE (¬if->u.raw) ==IEEE80211_STYPE_ASSOC_RESP )) {
@@ -7678,12 +7678,12 @@ static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv,u16 fc; hdr = (struct ieee80211_hdr *)skb->data; - fc =le16_to_cpu (hdr->frame_ctl); + fc =le16_to_cpu (hdr->frame_control);if (!(fc &IEEE80211_FCTL_PROTECTED ))return ; fc &= ~IEEE80211_FCTL_PROTECTED ; - hdr->frame_ctl =cpu_to_le16 (fc); + hdr->frame_control =cpu_to_le16 (fc);switch (priv->ieee->sec.level) {case SEC_LEVEL_3 :/* Remove CCMP HDR */
@@ -7995,17 +7995,17 @@ static void ipw_handle_promiscuous_rx(struct ipw_priv *priv, } hdr = (void *)rxb->skb->data +IPW_RX_FRAME_SIZE ; -if (ieee80211_is_management (le16_to_cpu (hdr->frame_ctl))) { +if (ieee80211_is_management (le16_to_cpu (hdr->frame_control))) {if (filter &IPW_PROM_NO_MGMT )return ;if (filter &IPW_PROM_MGMT_HEADER_ONLY ) hdr_only =1 ; - }else if (ieee80211_is_control (le16_to_cpu (hdr->frame_ctl))) { + }else if (ieee80211_is_control (le16_to_cpu (hdr->frame_control))) {if (filter &IPW_PROM_NO_CTL )return ;if (filter &IPW_PROM_CTL_HEADER_ONLY ) hdr_only =1 ; - }else if (ieee80211_is_data (le16_to_cpu (hdr->frame_ctl))) { + }else if (ieee80211_is_data (le16_to_cpu (hdr->frame_control))) {if (filter &IPW_PROM_NO_DATA )return ;if (filter &IPW_PROM_DATA_HEADER_ONLY )
@@ -8023,7 +8023,7 @@ static void ipw_handle_promiscuous_rx(struct ipw_priv *priv, ipw_rt = (void *)skb->data;if (hdr_only) - len =ieee80211_get_hdrlen (le16_to_cpu (hdr->frame_ctl)); + len =ieee80211_get_hdrlen (le16_to_cpu (hdr->frame_control));memcpy (ipw_rt->payload, hdr, len);
@@ -8243,7 +8243,7 @@ static int is_duplicate_packet(struct ipw_priv *priv,/* Comment this line now since we observed the card receives * duplicate packets but the FCTL_RETRY bit is not set in the * IBSS mode with fragmentation enabled. -BUG_ON(!(le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_RETRY)); */ +BUG_ON(!(le16_to_cpu(header->frame_control) & IEEE80211_FCTL_RETRY)); */ return 1 ; }
@@ -10407,17 +10407,17 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,/* Filtering of fragment chains is done agains the first fragment */ hdr = (void *)txb->fragments[0 ]->data; -if (ieee80211_is_management (le16_to_cpu (hdr->frame_ctl))) { +if (ieee80211_is_management (le16_to_cpu (hdr->frame_control))) {if (filter &IPW_PROM_NO_MGMT )return ;if (filter &IPW_PROM_MGMT_HEADER_ONLY ) hdr_only =1 ; - }else if (ieee80211_is_control (le16_to_cpu (hdr->frame_ctl))) { + }else if (ieee80211_is_control (le16_to_cpu (hdr->frame_control))) {if (filter &IPW_PROM_NO_CTL )return ;if (filter &IPW_PROM_CTL_HEADER_ONLY ) hdr_only =1 ; - }else if (ieee80211_is_data (le16_to_cpu (hdr->frame_ctl))) { + }else if (ieee80211_is_data (le16_to_cpu (hdr->frame_control))) {if (filter &IPW_PROM_NO_DATA )return ;if (filter &IPW_PROM_DATA_HEADER_ONLY )
@@ -10432,7 +10432,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,if (hdr_only) { hdr = (void *)src->data; - len =ieee80211_get_hdrlen (le16_to_cpu (hdr->frame_ctl)); + len =ieee80211_get_hdrlen (le16_to_cpu (hdr->frame_control)); }else len = src->len;
include/net/ieee80211.h +2 -110
142 lines not on this page · raw message
include/net/lib80211.h +3 -1
@@ -8,9 +8,11 @@#ifndef LIB80211_H #define LIB80211_H +#include <linux/ieee80211.h> +/* print_ssid() is intended to be used in debug (and possibly error) * messages. It should never be used for passing ssid to user space. */ const char *print_ssid (char *buf,const char *ssid,u8 ssid_len); -#define DECLARE_SSID_BUF (var) char var[32 * 4 + 1] +#define DECLARE_SSID_BUF (var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused#endif /* LIB80211_H */
net/ieee80211/ieee80211_rx.c +1 -1
@@ -40,7 +40,7 @@ static void ieee80211_monitor_rx(struct ieee80211_device *ieee, struct ieee80211_rx_stats *rx_stats) {struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -u16 fc =le16_to_cpu (hdr->frame_ctl); +u16 fc =le16_to_cpu (hdr->frame_control); skb->dev = ieee->dev;skb_reset_mac_header (skb);
Signature · 1 line
1.5.4.3
Johannes Berg
maintainerRe: [PATCH 0/5] wireless: single escape_essid implementation and related cleanups
In reply to John W. LinvilleQuoted 5 lines · John W. Linville
This is a repost of my
escape_essidconsolidation. Also included are some suggested changes from the original post and a few cleanups. There is still plenty to be done -- of course, this isn't really high priority work either...
Quoted 7 lines
[PATCH 1/5] wireless: consolidate on a single
escape_essidimplementation [PATCH 2/5] wireless: removeNETWORK_EMPTY_ESSIDflag
[PATCH 3/5] wireless:escape_ssidshould handle non-printables [PATCH 4/5] wireless: use individual buffers for printing ssid values [PATCH 5/5] wireless: avoid somenet/ieee80211.hvs.linux/ieee80211.hconflictsComments welcome!
Looks good to me, thanks!
johannes
Re: [PATCH 0/5] wireless: single escape_essid implementation and related cleanups
In reply to John W. LinvilleQuoted 5 lines · John W. Linville
This is a repost of my
escape_essidconsolidation. Also included are some suggested changes from the original post and a few cleanups. There is still plenty to be done -- of course, this isn't really high priority work either...
Quoted 7 lines
[PATCH 1/5] wireless: consolidate on a single
escape_essidimplementation [PATCH 2/5] wireless: removeNETWORK_EMPTY_ESSIDflag
[PATCH 3/5] wireless:escape_ssidshould handle non-printables [PATCH 4/5] wireless: use individual buffers for printing ssid values [PATCH 5/5] wireless: avoid somenet/ieee80211.hvs.linux/ieee80211.hconflictsComments welcome!
I like it! Though for ipw2200, the bits of code that check NETWORK_EMPTY_SSID before associating might still be valid? You can't really associate with a network (or start an adhoc network) unless you know the SSID, right?
Dan