[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>
This commit is contained in:
committed by
David S. Miller
parent
95ea36275f
commit
0795af5729
@@ -19,6 +19,7 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
|
||||
{
|
||||
struct ieee80211_hdr_4addr *hdr;
|
||||
u16 fc;
|
||||
DECLARE_MAC_BUF(mac);
|
||||
|
||||
hdr = (struct ieee80211_hdr_4addr *) skb->data;
|
||||
|
||||
@@ -44,10 +45,11 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb,
|
||||
printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id),
|
||||
le16_to_cpu(hdr->seq_ctl));
|
||||
|
||||
printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR,
|
||||
MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3));
|
||||
printk(KERN_DEBUG " A1=%s", print_mac(mac, hdr->addr1));
|
||||
printk(" A2=%s", print_mac(mac, hdr->addr2));
|
||||
printk(" A3=%s", print_mac(mac, hdr->addr3));
|
||||
if (skb->len >= 30)
|
||||
printk(" A4=" MACSTR, MAC2STR(hdr->addr4));
|
||||
printk(" A4=%s", print_mac(mac, hdr->addr4));
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
@@ -534,6 +536,7 @@ static int
|
||||
hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
|
||||
u16 fc, struct net_device **wds)
|
||||
{
|
||||
DECLARE_MAC_BUF(mac);
|
||||
/* FIX: is this really supposed to accept WDS frames only in Master
|
||||
* mode? What about Repeater or Managed with WDS frames? */
|
||||
if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) !=
|
||||
@@ -549,10 +552,10 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
|
||||
hdr->addr1[4] != 0xff || hdr->addr1[5] != 0xff)) {
|
||||
/* RA (or BSSID) is not ours - drop */
|
||||
PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with "
|
||||
"not own or broadcast %s=" MACSTR "\n",
|
||||
"not own or broadcast %s=%s\n",
|
||||
local->dev->name,
|
||||
fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID",
|
||||
MAC2STR(hdr->addr1));
|
||||
print_mac(mac, hdr->addr1));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -565,8 +568,8 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
|
||||
/* require that WDS link has been registered with TA or the
|
||||
* frame is from current AP when using 'AP client mode' */
|
||||
PDEBUG(DEBUG_EXTRA, "%s: received WDS[4 addr] frame "
|
||||
"from unknown TA=" MACSTR "\n",
|
||||
local->dev->name, MAC2STR(hdr->addr2));
|
||||
"from unknown TA=%s\n",
|
||||
local->dev->name, print_mac(mac, hdr->addr2));
|
||||
if (local->ap && local->ap->autom_ap_wds)
|
||||
hostap_wds_link_oper(local, hdr->addr2, WDS_ADD);
|
||||
return -1;
|
||||
@@ -632,6 +635,7 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
|
||||
{
|
||||
struct ieee80211_hdr_4addr *hdr;
|
||||
int res, hdrlen;
|
||||
DECLARE_MAC_BUF(mac);
|
||||
|
||||
if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
|
||||
return 0;
|
||||
@@ -643,8 +647,8 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
|
||||
strcmp(crypt->ops->name, "TKIP") == 0) {
|
||||
if (net_ratelimit()) {
|
||||
printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
|
||||
"received packet from " MACSTR "\n",
|
||||
local->dev->name, MAC2STR(hdr->addr2));
|
||||
"received packet from %s\n",
|
||||
local->dev->name, print_mac(mac, hdr->addr2));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -653,9 +657,9 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
|
||||
res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv);
|
||||
atomic_dec(&crypt->refcnt);
|
||||
if (res < 0) {
|
||||
printk(KERN_DEBUG "%s: decryption failed (SA=" MACSTR
|
||||
printk(KERN_DEBUG "%s: decryption failed (SA=%s"
|
||||
") res=%d\n",
|
||||
local->dev->name, MAC2STR(hdr->addr2), res);
|
||||
local->dev->name, print_mac(mac, hdr->addr2), res);
|
||||
local->comm_tallies.rx_discards_wep_undecryptable++;
|
||||
return -1;
|
||||
}
|
||||
@@ -671,6 +675,7 @@ hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb,
|
||||
{
|
||||
struct ieee80211_hdr_4addr *hdr;
|
||||
int res, hdrlen;
|
||||
DECLARE_MAC_BUF(mac);
|
||||
|
||||
if (crypt == NULL || crypt->ops->decrypt_msdu == NULL)
|
||||
return 0;
|
||||
@@ -683,8 +688,8 @@ hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb,
|
||||
atomic_dec(&crypt->refcnt);
|
||||
if (res < 0) {
|
||||
printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
|
||||
" (SA=" MACSTR " keyidx=%d)\n",
|
||||
local->dev->name, MAC2STR(hdr->addr2), keyidx);
|
||||
" (SA=%s keyidx=%d)\n",
|
||||
local->dev->name, print_mac(mac, hdr->addr2), keyidx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -716,6 +721,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
|
||||
struct ieee80211_crypt_data *crypt = NULL;
|
||||
void *sta = NULL;
|
||||
int keyidx = 0;
|
||||
DECLARE_MAC_BUF(mac);
|
||||
|
||||
iface = netdev_priv(dev);
|
||||
local = iface->local;
|
||||
@@ -792,8 +798,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
|
||||
* frames silently instead of filling system log with
|
||||
* these reports. */
|
||||
printk(KERN_DEBUG "%s: WEP decryption failed (not set)"
|
||||
" (SA=" MACSTR ")\n",
|
||||
local->dev->name, MAC2STR(hdr->addr2));
|
||||
" (SA=%s)\n",
|
||||
local->dev->name, print_mac(mac, hdr->addr2));
|
||||
#endif
|
||||
local->comm_tallies.rx_discards_wep_undecryptable++;
|
||||
goto rx_dropped;
|
||||
@@ -807,8 +813,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
|
||||
(keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
|
||||
{
|
||||
printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
|
||||
"from " MACSTR "\n", dev->name,
|
||||
MAC2STR(hdr->addr2));
|
||||
"from %s\n", dev->name,
|
||||
print_mac(mac, hdr->addr2));
|
||||
/* TODO: could inform hostapd about this so that it
|
||||
* could send auth failure report */
|
||||
goto rx_dropped;
|
||||
@@ -976,8 +982,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
|
||||
"unencrypted EAPOL frame\n", local->dev->name);
|
||||
} else {
|
||||
printk(KERN_DEBUG "%s: encryption configured, but RX "
|
||||
"frame not encrypted (SA=" MACSTR ")\n",
|
||||
local->dev->name, MAC2STR(hdr->addr2));
|
||||
"frame not encrypted (SA=%s)\n",
|
||||
local->dev->name, print_mac(mac, hdr->addr2));
|
||||
goto rx_dropped;
|
||||
}
|
||||
}
|
||||
@@ -986,8 +992,9 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
|
||||
!hostap_is_eapol_frame(local, skb)) {
|
||||
if (net_ratelimit()) {
|
||||
printk(KERN_DEBUG "%s: dropped unencrypted RX data "
|
||||
"frame from " MACSTR " (drop_unencrypted=1)\n",
|
||||
dev->name, MAC2STR(hdr->addr2));
|
||||
"frame from %s"
|
||||
" (drop_unencrypted=1)\n",
|
||||
dev->name, print_mac(mac, hdr->addr2));
|
||||
}
|
||||
goto rx_dropped;
|
||||
}
|
||||
|
Reference in New Issue
Block a user