aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_plink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/mesh_plink.c')
-rw-r--r--net/mac80211/mesh_plink.c61
1 files changed, 32 insertions, 29 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index be4fad128c34..a1dbd1540276 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -13,12 +13,6 @@
13#include "rate.h" 13#include "rate.h"
14#include "mesh.h" 14#include "mesh.h"
15 15
16#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
17#define mpl_dbg(fmt, args...) pr_debug(fmt, ##args)
18#else
19#define mpl_dbg(fmt, args...) do { (void)(0); } while (0)
20#endif
21
22#define PLINK_GET_LLID(p) (p + 2) 16#define PLINK_GET_LLID(p) (p + 2)
23#define PLINK_GET_PLID(p) (p + 4) 17#define PLINK_GET_PLID(p) (p + 4)
24 18
@@ -134,12 +128,14 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata)
134 128
135 switch (sta->ch_type) { 129 switch (sta->ch_type) {
136 case NL80211_CHAN_NO_HT: 130 case NL80211_CHAN_NO_HT:
137 mpl_dbg("mesh_plink %pM: nonHT sta (%pM) is present", 131 mpl_dbg(sdata,
132 "mesh_plink %pM: nonHT sta (%pM) is present\n",
138 sdata->vif.addr, sta->sta.addr); 133 sdata->vif.addr, sta->sta.addr);
139 non_ht_sta = true; 134 non_ht_sta = true;
140 goto out; 135 goto out;
141 case NL80211_CHAN_HT20: 136 case NL80211_CHAN_HT20:
142 mpl_dbg("mesh_plink %pM: HT20 sta (%pM) is present", 137 mpl_dbg(sdata,
138 "mesh_plink %pM: HT20 sta (%pM) is present\n",
143 sdata->vif.addr, sta->sta.addr); 139 sdata->vif.addr, sta->sta.addr);
144 ht20_sta = true; 140 ht20_sta = true;
145 default: 141 default:
@@ -160,7 +156,8 @@ out:
160 sdata->vif.bss_conf.ht_operation_mode = ht_opmode; 156 sdata->vif.bss_conf.ht_operation_mode = ht_opmode;
161 sdata->u.mesh.mshcfg.ht_opmode = ht_opmode; 157 sdata->u.mesh.mshcfg.ht_opmode = ht_opmode;
162 changed = BSS_CHANGED_HT; 158 changed = BSS_CHANGED_HT;
163 mpl_dbg("mesh_plink %pM: protection mode changed to %d", 159 mpl_dbg(sdata,
160 "mesh_plink %pM: protection mode changed to %d\n",
164 sdata->vif.addr, ht_opmode); 161 sdata->vif.addr, ht_opmode);
165 } 162 }
166 163
@@ -437,7 +434,8 @@ static void mesh_plink_timer(unsigned long data)
437 spin_unlock_bh(&sta->lock); 434 spin_unlock_bh(&sta->lock);
438 return; 435 return;
439 } 436 }
440 mpl_dbg("Mesh plink timer for %pM fired on state %d\n", 437 mpl_dbg(sta->sdata,
438 "Mesh plink timer for %pM fired on state %d\n",
441 sta->sta.addr, sta->plink_state); 439 sta->sta.addr, sta->plink_state);
442 reason = 0; 440 reason = 0;
443 llid = sta->llid; 441 llid = sta->llid;
@@ -450,7 +448,8 @@ static void mesh_plink_timer(unsigned long data)
450 /* retry timer */ 448 /* retry timer */
451 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { 449 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) {
452 u32 rand; 450 u32 rand;
453 mpl_dbg("Mesh plink for %pM (retry, timeout): %d %d\n", 451 mpl_dbg(sta->sdata,
452 "Mesh plink for %pM (retry, timeout): %d %d\n",
454 sta->sta.addr, sta->plink_retries, 453 sta->sta.addr, sta->plink_retries,
455 sta->plink_timeout); 454 sta->plink_timeout);
456 get_random_bytes(&rand, sizeof(u32)); 455 get_random_bytes(&rand, sizeof(u32));
@@ -530,7 +529,8 @@ int mesh_plink_open(struct sta_info *sta)
530 sta->plink_state = NL80211_PLINK_OPN_SNT; 529 sta->plink_state = NL80211_PLINK_OPN_SNT;
531 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); 530 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
532 spin_unlock_bh(&sta->lock); 531 spin_unlock_bh(&sta->lock);
533 mpl_dbg("Mesh plink: starting establishment with %pM\n", 532 mpl_dbg(sdata,
533 "Mesh plink: starting establishment with %pM\n",
534 sta->sta.addr); 534 sta->sta.addr);
535 535
536 return mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN, 536 return mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN,
@@ -565,7 +565,6 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
565 u8 *baseaddr; 565 u8 *baseaddr;
566 u32 changed = 0; 566 u32 changed = 0;
567 __le16 plid, llid, reason; 567 __le16 plid, llid, reason;
568#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
569 static const char *mplstates[] = { 568 static const char *mplstates[] = {
570 [NL80211_PLINK_LISTEN] = "LISTEN", 569 [NL80211_PLINK_LISTEN] = "LISTEN",
571 [NL80211_PLINK_OPN_SNT] = "OPN-SNT", 570 [NL80211_PLINK_OPN_SNT] = "OPN-SNT",
@@ -575,14 +574,14 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
575 [NL80211_PLINK_HOLDING] = "HOLDING", 574 [NL80211_PLINK_HOLDING] = "HOLDING",
576 [NL80211_PLINK_BLOCKED] = "BLOCKED" 575 [NL80211_PLINK_BLOCKED] = "BLOCKED"
577 }; 576 };
578#endif
579 577
580 /* need action_code, aux */ 578 /* need action_code, aux */
581 if (len < IEEE80211_MIN_ACTION_SIZE + 3) 579 if (len < IEEE80211_MIN_ACTION_SIZE + 3)
582 return; 580 return;
583 581
584 if (is_multicast_ether_addr(mgmt->da)) { 582 if (is_multicast_ether_addr(mgmt->da)) {
585 mpl_dbg("Mesh plink: ignore frame from multicast address"); 583 mpl_dbg(sdata,
584 "Mesh plink: ignore frame from multicast address\n");
586 return; 585 return;
587 } 586 }
588 587
@@ -595,12 +594,14 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
595 } 594 }
596 ieee802_11_parse_elems(baseaddr, len - baselen, &elems); 595 ieee802_11_parse_elems(baseaddr, len - baselen, &elems);
597 if (!elems.peering) { 596 if (!elems.peering) {
598 mpl_dbg("Mesh plink: missing necessary peer link ie\n"); 597 mpl_dbg(sdata,
598 "Mesh plink: missing necessary peer link ie\n");
599 return; 599 return;
600 } 600 }
601 if (elems.rsn_len && 601 if (elems.rsn_len &&
602 sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) { 602 sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) {
603 mpl_dbg("Mesh plink: can't establish link with secure peer\n"); 603 mpl_dbg(sdata,
604 "Mesh plink: can't establish link with secure peer\n");
604 return; 605 return;
605 } 606 }
606 607
@@ -610,14 +611,15 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
610 (ftype == WLAN_SP_MESH_PEERING_CONFIRM && ie_len != 6) || 611 (ftype == WLAN_SP_MESH_PEERING_CONFIRM && ie_len != 6) ||
611 (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len != 6 612 (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len != 6
612 && ie_len != 8)) { 613 && ie_len != 8)) {
613 mpl_dbg("Mesh plink: incorrect plink ie length %d %d\n", 614 mpl_dbg(sdata,
614 ftype, ie_len); 615 "Mesh plink: incorrect plink ie length %d %d\n",
616 ftype, ie_len);
615 return; 617 return;
616 } 618 }
617 619
618 if (ftype != WLAN_SP_MESH_PEERING_CLOSE && 620 if (ftype != WLAN_SP_MESH_PEERING_CLOSE &&
619 (!elems.mesh_id || !elems.mesh_config)) { 621 (!elems.mesh_id || !elems.mesh_config)) {
620 mpl_dbg("Mesh plink: missing necessary ie\n"); 622 mpl_dbg(sdata, "Mesh plink: missing necessary ie\n");
621 return; 623 return;
622 } 624 }
623 /* Note the lines below are correct, the llid in the frame is the plid 625 /* Note the lines below are correct, the llid in the frame is the plid
@@ -632,21 +634,21 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
632 634
633 sta = sta_info_get(sdata, mgmt->sa); 635 sta = sta_info_get(sdata, mgmt->sa);
634 if (!sta && ftype != WLAN_SP_MESH_PEERING_OPEN) { 636 if (!sta && ftype != WLAN_SP_MESH_PEERING_OPEN) {
635 mpl_dbg("Mesh plink: cls or cnf from unknown peer\n"); 637 mpl_dbg(sdata, "Mesh plink: cls or cnf from unknown peer\n");
636 rcu_read_unlock(); 638 rcu_read_unlock();
637 return; 639 return;
638 } 640 }
639 641
640 if (ftype == WLAN_SP_MESH_PEERING_OPEN && 642 if (ftype == WLAN_SP_MESH_PEERING_OPEN &&
641 !rssi_threshold_check(sta, sdata)) { 643 !rssi_threshold_check(sta, sdata)) {
642 mpl_dbg("Mesh plink: %pM does not meet rssi threshold\n", 644 mpl_dbg(sdata, "Mesh plink: %pM does not meet rssi threshold\n",
643 mgmt->sa); 645 mgmt->sa);
644 rcu_read_unlock(); 646 rcu_read_unlock();
645 return; 647 return;
646 } 648 }
647 649
648 if (sta && !test_sta_flag(sta, WLAN_STA_AUTH)) { 650 if (sta && !test_sta_flag(sta, WLAN_STA_AUTH)) {
649 mpl_dbg("Mesh plink: Action frame from non-authed peer\n"); 651 mpl_dbg(sdata, "Mesh plink: Action frame from non-authed peer\n");
650 rcu_read_unlock(); 652 rcu_read_unlock();
651 return; 653 return;
652 } 654 }
@@ -683,7 +685,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
683 } else if (!sta) { 685 } else if (!sta) {
684 /* ftype == WLAN_SP_MESH_PEERING_OPEN */ 686 /* ftype == WLAN_SP_MESH_PEERING_OPEN */
685 if (!mesh_plink_free_count(sdata)) { 687 if (!mesh_plink_free_count(sdata)) {
686 mpl_dbg("Mesh plink error: no more free plinks\n"); 688 mpl_dbg(sdata, "Mesh plink error: no more free plinks\n");
687 rcu_read_unlock(); 689 rcu_read_unlock();
688 return; 690 return;
689 } 691 }
@@ -724,7 +726,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
724 event = CLS_ACPT; 726 event = CLS_ACPT;
725 break; 727 break;
726 default: 728 default:
727 mpl_dbg("Mesh plink: unknown frame subtype\n"); 729 mpl_dbg(sdata, "Mesh plink: unknown frame subtype\n");
728 rcu_read_unlock(); 730 rcu_read_unlock();
729 return; 731 return;
730 } 732 }
@@ -734,13 +736,14 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
734 /* allocate sta entry if necessary and update info */ 736 /* allocate sta entry if necessary and update info */
735 sta = mesh_peer_init(sdata, mgmt->sa, &elems); 737 sta = mesh_peer_init(sdata, mgmt->sa, &elems);
736 if (!sta) { 738 if (!sta) {
737 mpl_dbg("Mesh plink: failed to init peer!\n"); 739 mpl_dbg(sdata, "Mesh plink: failed to init peer!\n");
738 rcu_read_unlock(); 740 rcu_read_unlock();
739 return; 741 return;
740 } 742 }
741 } 743 }
742 744
743 mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n", 745 mpl_dbg(sdata,
746 "Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n",
744 mgmt->sa, mplstates[sta->plink_state], 747 mgmt->sa, mplstates[sta->plink_state],
745 le16_to_cpu(sta->llid), le16_to_cpu(sta->plid), 748 le16_to_cpu(sta->llid), le16_to_cpu(sta->plid),
746 event); 749 event);
@@ -851,7 +854,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
851 mesh_plink_inc_estab_count(sdata); 854 mesh_plink_inc_estab_count(sdata);
852 changed |= mesh_set_ht_prot_mode(sdata); 855 changed |= mesh_set_ht_prot_mode(sdata);
853 changed |= BSS_CHANGED_BEACON; 856 changed |= BSS_CHANGED_BEACON;
854 mpl_dbg("Mesh plink with %pM ESTABLISHED\n", 857 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n",
855 sta->sta.addr); 858 sta->sta.addr);
856 break; 859 break;
857 default: 860 default:
@@ -887,7 +890,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
887 mesh_plink_inc_estab_count(sdata); 890 mesh_plink_inc_estab_count(sdata);
888 changed |= mesh_set_ht_prot_mode(sdata); 891 changed |= mesh_set_ht_prot_mode(sdata);
889 changed |= BSS_CHANGED_BEACON; 892 changed |= BSS_CHANGED_BEACON;
890 mpl_dbg("Mesh plink with %pM ESTABLISHED\n", 893 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n",
891 sta->sta.addr); 894 sta->sta.addr);
892 mesh_plink_frame_tx(sdata, 895 mesh_plink_frame_tx(sdata,
893 WLAN_SP_MESH_PEERING_CONFIRM, 896 WLAN_SP_MESH_PEERING_CONFIRM,