diff options
author | Joe Perches <joe@perches.com> | 2007-10-03 20:59:30 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:42 -0400 |
commit | 0795af5729b18218767fab27c44b1384f72dc9ad (patch) | |
tree | 67c16df84aa6ec219340b8ea1b5cfb0e8150a216 /drivers/net/wireless/prism54 | |
parent | 95ea36275f3c9a1d3d04c217b4b576c657c4e70e (diff) |
[NET]: Introduce and use print_mac() and DECLARE_MAC_BUF()
This is nicer than the MAC_FMT stuff.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/prism54')
-rw-r--r-- | drivers/net/wireless/prism54/isl_ioctl.c | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 77ea13bf0c02..6d80ca421cf0 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -2029,12 +2029,12 @@ static void | |||
2029 | format_event(islpci_private *priv, char *dest, const char *str, | 2029 | format_event(islpci_private *priv, char *dest, const char *str, |
2030 | const struct obj_mlme *mlme, u16 *length, int error) | 2030 | const struct obj_mlme *mlme, u16 *length, int error) |
2031 | { | 2031 | { |
2032 | const u8 *a = mlme->address; | 2032 | DECLARE_MAC_BUF(mac); |
2033 | int n = snprintf(dest, IW_CUSTOM_MAX, | 2033 | int n = snprintf(dest, IW_CUSTOM_MAX, |
2034 | "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s (%2.2X)", | 2034 | "%s %s %s %s (%2.2X)", |
2035 | str, | 2035 | str, |
2036 | ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"), | 2036 | ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"), |
2037 | a[0], a[1], a[2], a[3], a[4], a[5], | 2037 | print_mac(mac, mlme->address), |
2038 | (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ") | 2038 | (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ") |
2039 | : ""), mlme->code); | 2039 | : ""), mlme->code); |
2040 | BUG_ON(n > IW_CUSTOM_MAX); | 2040 | BUG_ON(n > IW_CUSTOM_MAX); |
@@ -2105,15 +2105,13 @@ struct ieee80211_beacon_phdr { | |||
2105 | #define WLAN_EID_GENERIC 0xdd | 2105 | #define WLAN_EID_GENERIC 0xdd |
2106 | static u8 wpa_oid[4] = { 0x00, 0x50, 0xf2, 1 }; | 2106 | static u8 wpa_oid[4] = { 0x00, 0x50, 0xf2, 1 }; |
2107 | 2107 | ||
2108 | #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] | ||
2109 | #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" | ||
2110 | |||
2111 | static void | 2108 | static void |
2112 | prism54_wpa_bss_ie_add(islpci_private *priv, u8 *bssid, | 2109 | prism54_wpa_bss_ie_add(islpci_private *priv, u8 *bssid, |
2113 | u8 *wpa_ie, size_t wpa_ie_len) | 2110 | u8 *wpa_ie, size_t wpa_ie_len) |
2114 | { | 2111 | { |
2115 | struct list_head *ptr; | 2112 | struct list_head *ptr; |
2116 | struct islpci_bss_wpa_ie *bss = NULL; | 2113 | struct islpci_bss_wpa_ie *bss = NULL; |
2114 | DECLARE_MAC_BUF(mac); | ||
2117 | 2115 | ||
2118 | if (wpa_ie_len > MAX_WPA_IE_LEN) | 2116 | if (wpa_ie_len > MAX_WPA_IE_LEN) |
2119 | wpa_ie_len = MAX_WPA_IE_LEN; | 2117 | wpa_ie_len = MAX_WPA_IE_LEN; |
@@ -2154,8 +2152,8 @@ prism54_wpa_bss_ie_add(islpci_private *priv, u8 *bssid, | |||
2154 | bss->wpa_ie_len = wpa_ie_len; | 2152 | bss->wpa_ie_len = wpa_ie_len; |
2155 | bss->last_update = jiffies; | 2153 | bss->last_update = jiffies; |
2156 | } else { | 2154 | } else { |
2157 | printk(KERN_DEBUG "Failed to add BSS WPA entry for " MACSTR | 2155 | printk(KERN_DEBUG "Failed to add BSS WPA entry for " |
2158 | "\n", MAC2STR(bssid)); | 2156 | "%s\n", print_mac(mac, bssid)); |
2159 | } | 2157 | } |
2160 | 2158 | ||
2161 | /* expire old entries from WPA list */ | 2159 | /* expire old entries from WPA list */ |
@@ -2221,6 +2219,7 @@ prism54_process_bss_data(islpci_private *priv, u32 oid, u8 *addr, | |||
2221 | { | 2219 | { |
2222 | struct ieee80211_beacon_phdr *hdr; | 2220 | struct ieee80211_beacon_phdr *hdr; |
2223 | u8 *pos, *end; | 2221 | u8 *pos, *end; |
2222 | DECLARE_MAC_BUF(mac); | ||
2224 | 2223 | ||
2225 | if (!priv->wpa) | 2224 | if (!priv->wpa) |
2226 | return; | 2225 | return; |
@@ -2231,7 +2230,7 @@ prism54_process_bss_data(islpci_private *priv, u32 oid, u8 *addr, | |||
2231 | while (pos < end) { | 2230 | while (pos < end) { |
2232 | if (pos + 2 + pos[1] > end) { | 2231 | if (pos + 2 + pos[1] > end) { |
2233 | printk(KERN_DEBUG "Parsing Beacon/ProbeResp failed " | 2232 | printk(KERN_DEBUG "Parsing Beacon/ProbeResp failed " |
2234 | "for " MACSTR "\n", MAC2STR(addr)); | 2233 | "for %s\n", print_mac(mac, addr)); |
2235 | return; | 2234 | return; |
2236 | } | 2235 | } |
2237 | if (pos[0] == WLAN_EID_GENERIC && pos[1] >= 4 && | 2236 | if (pos[0] == WLAN_EID_GENERIC && pos[1] >= 4 && |
@@ -2270,6 +2269,7 @@ prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid, | |||
2270 | size_t len = 0; /* u16, better? */ | 2269 | size_t len = 0; /* u16, better? */ |
2271 | u8 *payload = NULL, *pos = NULL; | 2270 | u8 *payload = NULL, *pos = NULL; |
2272 | int ret; | 2271 | int ret; |
2272 | DECLARE_MAC_BUF(mac); | ||
2273 | 2273 | ||
2274 | /* I think all trapable objects are listed here. | 2274 | /* I think all trapable objects are listed here. |
2275 | * Some oids have a EX version. The difference is that they are emitted | 2275 | * Some oids have a EX version. The difference is that they are emitted |
@@ -2358,14 +2358,8 @@ prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid, | |||
2358 | break; | 2358 | break; |
2359 | 2359 | ||
2360 | memcpy(&confirm->address, mlmeex->address, ETH_ALEN); | 2360 | memcpy(&confirm->address, mlmeex->address, ETH_ALEN); |
2361 | printk(KERN_DEBUG "Authenticate from: address:\t%02x:%02x:%02x:%02x:%02x:%02x\n", | 2361 | printk(KERN_DEBUG "Authenticate from: address:\t%s\n", |
2362 | mlmeex->address[0], | 2362 | print_mac(mac, mlmeex->address)); |
2363 | mlmeex->address[1], | ||
2364 | mlmeex->address[2], | ||
2365 | mlmeex->address[3], | ||
2366 | mlmeex->address[4], | ||
2367 | mlmeex->address[5] | ||
2368 | ); | ||
2369 | confirm->id = -1; /* or mlmeex->id ? */ | 2363 | confirm->id = -1; /* or mlmeex->id ? */ |
2370 | confirm->state = 0; /* not used */ | 2364 | confirm->state = 0; /* not used */ |
2371 | confirm->code = 0; | 2365 | confirm->code = 0; |
@@ -2410,15 +2404,8 @@ prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid, | |||
2410 | wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); | 2404 | wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); |
2411 | 2405 | ||
2412 | if (!wpa_ie_len) { | 2406 | if (!wpa_ie_len) { |
2413 | printk(KERN_DEBUG "No WPA IE found from " | 2407 | printk(KERN_DEBUG "No WPA IE found from address:\t%s\n", |
2414 | "address:\t%02x:%02x:%02x:%02x:%02x:%02x\n", | 2408 | print_mac(mac, mlmeex->address)); |
2415 | mlmeex->address[0], | ||
2416 | mlmeex->address[1], | ||
2417 | mlmeex->address[2], | ||
2418 | mlmeex->address[3], | ||
2419 | mlmeex->address[4], | ||
2420 | mlmeex->address[5] | ||
2421 | ); | ||
2422 | kfree(confirm); | 2409 | kfree(confirm); |
2423 | break; | 2410 | break; |
2424 | } | 2411 | } |
@@ -2454,15 +2441,8 @@ prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid, | |||
2454 | wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); | 2441 | wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); |
2455 | 2442 | ||
2456 | if (!wpa_ie_len) { | 2443 | if (!wpa_ie_len) { |
2457 | printk(KERN_DEBUG "No WPA IE found from " | 2444 | printk(KERN_DEBUG "No WPA IE found from address:\t%s\n", |
2458 | "address:\t%02x:%02x:%02x:%02x:%02x:%02x\n", | 2445 | print_mac(mac, mlmeex->address)); |
2459 | mlmeex->address[0], | ||
2460 | mlmeex->address[1], | ||
2461 | mlmeex->address[2], | ||
2462 | mlmeex->address[3], | ||
2463 | mlmeex->address[4], | ||
2464 | mlmeex->address[5] | ||
2465 | ); | ||
2466 | kfree(confirm); | 2446 | kfree(confirm); |
2467 | break; | 2447 | break; |
2468 | } | 2448 | } |