6c30a1793e601b1475f15d73cb3880a3bbee4ec3
[openwrt/staging/neocturne.git] /
1 From 71b061b8a13791a1ed858d924e401541c8584030 Mon Sep 17 00:00:00 2001
2 From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
3 Date: Wed, 9 Jan 2019 19:08:00 +0100
4 Subject: [PATCH] multi_ap: don't reject backhaul STA on fronhaul BSS
5
6 The Multi-AP specification only specifies that information elements have
7 to be added to the association requests and responses; it doesn't
8 specify anything about what should be done in case they are missing.
9 Currently, we reject non-backhaul associations on a backhaul-only BSS,
10 and non-fronthaul associations on a fronthaul-only BSS.
11
12 However, this makes WPS fail when fronthaul and backhaul are separate
13 SSIDs. Indeed, WPS for the backhaul link is performed on the *fronthaul*
14 SSID. Thus, the association request used for WPS *will* contain the
15 Multi-AP IE indicating a backhaul STA. Rejecting that association makes
16 WPS fail.
17
18 Therefore, accept a multi-AP backhaul STA association request on a
19 fronthaul-only BSS. Still issue a warning about it, but only at level
20 DEBUG intead of INFO. Also change the condition checking to make it
21 clearer.
22
23 While we're at it, also fix the handling of unexpected bits in the
24 Multi-AP IE. 4 bits are reserved in the specification, so these
25 certainly have to be ignored. The specification also doesn't say that
26 setting one of the other bits is not allowed. Therefore, only report
27 unexpected values in the Multi-AP IE, don't reject because of it.
28 Note that a malformed IE (containing more than one byte) still triggers
29 a rejection.
30
31 Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
32 ---
33 v4: new patch
34
35 Cfr. discussion on http://lists.infradead.org/pipermail/hostap/2019-January/039232.html
36 and follow-ups.
37 ---
38 src/ap/ieee802_11.c | 38 +++++++++++++++++++-----------------
39 tests/hwsim/test_multi_ap.py | 6 ++----
40 2 files changed, 22 insertions(+), 22 deletions(-)
41
42 --- a/src/ap/ieee802_11.c
43 +++ b/src/ap/ieee802_11.c
44 @@ -2253,28 +2253,30 @@ static u16 check_multi_ap(struct hostapd
45 }
46 }
47
48 - if (multi_ap_value == MULTI_AP_BACKHAUL_STA)
49 - sta->flags |= WLAN_STA_MULTI_AP;
50 -
51 - if ((hapd->conf->multi_ap & BACKHAUL_BSS) &&
52 - multi_ap_value == MULTI_AP_BACKHAUL_STA)
53 - return WLAN_STATUS_SUCCESS;
54 -
55 - if (hapd->conf->multi_ap & FRONTHAUL_BSS) {
56 - if (multi_ap_value == MULTI_AP_BACKHAUL_STA) {
57 - hostapd_logger(hapd, sta->addr,
58 - HOSTAPD_MODULE_IEEE80211,
59 - HOSTAPD_LEVEL_INFO,
60 - "Backhaul STA tries to associate with fronthaul-only BSS");
61 - return WLAN_STATUS_ASSOC_DENIED_UNSPEC;
62 - }
63 - return WLAN_STATUS_SUCCESS;
64 + if (multi_ap_value && multi_ap_value != MULTI_AP_BACKHAUL_STA)
65 + hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
66 + HOSTAPD_LEVEL_INFO,
67 + "Multi-AP IE with unexpected value 0x%02x",
68 + multi_ap_value);
69 +
70 + if (!(multi_ap_value & MULTI_AP_BACKHAUL_STA)) {
71 + if (hapd->conf->multi_ap & FRONTHAUL_BSS)
72 + return WLAN_STATUS_SUCCESS;
73 +
74 + hostapd_logger(hapd, sta->addr,
75 + HOSTAPD_MODULE_IEEE80211,
76 + HOSTAPD_LEVEL_INFO,
77 + "Non-Multi-AP STA tries to associate with backhaul-only BSS");
78 + return WLAN_STATUS_ASSOC_DENIED_UNSPEC;
79 }
80
81 - hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
82 - HOSTAPD_LEVEL_INFO,
83 - "Non-Multi-AP STA tries to associate with backhaul-only BSS");
84 - return WLAN_STATUS_ASSOC_DENIED_UNSPEC;
85 + if (!(hapd->conf->multi_ap & BACKHAUL_BSS))
86 + hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
87 + HOSTAPD_LEVEL_DEBUG,
88 + "Backhaul STA tries to associate with fronthaul-only BSS");
89 +
90 + sta->flags |= WLAN_STA_MULTI_AP;
91 + return WLAN_STATUS_SUCCESS;
92 }
93
94
95 --- a/tests/hwsim/test_multi_ap.py
96 +++ b/tests/hwsim/test_multi_ap.py
97 @@ -59,7 +59,5 @@ def test_multi_ap_fronthaul_on_ap(dev, a
98 dev[0].request("DISCONNECT")
99 if ev is None:
100 raise Exception("Connection result not reported")
101 - if "CTRL-EVENT-ASSOC-REJECT" not in ev:
102 - raise Exception("Association rejection not reported")
103 - if "status_code=12" not in ev:
104 - raise Exception("Unexpected association status code: " + ev)
105 + if "CTRL-EVENT-DISCONNECTED" not in ev:
106 + raise Exception("Unexpected connection result")