]> git.ipfire.org Git - thirdparty/openwrt.git/blob
080ce2bb86570976abbba9df12740aa4db614fef
[thirdparty/openwrt.git] /
1 From 4c1d4af0ac83705828dd11fded409163a87ea515 Mon Sep 17 00:00:00 2001
2 From: Kurt Lee <kurt.lee@cypress.com>
3 Date: Thu, 20 Aug 2020 03:07:02 -0500
4 Subject: [PATCH] brcmfmac: Fix interoperating DPP and other encryption network
5 access
6
7 1. If firmware supports 4-way handshake offload but not supports DPP
8 4-way offload, when user first connects encryption network, driver will
9 set "sup_wpa 1" to firmware, but it will further result in DPP
10 connection failure since firmware won't send EAPOL frame to host.
11
12 2. Fix DPP AP mode handling action frames.
13
14 3. For some firmware without fwsup support, the join procedure will be
15 skipped due to "sup_wpa" iovar returning not-support. Check the fwsup
16 feature before do such iovar.
17
18 Signed-off-by: Kurt Lee <kurt.lee@cypress.com>
19 Signed-off-by: Double Lo <double.lo@cypress.com>
20 Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
21 ---
22 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 67 ++++++++++---------
23 .../broadcom/brcm80211/brcmfmac/p2p.c | 5 ++
24 2 files changed, 42 insertions(+), 30 deletions(-)
25
26 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
27 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
28 @@ -2491,43 +2491,50 @@ brcmf_cfg80211_connect(struct wiphy *wip
29 goto done;
30 }
31
32 - if (sme->crypto.psk &&
33 - profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) {
34 - if (WARN_ON(profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE)) {
35 - err = -EINVAL;
36 - goto done;
37 + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_FWSUP)) {
38 + if (sme->crypto.psk) {
39 + if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) {
40 + if (WARN_ON(profile->use_fwsup !=
41 + BRCMF_PROFILE_FWSUP_NONE)) {
42 + err = -EINVAL;
43 + goto done;
44 + }
45 + brcmf_dbg(INFO, "using PSK offload\n");
46 + profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
47 + }
48 + } else {
49 + profile->use_fwsup = BRCMF_PROFILE_FWSUP_NONE;
50 }
51 - brcmf_dbg(INFO, "using PSK offload\n");
52 - profile->use_fwsup = BRCMF_PROFILE_FWSUP_PSK;
53 - }
54
55 - if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
56 - /* enable firmware supplicant for this interface */
57 - err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
58 - if (err < 0) {
59 - bphy_err(drvr, "failed to enable fw supplicant\n");
60 - goto done;
61 + if (profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
62 + /* enable firmware supplicant for this interface */
63 + err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
64 + if (err < 0) {
65 + bphy_err(drvr, "failed to enable fw supplicant\n");
66 + goto done;
67 + }
68 + } else {
69 + err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 0);
70 }
71 - }
72
73 - if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK)
74 - err = brcmf_set_pmk(ifp, sme->crypto.psk,
75 - BRCMF_WSEC_MAX_PSK_LEN);
76 - else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) {
77 - /* clean up user-space RSNE */
78 - err = brcmf_fil_iovar_data_set(ifp, "wpaie", NULL, 0);
79 - if (err) {
80 - bphy_err(drvr, "failed to clean up user-space RSNE\n");
81 - goto done;
82 - }
83 - err = brcmf_fwvid_set_sae_password(ifp, &sme->crypto);
84 - if (!err && sme->crypto.psk)
85 + if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_PSK) {
86 err = brcmf_set_pmk(ifp, sme->crypto.psk,
87 BRCMF_WSEC_MAX_PSK_LEN);
88 + } else if (profile->use_fwsup == BRCMF_PROFILE_FWSUP_SAE) {
89 + /* clean up user-space RSNE */
90 + err = brcmf_fil_iovar_data_set(ifp, "wpaie", NULL, 0);
91 + if (err) {
92 + bphy_err(drvr, "failed to clean up user-space RSNE\n");
93 + goto done;
94 + }
95 + err = brcmf_fwvid_set_sae_password(ifp, &sme->crypto);
96 + if (!err && sme->crypto.psk)
97 + err = brcmf_set_pmk(ifp, sme->crypto.psk,
98 + BRCMF_WSEC_MAX_PSK_LEN);
99 + }
100 + if (err)
101 + goto done;
102 }
103 - if (err)
104 - goto done;
105 -
106 /* Join with specific BSSID and cached SSID
107 * If SSID is zero join based on BSSID only
108 */
109 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
110 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
111 @@ -1281,6 +1281,10 @@ static s32 brcmf_p2p_abort_action_frame(
112 brcmf_dbg(TRACE, "Enter\n");
113
114 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
115 +
116 + if (!vif)
117 + vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
118 +
119 err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe_abort", &int_val,
120 sizeof(s32));
121 if (err)
122 @@ -1826,6 +1830,7 @@ bool brcmf_p2p_send_action_frame(struct
123 /* validate channel and p2p ies */
124 if (config_af_params.search_channel &&
125 IS_P2P_SOCIAL_CHANNEL(le32_to_cpu(af_params->channel)) &&
126 + p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif &&
127 p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->saved_ie.probe_req_ie_len) {
128 afx_hdl = &p2p->afx_hdl;
129 afx_hdl->peer_listen_chan = le32_to_cpu(af_params->channel);