diff options
-rw-r--r-- | include/net/ieee80211.h | 37 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_module.c | 26 |
2 files changed, 38 insertions, 25 deletions
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 51a20b5f3b5d..185423c6d22e 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -167,8 +167,19 @@ do { if (ieee80211_debug_level & (level)) \ | |||
167 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) | 167 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) |
168 | #endif /* CONFIG_IEEE80211_DEBUG */ | 168 | #endif /* CONFIG_IEEE80211_DEBUG */ |
169 | 169 | ||
170 | |||
171 | /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ | ||
172 | |||
173 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | ||
174 | #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] | ||
175 | |||
176 | /* escape_essid() is intended to be used in debug (and possibly error) | ||
177 | * messages. It should never be used for passing essid to user space. */ | ||
178 | const char *escape_essid(const char *essid, u8 essid_len); | ||
179 | |||
180 | |||
170 | /* | 181 | /* |
171 | * To use the debug system; | 182 | * To use the debug system: |
172 | * | 183 | * |
173 | * If you are defining a new debug classification, simply add it to the #define | 184 | * If you are defining a new debug classification, simply add it to the #define |
174 | * list here in the form of: | 185 | * list here in the form of: |
@@ -622,8 +633,6 @@ enum ieee80211_state { | |||
622 | 633 | ||
623 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) | 634 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) |
624 | #define DEFAULT_FTS 2346 | 635 | #define DEFAULT_FTS 2346 |
625 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | ||
626 | #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] | ||
627 | 636 | ||
628 | 637 | ||
629 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) | 638 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) |
@@ -827,27 +836,5 @@ extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) | |||
827 | return ieee->scans; | 836 | return ieee->scans; |
828 | } | 837 | } |
829 | 838 | ||
830 | static inline const char *escape_essid(const char *essid, u8 essid_len) { | ||
831 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
832 | const char *s = essid; | ||
833 | char *d = escaped; | ||
834 | |||
835 | if (ieee80211_is_empty_essid(essid, essid_len)) { | ||
836 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | ||
837 | return escaped; | ||
838 | } | ||
839 | 839 | ||
840 | essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); | ||
841 | while (essid_len--) { | ||
842 | if (*s == '\0') { | ||
843 | *d++ = '\\'; | ||
844 | *d++ = '0'; | ||
845 | s++; | ||
846 | } else { | ||
847 | *d++ = *s++; | ||
848 | } | ||
849 | } | ||
850 | *d = '\0'; | ||
851 | return escaped; | ||
852 | } | ||
853 | #endif /* IEEE80211_H */ | 840 | #endif /* IEEE80211_H */ |
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c index e0802b8755a0..553acb2e93d5 100644 --- a/net/ieee80211/ieee80211_module.c +++ b/net/ieee80211/ieee80211_module.c | |||
@@ -269,5 +269,31 @@ module_exit(ieee80211_exit); | |||
269 | module_init(ieee80211_init); | 269 | module_init(ieee80211_init); |
270 | #endif | 270 | #endif |
271 | 271 | ||
272 | |||
273 | const char *escape_essid(const char *essid, u8 essid_len) { | ||
274 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
275 | const char *s = essid; | ||
276 | char *d = escaped; | ||
277 | |||
278 | if (ieee80211_is_empty_essid(essid, essid_len)) { | ||
279 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | ||
280 | return escaped; | ||
281 | } | ||
282 | |||
283 | essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); | ||
284 | while (essid_len--) { | ||
285 | if (*s == '\0') { | ||
286 | *d++ = '\\'; | ||
287 | *d++ = '0'; | ||
288 | s++; | ||
289 | } else { | ||
290 | *d++ = *s++; | ||
291 | } | ||
292 | } | ||
293 | *d = '\0'; | ||
294 | return escaped; | ||
295 | } | ||
296 | |||
272 | EXPORT_SYMBOL(alloc_ieee80211); | 297 | EXPORT_SYMBOL(alloc_ieee80211); |
273 | EXPORT_SYMBOL(free_ieee80211); | 298 | EXPORT_SYMBOL(free_ieee80211); |
299 | EXPORT_SYMBOL(escape_essid); | ||