aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-06-30 09:10:46 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-07-02 15:48:33 -0400
commitf4ea83dd743d3e1bec8fdf954ac911c6b12ae87a (patch)
tree2db594d668648779e1932981410e37258df76b2c /net/mac80211/rx.c
parent49461622edf74cd1e1a1056cee3ca8dd90cd9556 (diff)
mac80211: rework debug settings and make debugging safer
This patch reworks the mac80211 debug settings making them more focused and adding help text for those that didn't have one. It also removes a number of printks that can be triggered remotely and add no value, e.g. "too short deauthentication frame received - ignoring". If somebody really needs to debug that they should just add a monitor interface and look at the frames in wireshark. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c106
1 files changed, 12 insertions, 94 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 289112777e90..6a88e8f9bff0 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -613,11 +613,6 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
613 rx->key->tx_rx_count++; 613 rx->key->tx_rx_count++;
614 /* TODO: add threshold stuff again */ 614 /* TODO: add threshold stuff again */
615 } else { 615 } else {
616#ifdef CONFIG_MAC80211_DEBUG
617 if (net_ratelimit())
618 printk(KERN_DEBUG "%s: RX protected frame,"
619 " but have no key\n", rx->dev->name);
620#endif /* CONFIG_MAC80211_DEBUG */
621 return RX_DROP_MONITOR; 616 return RX_DROP_MONITOR;
622 } 617 }
623 618
@@ -789,7 +784,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
789 sdata->fragment_next = 0; 784 sdata->fragment_next = 0;
790 785
791 if (!skb_queue_empty(&entry->skb_list)) { 786 if (!skb_queue_empty(&entry->skb_list)) {
792#ifdef CONFIG_MAC80211_DEBUG 787#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
793 struct ieee80211_hdr *hdr = 788 struct ieee80211_hdr *hdr =
794 (struct ieee80211_hdr *) entry->skb_list.next->data; 789 (struct ieee80211_hdr *) entry->skb_list.next->data;
795 DECLARE_MAC_BUF(mac); 790 DECLARE_MAC_BUF(mac);
@@ -801,7 +796,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
801 jiffies - entry->first_frag_time, entry->seq, 796 jiffies - entry->first_frag_time, entry->seq,
802 entry->last_frag, print_mac(mac, hdr->addr1), 797 entry->last_frag, print_mac(mac, hdr->addr1),
803 print_mac(mac2, hdr->addr2)); 798 print_mac(mac2, hdr->addr2));
804#endif /* CONFIG_MAC80211_DEBUG */ 799#endif
805 __skb_queue_purge(&entry->skb_list); 800 __skb_queue_purge(&entry->skb_list);
806 } 801 }
807 802
@@ -922,18 +917,8 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
922 break; 917 break;
923 } 918 }
924 rpn = rx->key->u.ccmp.rx_pn[rx->queue]; 919 rpn = rx->key->u.ccmp.rx_pn[rx->queue];
925 if (memcmp(pn, rpn, CCMP_PN_LEN) != 0) { 920 if (memcmp(pn, rpn, CCMP_PN_LEN))
926 if (net_ratelimit())
927 printk(KERN_DEBUG "%s: defrag: CCMP PN not "
928 "sequential A2=%s"
929 " PN=%02x%02x%02x%02x%02x%02x "
930 "(expected %02x%02x%02x%02x%02x%02x)\n",
931 rx->dev->name, print_mac(mac, hdr->addr2),
932 rpn[0], rpn[1], rpn[2], rpn[3], rpn[4],
933 rpn[5], pn[0], pn[1], pn[2], pn[3],
934 pn[4], pn[5]);
935 return RX_DROP_UNUSABLE; 921 return RX_DROP_UNUSABLE;
936 }
937 memcpy(entry->last_pn, pn, CCMP_PN_LEN); 922 memcpy(entry->last_pn, pn, CCMP_PN_LEN);
938 } 923 }
939 924
@@ -1037,7 +1022,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
1037 * have nothing buffered for it? 1022 * have nothing buffered for it?
1038 */ 1023 */
1039 printk(KERN_DEBUG "%s: STA %s sent PS Poll even " 1024 printk(KERN_DEBUG "%s: STA %s sent PS Poll even "
1040 "though there is no buffered frames for it\n", 1025 "though there are no buffered frames for it\n",
1041 rx->dev->name, print_mac(mac, rx->sta->addr)); 1026 rx->dev->name, print_mac(mac, rx->sta->addr));
1042#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 1027#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
1043 } 1028 }
@@ -1073,14 +1058,8 @@ static int
1073ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) 1058ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx)
1074{ 1059{
1075 if (unlikely(!rx->sta || 1060 if (unlikely(!rx->sta ||
1076 !test_sta_flags(rx->sta, WLAN_STA_AUTHORIZED))) { 1061 !test_sta_flags(rx->sta, WLAN_STA_AUTHORIZED)))
1077#ifdef CONFIG_MAC80211_DEBUG
1078 if (net_ratelimit())
1079 printk(KERN_DEBUG "%s: dropped frame "
1080 "(unauthorized port)\n", rx->dev->name);
1081#endif /* CONFIG_MAC80211_DEBUG */
1082 return -EACCES; 1062 return -EACCES;
1083 }
1084 1063
1085 return 0; 1064 return 0;
1086} 1065}
@@ -1160,16 +1139,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1160 memcpy(src, hdr->addr2, ETH_ALEN); 1139 memcpy(src, hdr->addr2, ETH_ALEN);
1161 1140
1162 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP && 1141 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP &&
1163 sdata->vif.type != IEEE80211_IF_TYPE_VLAN)) { 1142 sdata->vif.type != IEEE80211_IF_TYPE_VLAN))
1164 if (net_ratelimit())
1165 printk(KERN_DEBUG "%s: dropped ToDS frame "
1166 "(BSSID=%s SA=%s DA=%s)\n",
1167 dev->name,
1168 print_mac(mac, hdr->addr1),
1169 print_mac(mac2, hdr->addr2),
1170 print_mac(mac3, hdr->addr3));
1171 return -1; 1143 return -1;
1172 }
1173 break; 1144 break;
1174 case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): 1145 case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
1175 /* RA TA DA SA */ 1146 /* RA TA DA SA */
@@ -1177,17 +1148,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1177 memcpy(src, hdr->addr4, ETH_ALEN); 1148 memcpy(src, hdr->addr4, ETH_ALEN);
1178 1149
1179 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS && 1150 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS &&
1180 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)) { 1151 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT))
1181 if (net_ratelimit())
1182 printk(KERN_DEBUG "%s: dropped FromDS&ToDS "
1183 "frame (RA=%s TA=%s DA=%s SA=%s)\n",
1184 rx->dev->name,
1185 print_mac(mac, hdr->addr1),
1186 print_mac(mac2, hdr->addr2),
1187 print_mac(mac3, hdr->addr3),
1188 print_mac(mac4, hdr->addr4));
1189 return -1; 1152 return -1;
1190 }
1191 break; 1153 break;
1192 case IEEE80211_FCTL_FROMDS: 1154 case IEEE80211_FCTL_FROMDS:
1193 /* DA BSSID SA */ 1155 /* DA BSSID SA */
@@ -1204,27 +1166,13 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1204 memcpy(dst, hdr->addr1, ETH_ALEN); 1166 memcpy(dst, hdr->addr1, ETH_ALEN);
1205 memcpy(src, hdr->addr2, ETH_ALEN); 1167 memcpy(src, hdr->addr2, ETH_ALEN);
1206 1168
1207 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS) { 1169 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
1208 if (net_ratelimit()) {
1209 printk(KERN_DEBUG "%s: dropped IBSS frame "
1210 "(DA=%s SA=%s BSSID=%s)\n",
1211 dev->name,
1212 print_mac(mac, hdr->addr1),
1213 print_mac(mac2, hdr->addr2),
1214 print_mac(mac3, hdr->addr3));
1215 }
1216 return -1; 1170 return -1;
1217 }
1218 break; 1171 break;
1219 } 1172 }
1220 1173
1221 if (unlikely(skb->len - hdrlen < 8)) { 1174 if (unlikely(skb->len - hdrlen < 8))
1222 if (net_ratelimit()) {
1223 printk(KERN_DEBUG "%s: RX too short data frame "
1224 "payload\n", dev->name);
1225 }
1226 return -1; 1175 return -1;
1227 }
1228 1176
1229 payload = skb->data + hdrlen; 1177 payload = skb->data + hdrlen;
1230 ethertype = (payload[6] << 8) | payload[7]; 1178 ethertype = (payload[6] << 8) | payload[7];
@@ -1416,10 +1364,8 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1416 1364
1417 padding = ((4 - subframe_len) & 0x3); 1365 padding = ((4 - subframe_len) & 0x3);
1418 /* the last MSDU has no padding */ 1366 /* the last MSDU has no padding */
1419 if (subframe_len > remaining) { 1367 if (subframe_len > remaining)
1420 printk(KERN_DEBUG "%s: wrong buffer size\n", dev->name);
1421 return RX_DROP_UNUSABLE; 1368 return RX_DROP_UNUSABLE;
1422 }
1423 1369
1424 skb_pull(skb, sizeof(struct ethhdr)); 1370 skb_pull(skb, sizeof(struct ethhdr));
1425 /* if last subframe reuse skb */ 1371 /* if last subframe reuse skb */
@@ -1440,8 +1386,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1440 eth = (struct ethhdr *) skb_pull(skb, ntohs(len) + 1386 eth = (struct ethhdr *) skb_pull(skb, ntohs(len) +
1441 padding); 1387 padding);
1442 if (!eth) { 1388 if (!eth) {
1443 printk(KERN_DEBUG "%s: wrong buffer size\n",
1444 dev->name);
1445 dev_kfree_skb(frame); 1389 dev_kfree_skb(frame);
1446 return RX_DROP_UNUSABLE; 1390 return RX_DROP_UNUSABLE;
1447 } 1391 }
@@ -1593,31 +1537,16 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1593 else 1537 else
1594 keyidx = -1; 1538 keyidx = -1;
1595 1539
1596 if (net_ratelimit())
1597 printk(KERN_DEBUG "%s: TKIP hwaccel reported Michael MIC "
1598 "failure from %s to %s keyidx=%d\n",
1599 dev->name, print_mac(mac, hdr->addr2),
1600 print_mac(mac2, hdr->addr1), keyidx);
1601
1602 if (!rx->sta) { 1540 if (!rx->sta) {
1603 /* 1541 /*
1604 * Some hardware seem to generate incorrect Michael MIC 1542 * Some hardware seem to generate incorrect Michael MIC
1605 * reports; ignore them to avoid triggering countermeasures. 1543 * reports; ignore them to avoid triggering countermeasures.
1606 */ 1544 */
1607 if (net_ratelimit())
1608 printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
1609 "error for unknown address %s\n",
1610 dev->name, print_mac(mac, hdr->addr2));
1611 goto ignore; 1545 goto ignore;
1612 } 1546 }
1613 1547
1614 if (!(rx->fc & IEEE80211_FCTL_PROTECTED)) { 1548 if (!(rx->fc & IEEE80211_FCTL_PROTECTED))
1615 if (net_ratelimit())
1616 printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
1617 "error for a frame with no PROTECTED flag (src "
1618 "%s)\n", dev->name, print_mac(mac, hdr->addr2));
1619 goto ignore; 1549 goto ignore;
1620 }
1621 1550
1622 if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) { 1551 if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) {
1623 /* 1552 /*
@@ -1626,24 +1555,13 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1626 * group keys and only the AP is sending real multicast 1555 * group keys and only the AP is sending real multicast
1627 * frames in the BSS. 1556 * frames in the BSS.
1628 */ 1557 */
1629 if (net_ratelimit())
1630 printk(KERN_DEBUG "%s: ignored Michael MIC error for "
1631 "a frame with non-zero keyidx (%d)"
1632 " (src %s)\n", dev->name, keyidx,
1633 print_mac(mac, hdr->addr2));
1634 goto ignore; 1558 goto ignore;
1635 } 1559 }
1636 1560
1637 if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && 1561 if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
1638 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || 1562 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT ||
1639 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH)) { 1563 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH))
1640 if (net_ratelimit())
1641 printk(KERN_DEBUG "%s: ignored spurious Michael MIC "
1642 "error for a frame that cannot be encrypted "
1643 "(fc=0x%04x) (src %s)\n",
1644 dev->name, rx->fc, print_mac(mac, hdr->addr2));
1645 goto ignore; 1564 goto ignore;
1646 }
1647 1565
1648 mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr); 1566 mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr);
1649 ignore: 1567 ignore: