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 /net/mac80211/ieee80211_sta.c | |
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 'net/mac80211/ieee80211_sta.c')
-rw-r--r-- | net/mac80211/ieee80211_sta.c | 180 |
1 files changed, 101 insertions, 79 deletions
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index 8fdbd38e02c4..f47cbd294ceb 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c | |||
@@ -319,14 +319,15 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value) | |||
319 | int use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; | 319 | int use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; |
320 | int preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0; | 320 | int preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0; |
321 | u8 changes = 0; | 321 | u8 changes = 0; |
322 | DECLARE_MAC_BUF(mac); | ||
322 | 323 | ||
323 | if (use_protection != !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION)) { | 324 | if (use_protection != !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION)) { |
324 | if (net_ratelimit()) { | 325 | if (net_ratelimit()) { |
325 | printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" | 326 | printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" |
326 | MAC_FMT ")\n", | 327 | "%s)\n", |
327 | dev->name, | 328 | dev->name, |
328 | use_protection ? "enabled" : "disabled", | 329 | use_protection ? "enabled" : "disabled", |
329 | MAC_ARG(ifsta->bssid)); | 330 | print_mac(mac, ifsta->bssid)); |
330 | } | 331 | } |
331 | if (use_protection) | 332 | if (use_protection) |
332 | sdata->flags |= IEEE80211_SDATA_USE_PROTECTION; | 333 | sdata->flags |= IEEE80211_SDATA_USE_PROTECTION; |
@@ -338,11 +339,11 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value) | |||
338 | if (preamble_mode != !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE)) { | 339 | if (preamble_mode != !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE)) { |
339 | if (net_ratelimit()) { | 340 | if (net_ratelimit()) { |
340 | printk(KERN_DEBUG "%s: switched to %s barker preamble" | 341 | printk(KERN_DEBUG "%s: switched to %s barker preamble" |
341 | " (BSSID=" MAC_FMT ")\n", | 342 | " (BSSID=%s)\n", |
342 | dev->name, | 343 | dev->name, |
343 | (preamble_mode == WLAN_ERP_PREAMBLE_SHORT) ? | 344 | (preamble_mode == WLAN_ERP_PREAMBLE_SHORT) ? |
344 | "short" : "long", | 345 | "short" : "long", |
345 | MAC_ARG(ifsta->bssid)); | 346 | print_mac(mac, ifsta->bssid)); |
346 | } | 347 | } |
347 | if (preamble_mode) | 348 | if (preamble_mode) |
348 | sdata->flags &= ~IEEE80211_SDATA_SHORT_PREAMBLE; | 349 | sdata->flags &= ~IEEE80211_SDATA_SHORT_PREAMBLE; |
@@ -524,18 +525,20 @@ static void ieee80211_send_auth(struct net_device *dev, | |||
524 | static void ieee80211_authenticate(struct net_device *dev, | 525 | static void ieee80211_authenticate(struct net_device *dev, |
525 | struct ieee80211_if_sta *ifsta) | 526 | struct ieee80211_if_sta *ifsta) |
526 | { | 527 | { |
528 | DECLARE_MAC_BUF(mac); | ||
529 | |||
527 | ifsta->auth_tries++; | 530 | ifsta->auth_tries++; |
528 | if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) { | 531 | if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) { |
529 | printk(KERN_DEBUG "%s: authentication with AP " MAC_FMT | 532 | printk(KERN_DEBUG "%s: authentication with AP %s" |
530 | " timed out\n", | 533 | " timed out\n", |
531 | dev->name, MAC_ARG(ifsta->bssid)); | 534 | dev->name, print_mac(mac, ifsta->bssid)); |
532 | ifsta->state = IEEE80211_DISABLED; | 535 | ifsta->state = IEEE80211_DISABLED; |
533 | return; | 536 | return; |
534 | } | 537 | } |
535 | 538 | ||
536 | ifsta->state = IEEE80211_AUTHENTICATE; | 539 | ifsta->state = IEEE80211_AUTHENTICATE; |
537 | printk(KERN_DEBUG "%s: authenticate with AP " MAC_FMT "\n", | 540 | printk(KERN_DEBUG "%s: authenticate with AP %s\n", |
538 | dev->name, MAC_ARG(ifsta->bssid)); | 541 | dev->name, print_mac(mac, ifsta->bssid)); |
539 | 542 | ||
540 | ieee80211_send_auth(dev, ifsta, 1, NULL, 0, 0); | 543 | ieee80211_send_auth(dev, ifsta, 1, NULL, 0, 0); |
541 | 544 | ||
@@ -744,18 +747,20 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, | |||
744 | static void ieee80211_associate(struct net_device *dev, | 747 | static void ieee80211_associate(struct net_device *dev, |
745 | struct ieee80211_if_sta *ifsta) | 748 | struct ieee80211_if_sta *ifsta) |
746 | { | 749 | { |
750 | DECLARE_MAC_BUF(mac); | ||
751 | |||
747 | ifsta->assoc_tries++; | 752 | ifsta->assoc_tries++; |
748 | if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) { | 753 | if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) { |
749 | printk(KERN_DEBUG "%s: association with AP " MAC_FMT | 754 | printk(KERN_DEBUG "%s: association with AP %s" |
750 | " timed out\n", | 755 | " timed out\n", |
751 | dev->name, MAC_ARG(ifsta->bssid)); | 756 | dev->name, print_mac(mac, ifsta->bssid)); |
752 | ifsta->state = IEEE80211_DISABLED; | 757 | ifsta->state = IEEE80211_DISABLED; |
753 | return; | 758 | return; |
754 | } | 759 | } |
755 | 760 | ||
756 | ifsta->state = IEEE80211_ASSOCIATE; | 761 | ifsta->state = IEEE80211_ASSOCIATE; |
757 | printk(KERN_DEBUG "%s: associate with AP " MAC_FMT "\n", | 762 | printk(KERN_DEBUG "%s: associate with AP %s\n", |
758 | dev->name, MAC_ARG(ifsta->bssid)); | 763 | dev->name, print_mac(mac, ifsta->bssid)); |
759 | if (ieee80211_privacy_mismatch(dev, ifsta)) { | 764 | if (ieee80211_privacy_mismatch(dev, ifsta)) { |
760 | printk(KERN_DEBUG "%s: mismatch in privacy configuration and " | 765 | printk(KERN_DEBUG "%s: mismatch in privacy configuration and " |
761 | "mixed-cell disabled - abort association\n", dev->name); | 766 | "mixed-cell disabled - abort association\n", dev->name); |
@@ -775,6 +780,7 @@ static void ieee80211_associated(struct net_device *dev, | |||
775 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 780 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
776 | struct sta_info *sta; | 781 | struct sta_info *sta; |
777 | int disassoc; | 782 | int disassoc; |
783 | DECLARE_MAC_BUF(mac); | ||
778 | 784 | ||
779 | /* TODO: start monitoring current AP signal quality and number of | 785 | /* TODO: start monitoring current AP signal quality and number of |
780 | * missed beacons. Scan other channels every now and then and search | 786 | * missed beacons. Scan other channels every now and then and search |
@@ -785,8 +791,8 @@ static void ieee80211_associated(struct net_device *dev, | |||
785 | 791 | ||
786 | sta = sta_info_get(local, ifsta->bssid); | 792 | sta = sta_info_get(local, ifsta->bssid); |
787 | if (!sta) { | 793 | if (!sta) { |
788 | printk(KERN_DEBUG "%s: No STA entry for own AP " MAC_FMT "\n", | 794 | printk(KERN_DEBUG "%s: No STA entry for own AP %s\n", |
789 | dev->name, MAC_ARG(ifsta->bssid)); | 795 | dev->name, print_mac(mac, ifsta->bssid)); |
790 | disassoc = 1; | 796 | disassoc = 1; |
791 | } else { | 797 | } else { |
792 | disassoc = 0; | 798 | disassoc = 0; |
@@ -794,9 +800,9 @@ static void ieee80211_associated(struct net_device *dev, | |||
794 | sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { | 800 | sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { |
795 | if (ifsta->flags & IEEE80211_STA_PROBEREQ_POLL) { | 801 | if (ifsta->flags & IEEE80211_STA_PROBEREQ_POLL) { |
796 | printk(KERN_DEBUG "%s: No ProbeResp from " | 802 | printk(KERN_DEBUG "%s: No ProbeResp from " |
797 | "current AP " MAC_FMT " - assume out of " | 803 | "current AP %s - assume out of " |
798 | "range\n", | 804 | "range\n", |
799 | dev->name, MAC_ARG(ifsta->bssid)); | 805 | dev->name, print_mac(mac, ifsta->bssid)); |
800 | disassoc = 1; | 806 | disassoc = 1; |
801 | sta_info_free(sta); | 807 | sta_info_free(sta); |
802 | } else | 808 | } else |
@@ -944,37 +950,38 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
944 | { | 950 | { |
945 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 951 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
946 | u16 auth_alg, auth_transaction, status_code; | 952 | u16 auth_alg, auth_transaction, status_code; |
953 | DECLARE_MAC_BUF(mac); | ||
947 | 954 | ||
948 | if (ifsta->state != IEEE80211_AUTHENTICATE && | 955 | if (ifsta->state != IEEE80211_AUTHENTICATE && |
949 | sdata->type != IEEE80211_IF_TYPE_IBSS) { | 956 | sdata->type != IEEE80211_IF_TYPE_IBSS) { |
950 | printk(KERN_DEBUG "%s: authentication frame received from " | 957 | printk(KERN_DEBUG "%s: authentication frame received from " |
951 | MAC_FMT ", but not in authenticate state - ignored\n", | 958 | "%s, but not in authenticate state - ignored\n", |
952 | dev->name, MAC_ARG(mgmt->sa)); | 959 | dev->name, print_mac(mac, mgmt->sa)); |
953 | return; | 960 | return; |
954 | } | 961 | } |
955 | 962 | ||
956 | if (len < 24 + 6) { | 963 | if (len < 24 + 6) { |
957 | printk(KERN_DEBUG "%s: too short (%zd) authentication frame " | 964 | printk(KERN_DEBUG "%s: too short (%zd) authentication frame " |
958 | "received from " MAC_FMT " - ignored\n", | 965 | "received from %s - ignored\n", |
959 | dev->name, len, MAC_ARG(mgmt->sa)); | 966 | dev->name, len, print_mac(mac, mgmt->sa)); |
960 | return; | 967 | return; |
961 | } | 968 | } |
962 | 969 | ||
963 | if (sdata->type != IEEE80211_IF_TYPE_IBSS && | 970 | if (sdata->type != IEEE80211_IF_TYPE_IBSS && |
964 | memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { | 971 | memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { |
965 | printk(KERN_DEBUG "%s: authentication frame received from " | 972 | printk(KERN_DEBUG "%s: authentication frame received from " |
966 | "unknown AP (SA=" MAC_FMT " BSSID=" MAC_FMT ") - " | 973 | "unknown AP (SA=%s BSSID=%s) - " |
967 | "ignored\n", dev->name, MAC_ARG(mgmt->sa), | 974 | "ignored\n", dev->name, print_mac(mac, mgmt->sa), |
968 | MAC_ARG(mgmt->bssid)); | 975 | print_mac(mac, mgmt->bssid)); |
969 | return; | 976 | return; |
970 | } | 977 | } |
971 | 978 | ||
972 | if (sdata->type != IEEE80211_IF_TYPE_IBSS && | 979 | if (sdata->type != IEEE80211_IF_TYPE_IBSS && |
973 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) { | 980 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) { |
974 | printk(KERN_DEBUG "%s: authentication frame received from " | 981 | printk(KERN_DEBUG "%s: authentication frame received from " |
975 | "unknown BSSID (SA=" MAC_FMT " BSSID=" MAC_FMT ") - " | 982 | "unknown BSSID (SA=%s BSSID=%s) - " |
976 | "ignored\n", dev->name, MAC_ARG(mgmt->sa), | 983 | "ignored\n", dev->name, print_mac(mac, mgmt->sa), |
977 | MAC_ARG(mgmt->bssid)); | 984 | print_mac(mac, mgmt->bssid)); |
978 | return; | 985 | return; |
979 | } | 986 | } |
980 | 987 | ||
@@ -982,9 +989,9 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
982 | auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); | 989 | auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); |
983 | status_code = le16_to_cpu(mgmt->u.auth.status_code); | 990 | status_code = le16_to_cpu(mgmt->u.auth.status_code); |
984 | 991 | ||
985 | printk(KERN_DEBUG "%s: RX authentication from " MAC_FMT " (alg=%d " | 992 | printk(KERN_DEBUG "%s: RX authentication from %s (alg=%d " |
986 | "transaction=%d status=%d)\n", | 993 | "transaction=%d status=%d)\n", |
987 | dev->name, MAC_ARG(mgmt->sa), auth_alg, | 994 | dev->name, print_mac(mac, mgmt->sa), auth_alg, |
988 | auth_transaction, status_code); | 995 | auth_transaction, status_code); |
989 | 996 | ||
990 | if (sdata->type == IEEE80211_IF_TYPE_IBSS) { | 997 | if (sdata->type == IEEE80211_IF_TYPE_IBSS) { |
@@ -1071,27 +1078,28 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev, | |||
1071 | size_t len) | 1078 | size_t len) |
1072 | { | 1079 | { |
1073 | u16 reason_code; | 1080 | u16 reason_code; |
1081 | DECLARE_MAC_BUF(mac); | ||
1074 | 1082 | ||
1075 | if (len < 24 + 2) { | 1083 | if (len < 24 + 2) { |
1076 | printk(KERN_DEBUG "%s: too short (%zd) deauthentication frame " | 1084 | printk(KERN_DEBUG "%s: too short (%zd) deauthentication frame " |
1077 | "received from " MAC_FMT " - ignored\n", | 1085 | "received from %s - ignored\n", |
1078 | dev->name, len, MAC_ARG(mgmt->sa)); | 1086 | dev->name, len, print_mac(mac, mgmt->sa)); |
1079 | return; | 1087 | return; |
1080 | } | 1088 | } |
1081 | 1089 | ||
1082 | if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { | 1090 | if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { |
1083 | printk(KERN_DEBUG "%s: deauthentication frame received from " | 1091 | printk(KERN_DEBUG "%s: deauthentication frame received from " |
1084 | "unknown AP (SA=" MAC_FMT " BSSID=" MAC_FMT ") - " | 1092 | "unknown AP (SA=%s BSSID=%s) - " |
1085 | "ignored\n", dev->name, MAC_ARG(mgmt->sa), | 1093 | "ignored\n", dev->name, print_mac(mac, mgmt->sa), |
1086 | MAC_ARG(mgmt->bssid)); | 1094 | print_mac(mac, mgmt->bssid)); |
1087 | return; | 1095 | return; |
1088 | } | 1096 | } |
1089 | 1097 | ||
1090 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); | 1098 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); |
1091 | 1099 | ||
1092 | printk(KERN_DEBUG "%s: RX deauthentication from " MAC_FMT | 1100 | printk(KERN_DEBUG "%s: RX deauthentication from %s" |
1093 | " (reason=%d)\n", | 1101 | " (reason=%d)\n", |
1094 | dev->name, MAC_ARG(mgmt->sa), reason_code); | 1102 | dev->name, print_mac(mac, mgmt->sa), reason_code); |
1095 | 1103 | ||
1096 | if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) { | 1104 | if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) { |
1097 | printk(KERN_DEBUG "%s: deauthenticated\n", dev->name); | 1105 | printk(KERN_DEBUG "%s: deauthenticated\n", dev->name); |
@@ -1116,27 +1124,28 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev, | |||
1116 | size_t len) | 1124 | size_t len) |
1117 | { | 1125 | { |
1118 | u16 reason_code; | 1126 | u16 reason_code; |
1127 | DECLARE_MAC_BUF(mac); | ||
1119 | 1128 | ||
1120 | if (len < 24 + 2) { | 1129 | if (len < 24 + 2) { |
1121 | printk(KERN_DEBUG "%s: too short (%zd) disassociation frame " | 1130 | printk(KERN_DEBUG "%s: too short (%zd) disassociation frame " |
1122 | "received from " MAC_FMT " - ignored\n", | 1131 | "received from %s - ignored\n", |
1123 | dev->name, len, MAC_ARG(mgmt->sa)); | 1132 | dev->name, len, print_mac(mac, mgmt->sa)); |
1124 | return; | 1133 | return; |
1125 | } | 1134 | } |
1126 | 1135 | ||
1127 | if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { | 1136 | if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { |
1128 | printk(KERN_DEBUG "%s: disassociation frame received from " | 1137 | printk(KERN_DEBUG "%s: disassociation frame received from " |
1129 | "unknown AP (SA=" MAC_FMT " BSSID=" MAC_FMT ") - " | 1138 | "unknown AP (SA=%s BSSID=%s) - " |
1130 | "ignored\n", dev->name, MAC_ARG(mgmt->sa), | 1139 | "ignored\n", dev->name, print_mac(mac, mgmt->sa), |
1131 | MAC_ARG(mgmt->bssid)); | 1140 | print_mac(mac, mgmt->bssid)); |
1132 | return; | 1141 | return; |
1133 | } | 1142 | } |
1134 | 1143 | ||
1135 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); | 1144 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); |
1136 | 1145 | ||
1137 | printk(KERN_DEBUG "%s: RX disassociation from " MAC_FMT | 1146 | printk(KERN_DEBUG "%s: RX disassociation from %s" |
1138 | " (reason=%d)\n", | 1147 | " (reason=%d)\n", |
1139 | dev->name, MAC_ARG(mgmt->sa), reason_code); | 1148 | dev->name, print_mac(mac, mgmt->sa), reason_code); |
1140 | 1149 | ||
1141 | if (ifsta->flags & IEEE80211_STA_ASSOCIATED) | 1150 | if (ifsta->flags & IEEE80211_STA_ASSOCIATED) |
1142 | printk(KERN_DEBUG "%s: disassociated\n", dev->name); | 1151 | printk(KERN_DEBUG "%s: disassociated\n", dev->name); |
@@ -1165,29 +1174,30 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, | |||
1165 | struct ieee802_11_elems elems; | 1174 | struct ieee802_11_elems elems; |
1166 | u8 *pos; | 1175 | u8 *pos; |
1167 | int i, j; | 1176 | int i, j; |
1177 | DECLARE_MAC_BUF(mac); | ||
1168 | 1178 | ||
1169 | /* AssocResp and ReassocResp have identical structure, so process both | 1179 | /* AssocResp and ReassocResp have identical structure, so process both |
1170 | * of them in this function. */ | 1180 | * of them in this function. */ |
1171 | 1181 | ||
1172 | if (ifsta->state != IEEE80211_ASSOCIATE) { | 1182 | if (ifsta->state != IEEE80211_ASSOCIATE) { |
1173 | printk(KERN_DEBUG "%s: association frame received from " | 1183 | printk(KERN_DEBUG "%s: association frame received from " |
1174 | MAC_FMT ", but not in associate state - ignored\n", | 1184 | "%s, but not in associate state - ignored\n", |
1175 | dev->name, MAC_ARG(mgmt->sa)); | 1185 | dev->name, print_mac(mac, mgmt->sa)); |
1176 | return; | 1186 | return; |
1177 | } | 1187 | } |
1178 | 1188 | ||
1179 | if (len < 24 + 6) { | 1189 | if (len < 24 + 6) { |
1180 | printk(KERN_DEBUG "%s: too short (%zd) association frame " | 1190 | printk(KERN_DEBUG "%s: too short (%zd) association frame " |
1181 | "received from " MAC_FMT " - ignored\n", | 1191 | "received from %s - ignored\n", |
1182 | dev->name, len, MAC_ARG(mgmt->sa)); | 1192 | dev->name, len, print_mac(mac, mgmt->sa)); |
1183 | return; | 1193 | return; |
1184 | } | 1194 | } |
1185 | 1195 | ||
1186 | if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { | 1196 | if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0) { |
1187 | printk(KERN_DEBUG "%s: association frame received from " | 1197 | printk(KERN_DEBUG "%s: association frame received from " |
1188 | "unknown AP (SA=" MAC_FMT " BSSID=" MAC_FMT ") - " | 1198 | "unknown AP (SA=%s BSSID=%s) - " |
1189 | "ignored\n", dev->name, MAC_ARG(mgmt->sa), | 1199 | "ignored\n", dev->name, print_mac(mac, mgmt->sa), |
1190 | MAC_ARG(mgmt->bssid)); | 1200 | print_mac(mac, mgmt->bssid)); |
1191 | return; | 1201 | return; |
1192 | } | 1202 | } |
1193 | 1203 | ||
@@ -1199,9 +1209,9 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, | |||
1199 | "set\n", dev->name, aid); | 1209 | "set\n", dev->name, aid); |
1200 | aid &= ~(BIT(15) | BIT(14)); | 1210 | aid &= ~(BIT(15) | BIT(14)); |
1201 | 1211 | ||
1202 | printk(KERN_DEBUG "%s: RX %sssocResp from " MAC_FMT " (capab=0x%x " | 1212 | printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x " |
1203 | "status=%d aid=%d)\n", | 1213 | "status=%d aid=%d)\n", |
1204 | dev->name, reassoc ? "Rea" : "A", MAC_ARG(mgmt->sa), | 1214 | dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa), |
1205 | capab_info, status_code, aid); | 1215 | capab_info, status_code, aid); |
1206 | 1216 | ||
1207 | if (status_code != WLAN_STATUS_SUCCESS) { | 1217 | if (status_code != WLAN_STATUS_SUCCESS) { |
@@ -1435,14 +1445,16 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
1435 | struct sta_info *sta; | 1445 | struct sta_info *sta; |
1436 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1446 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1437 | u64 timestamp; | 1447 | u64 timestamp; |
1448 | DECLARE_MAC_BUF(mac); | ||
1449 | DECLARE_MAC_BUF(mac2); | ||
1438 | 1450 | ||
1439 | if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN)) | 1451 | if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN)) |
1440 | return; /* ignore ProbeResp to foreign address */ | 1452 | return; /* ignore ProbeResp to foreign address */ |
1441 | 1453 | ||
1442 | #if 0 | 1454 | #if 0 |
1443 | printk(KERN_DEBUG "%s: RX %s from " MAC_FMT " to " MAC_FMT "\n", | 1455 | printk(KERN_DEBUG "%s: RX %s from %s to %s\n", |
1444 | dev->name, beacon ? "Beacon" : "Probe Response", | 1456 | dev->name, beacon ? "Beacon" : "Probe Response", |
1445 | MAC_ARG(mgmt->sa), MAC_ARG(mgmt->da)); | 1457 | print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da)); |
1446 | #endif | 1458 | #endif |
1447 | 1459 | ||
1448 | baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; | 1460 | baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; |
@@ -1461,10 +1473,10 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
1461 | else | 1473 | else |
1462 | tsf = -1LLU; | 1474 | tsf = -1LLU; |
1463 | if (time_after(jiffies, last_tsf_debug + 5 * HZ)) { | 1475 | if (time_after(jiffies, last_tsf_debug + 5 * HZ)) { |
1464 | printk(KERN_DEBUG "RX beacon SA=" MAC_FMT " BSSID=" | 1476 | printk(KERN_DEBUG "RX beacon SA=%s BSSID=" |
1465 | MAC_FMT " TSF=0x%llx BCN=0x%llx diff=%lld " | 1477 | "%s TSF=0x%llx BCN=0x%llx diff=%lld " |
1466 | "@%lu\n", | 1478 | "@%lu\n", |
1467 | MAC_ARG(mgmt->sa), MAC_ARG(mgmt->bssid), | 1479 | print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->bssid), |
1468 | (unsigned long long)tsf, | 1480 | (unsigned long long)tsf, |
1469 | (unsigned long long)timestamp, | 1481 | (unsigned long long)timestamp, |
1470 | (unsigned long long)(tsf - timestamp), | 1482 | (unsigned long long)(tsf - timestamp), |
@@ -1518,9 +1530,9 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
1518 | } | 1530 | } |
1519 | if (sta->supp_rates != prev_rates) { | 1531 | if (sta->supp_rates != prev_rates) { |
1520 | printk(KERN_DEBUG "%s: updated supp_rates set for " | 1532 | printk(KERN_DEBUG "%s: updated supp_rates set for " |
1521 | MAC_FMT " based on beacon info (0x%x & 0x%x -> " | 1533 | "%s based on beacon info (0x%x & 0x%x -> " |
1522 | "0x%x)\n", | 1534 | "0x%x)\n", |
1523 | dev->name, MAC_ARG(sta->addr), prev_rates, | 1535 | dev->name, print_mac(mac, sta->addr), prev_rates, |
1524 | supp_rates, sta->supp_rates); | 1536 | supp_rates, sta->supp_rates); |
1525 | } | 1537 | } |
1526 | sta_info_put(sta); | 1538 | sta_info_put(sta); |
@@ -1722,6 +1734,11 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
1722 | struct sk_buff *skb; | 1734 | struct sk_buff *skb; |
1723 | struct ieee80211_mgmt *resp; | 1735 | struct ieee80211_mgmt *resp; |
1724 | u8 *pos, *end; | 1736 | u8 *pos, *end; |
1737 | DECLARE_MAC_BUF(mac); | ||
1738 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | ||
1739 | DECLARE_MAC_BUF(mac2); | ||
1740 | DECLARE_MAC_BUF(mac3); | ||
1741 | #endif | ||
1725 | 1742 | ||
1726 | if (sdata->type != IEEE80211_IF_TYPE_IBSS || | 1743 | if (sdata->type != IEEE80211_IF_TYPE_IBSS || |
1727 | ifsta->state != IEEE80211_IBSS_JOINED || | 1744 | ifsta->state != IEEE80211_IBSS_JOINED || |
@@ -1734,10 +1751,10 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
1734 | tx_last_beacon = 1; | 1751 | tx_last_beacon = 1; |
1735 | 1752 | ||
1736 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1753 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1737 | printk(KERN_DEBUG "%s: RX ProbeReq SA=" MAC_FMT " DA=" MAC_FMT " BSSID=" | 1754 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%s DA=%s BSSID=" |
1738 | MAC_FMT " (tx_last_beacon=%d)\n", | 1755 | "%s (tx_last_beacon=%d)\n", |
1739 | dev->name, MAC_ARG(mgmt->sa), MAC_ARG(mgmt->da), | 1756 | dev->name, print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da), |
1740 | MAC_ARG(mgmt->bssid), tx_last_beacon); | 1757 | print_mac(mac3, mgmt->bssid), tx_last_beacon); |
1741 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 1758 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
1742 | 1759 | ||
1743 | if (!tx_last_beacon) | 1760 | if (!tx_last_beacon) |
@@ -1753,8 +1770,8 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
1753 | pos + 2 + pos[1] > end) { | 1770 | pos + 2 + pos[1] > end) { |
1754 | if (net_ratelimit()) { | 1771 | if (net_ratelimit()) { |
1755 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " | 1772 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " |
1756 | "from " MAC_FMT "\n", | 1773 | "from %s\n", |
1757 | dev->name, MAC_ARG(mgmt->sa)); | 1774 | dev->name, print_mac(mac, mgmt->sa)); |
1758 | } | 1775 | } |
1759 | return; | 1776 | return; |
1760 | } | 1777 | } |
@@ -1773,8 +1790,8 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
1773 | resp = (struct ieee80211_mgmt *) skb->data; | 1790 | resp = (struct ieee80211_mgmt *) skb->data; |
1774 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 1791 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
1775 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 1792 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
1776 | printk(KERN_DEBUG "%s: Sending ProbeResp to " MAC_FMT "\n", | 1793 | printk(KERN_DEBUG "%s: Sending ProbeResp to %s\n", |
1777 | dev->name, MAC_ARG(resp->da)); | 1794 | dev->name, print_mac(mac, resp->da)); |
1778 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 1795 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
1779 | ieee80211_sta_tx(dev, skb, 0); | 1796 | ieee80211_sta_tx(dev, skb, 0); |
1780 | } | 1797 | } |
@@ -1925,13 +1942,14 @@ static void ieee80211_sta_expire(struct net_device *dev) | |||
1925 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1942 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1926 | struct sta_info *sta, *tmp; | 1943 | struct sta_info *sta, *tmp; |
1927 | LIST_HEAD(tmp_list); | 1944 | LIST_HEAD(tmp_list); |
1945 | DECLARE_MAC_BUF(mac); | ||
1928 | 1946 | ||
1929 | write_lock_bh(&local->sta_lock); | 1947 | write_lock_bh(&local->sta_lock); |
1930 | list_for_each_entry_safe(sta, tmp, &local->sta_list, list) | 1948 | list_for_each_entry_safe(sta, tmp, &local->sta_list, list) |
1931 | if (time_after(jiffies, sta->last_rx + | 1949 | if (time_after(jiffies, sta->last_rx + |
1932 | IEEE80211_IBSS_INACTIVITY_LIMIT)) { | 1950 | IEEE80211_IBSS_INACTIVITY_LIMIT)) { |
1933 | printk(KERN_DEBUG "%s: expiring inactive STA " MAC_FMT | 1951 | printk(KERN_DEBUG "%s: expiring inactive STA %s\n", |
1934 | "\n", dev->name, MAC_ARG(sta->addr)); | 1952 | dev->name, print_mac(mac, sta->addr)); |
1935 | __sta_info_get(sta); | 1953 | __sta_info_get(sta); |
1936 | sta_info_remove(sta); | 1954 | sta_info_remove(sta); |
1937 | list_add(&sta->list, &tmp_list); | 1955 | list_add(&sta->list, &tmp_list); |
@@ -2362,6 +2380,7 @@ static int ieee80211_sta_create_ibss(struct net_device *dev, | |||
2362 | struct ieee80211_hw_mode *mode; | 2380 | struct ieee80211_hw_mode *mode; |
2363 | u8 bssid[ETH_ALEN], *pos; | 2381 | u8 bssid[ETH_ALEN], *pos; |
2364 | int i; | 2382 | int i; |
2383 | DECLARE_MAC_BUF(mac); | ||
2365 | 2384 | ||
2366 | #if 0 | 2385 | #if 0 |
2367 | /* Easier testing, use fixed BSSID. */ | 2386 | /* Easier testing, use fixed BSSID. */ |
@@ -2377,8 +2396,8 @@ static int ieee80211_sta_create_ibss(struct net_device *dev, | |||
2377 | bssid[0] |= 0x02; | 2396 | bssid[0] |= 0x02; |
2378 | #endif | 2397 | #endif |
2379 | 2398 | ||
2380 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID " MAC_FMT "\n", | 2399 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n", |
2381 | dev->name, MAC_ARG(bssid)); | 2400 | dev->name, print_mac(mac, bssid)); |
2382 | 2401 | ||
2383 | bss = ieee80211_rx_bss_add(dev, bssid); | 2402 | bss = ieee80211_rx_bss_add(dev, bssid); |
2384 | if (!bss) | 2403 | if (!bss) |
@@ -2418,6 +2437,8 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
2418 | int found = 0; | 2437 | int found = 0; |
2419 | u8 bssid[ETH_ALEN]; | 2438 | u8 bssid[ETH_ALEN]; |
2420 | int active_ibss; | 2439 | int active_ibss; |
2440 | DECLARE_MAC_BUF(mac); | ||
2441 | DECLARE_MAC_BUF(mac2); | ||
2421 | 2442 | ||
2422 | if (ifsta->ssid_len == 0) | 2443 | if (ifsta->ssid_len == 0) |
2423 | return -EINVAL; | 2444 | return -EINVAL; |
@@ -2434,8 +2455,8 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
2434 | || !(bss->capability & WLAN_CAPABILITY_IBSS)) | 2455 | || !(bss->capability & WLAN_CAPABILITY_IBSS)) |
2435 | continue; | 2456 | continue; |
2436 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2457 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2437 | printk(KERN_DEBUG " bssid=" MAC_FMT " found\n", | 2458 | printk(KERN_DEBUG " bssid=%s found\n", |
2438 | MAC_ARG(bss->bssid)); | 2459 | print_mac(mac, bss->bssid)); |
2439 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 2460 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
2440 | memcpy(bssid, bss->bssid, ETH_ALEN); | 2461 | memcpy(bssid, bss->bssid, ETH_ALEN); |
2441 | found = 1; | 2462 | found = 1; |
@@ -2445,14 +2466,14 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
2445 | spin_unlock_bh(&local->sta_bss_lock); | 2466 | spin_unlock_bh(&local->sta_bss_lock); |
2446 | 2467 | ||
2447 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2468 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2448 | printk(KERN_DEBUG " sta_find_ibss: selected " MAC_FMT " current " | 2469 | printk(KERN_DEBUG " sta_find_ibss: selected %s current " |
2449 | MAC_FMT "\n", MAC_ARG(bssid), MAC_ARG(ifsta->bssid)); | 2470 | "%s\n", print_mac(mac, bssid), print_mac(mac2, ifsta->bssid)); |
2450 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 2471 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
2451 | if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 && | 2472 | if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 && |
2452 | (bss = ieee80211_rx_bss_get(dev, bssid))) { | 2473 | (bss = ieee80211_rx_bss_get(dev, bssid))) { |
2453 | printk(KERN_DEBUG "%s: Selected IBSS BSSID " MAC_FMT | 2474 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" |
2454 | " based on configured SSID\n", | 2475 | " based on configured SSID\n", |
2455 | dev->name, MAC_ARG(bssid)); | 2476 | dev->name, print_mac(mac, bssid)); |
2456 | return ieee80211_sta_join_ibss(dev, ifsta, bss); | 2477 | return ieee80211_sta_join_ibss(dev, ifsta, bss); |
2457 | } | 2478 | } |
2458 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2479 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
@@ -3070,19 +3091,20 @@ struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev, | |||
3070 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3091 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
3071 | struct sta_info *sta; | 3092 | struct sta_info *sta; |
3072 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 3093 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
3094 | DECLARE_MAC_BUF(mac); | ||
3073 | 3095 | ||
3074 | /* TODO: Could consider removing the least recently used entry and | 3096 | /* TODO: Could consider removing the least recently used entry and |
3075 | * allow new one to be added. */ | 3097 | * allow new one to be added. */ |
3076 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | 3098 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { |
3077 | if (net_ratelimit()) { | 3099 | if (net_ratelimit()) { |
3078 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " | 3100 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " |
3079 | "entry " MAC_FMT "\n", dev->name, MAC_ARG(addr)); | 3101 | "entry %s\n", dev->name, print_mac(mac, addr)); |
3080 | } | 3102 | } |
3081 | return NULL; | 3103 | return NULL; |
3082 | } | 3104 | } |
3083 | 3105 | ||
3084 | printk(KERN_DEBUG "%s: Adding new IBSS station " MAC_FMT " (dev=%s)\n", | 3106 | printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", |
3085 | local->mdev->name, MAC_ARG(addr), dev->name); | 3107 | local->mdev->name, print_mac(mac, addr), dev->name); |
3086 | 3108 | ||
3087 | sta = sta_info_add(local, dev, addr, GFP_ATOMIC); | 3109 | sta = sta_info_add(local, dev, addr, GFP_ATOMIC); |
3088 | if (!sta) | 3110 | if (!sta) |