]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OCV: Move "OCV failed" prefix to callers
authorJouni Malinen <jouni@codeaurora.org>
Mon, 25 May 2020 15:33:00 +0000 (18:33 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 25 May 2020 15:34:59 +0000 (18:34 +0300)
Make reporting of OCV validation failure reasons more flexible by
removing the fixed prefix from ocv_verify_tx_params() output in
ocv_errorstr so that the caller can use whatever prefix or encapsulation
that is most appropriate for each case.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/ap/ieee802_11.c
src/ap/ieee802_11_shared.c
src/ap/wnm_ap.c
src/ap/wpa_auth.c
src/ap/wpa_auth_ft.c
src/common/ocv.c
src/rsn_supp/wpa.c
src/rsn_supp/wpa_ft.c
wpa_supplicant/mesh_mpm.c
wpa_supplicant/sme.c
wpa_supplicant/wnm_sta.c

index f1f37027b110c08462ad9fe14f2c734f78031d40..b54580efe6406b83d0efef796472ec9cdd6bce56 100644 (file)
@@ -3509,7 +3509,8 @@ static int check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
 
                if (ocv_verify_tx_params(elems.oci, elems.oci_len, &ci,
                                         tx_chanwidth, tx_seg1_idx) != 0) {
-                       wpa_printf(MSG_WARNING, "FILS: %s", ocv_errorstr);
+                       wpa_printf(MSG_WARNING, "FILS: OCV failed: %s",
+                                  ocv_errorstr);
                        return WLAN_STATUS_UNSPECIFIED_FAILURE;
                }
        }
index 74a837f8b88c60938c67933fe97549b13af74bf2..9f2ec772eb69a43bb44cb79572b28647cdb1f993 100644 (file)
@@ -255,7 +255,7 @@ void ieee802_11_sa_query_action(struct hostapd_data *hapd,
 
                if (ocv_verify_tx_params(elems.oci, elems.oci_len, &ci,
                                         tx_chanwidth, tx_seg1_idx) != 0) {
-                       wpa_printf(MSG_WARNING, "%s", ocv_errorstr);
+                       wpa_printf(MSG_WARNING, "OCV failed: %s", ocv_errorstr);
                        return;
                }
        }
index 67281b38d166479c38b1697cb17caf4955bb1c2c..4a7da95138d4da51d61a5960c8c1178f22b2ea2a 100644 (file)
@@ -318,7 +318,8 @@ static void ieee802_11_rx_wnmsleep_req(struct hostapd_data *hapd,
                if (ocv_verify_tx_params(oci_ie, oci_ie_len, &ci,
                                         channel_width_to_int(ci.chanwidth),
                                         ci.seg1_idx) != 0) {
-                       wpa_msg(hapd, MSG_WARNING, "WNM: %s", ocv_errorstr);
+                       wpa_msg(hapd, MSG_WARNING, "WNM: OCV failed: %s",
+                               ocv_errorstr);
                        return;
                }
        }
index 8e21ee2c41e1a306d651b850928f32cafae4a4cc..d5aaf9cb86d6ac1be29458f7432d63c5dcc58585 100644 (file)
@@ -3042,8 +3042,8 @@ SM_STATE(WPA_PTK, PTKCALCNEGOTIATING)
 
                if (ocv_verify_tx_params(kde.oci, kde.oci_len, &ci,
                                         tx_chanwidth, tx_seg1_idx) != 0) {
-                       wpa_auth_logger(wpa_auth, sm->addr, LOGGER_INFO,
-                                       ocv_errorstr);
+                       wpa_auth_vlogger(wpa_auth, sm->addr, LOGGER_INFO,
+                                        "OCV failed: %s", ocv_errorstr);
                        return;
                }
        }
@@ -3880,8 +3880,8 @@ SM_STATE(WPA_PTK_GROUP, REKEYESTABLISHED)
 
                if (ocv_verify_tx_params(kde.oci, kde.oci_len, &ci,
                                         tx_chanwidth, tx_seg1_idx) != 0) {
-                       wpa_auth_logger(wpa_auth, sm->addr, LOGGER_INFO,
-                                       ocv_errorstr);
+                       wpa_auth_vlogger(wpa_auth, sm->addr, LOGGER_INFO,
+                                        "OCV failed: %s", ocv_errorstr);
                        return;
                }
        }
index d9a92e15f51611df8dd87efa3d94db09be43ccd0..f52a872c340ad62768faf9088cdb7d3d6c291438 100644 (file)
@@ -3466,7 +3466,7 @@ int wpa_ft_validate_reassoc(struct wpa_state_machine *sm, const u8 *ies,
 
                if (ocv_verify_tx_params(parse.oci, parse.oci_len, &ci,
                                         tx_chanwidth, tx_seg1_idx) != 0) {
-                       wpa_printf(MSG_WARNING, "%s", ocv_errorstr);
+                       wpa_printf(MSG_WARNING, "OCV failed: %s", ocv_errorstr);
                        return WLAN_STATUS_UNSPECIFIED_FAILURE;
                }
        }
index 06badfbfb4549b59b4710af0f9a1c9af11fa7a6f..6c35117a725b9aa73f4e12ebbdf3bb79f3859d46 100644 (file)
@@ -103,13 +103,13 @@ int ocv_verify_tx_params(const u8 *oci_ie, size_t oci_ie_len,
 
        if (!oci_ie) {
                os_snprintf(ocv_errorstr, sizeof(ocv_errorstr),
-                           "OCV failed: did not receive mandatory OCI");
+                           "did not receive mandatory OCI");
                return -1;
        }
 
        if (oci_ie_len != 3) {
                os_snprintf(ocv_errorstr, sizeof(ocv_errorstr),
-                           "OCV failed: received OCI of unexpected length (%d)",
+                           "received OCI of unexpected length (%d)",
                            (int) oci_ie_len);
                return -1;
        }
@@ -120,14 +120,14 @@ int ocv_verify_tx_params(const u8 *oci_ie, size_t oci_ie_len,
        oci.seg1_idx = oci_ie[2];
        if (ocv_derive_all_parameters(&oci) != 0) {
                os_snprintf(ocv_errorstr, sizeof(ocv_errorstr),
-                           "OCV failed: unable to interpret received OCI");
+                           "unable to interpret received OCI");
                return -1;
        }
 
        /* Primary frequency used to send frames to STA must match the STA's */
        if ((int) ci->frequency != oci.freq) {
                os_snprintf(ocv_errorstr, sizeof(ocv_errorstr),
-                           "OCV failed: primary channel mismatch in received OCI (we use %d but receiver is using %d)",
+                           "primary channel mismatch in received OCI (we use %d but receiver is using %d)",
                            ci->frequency, oci.freq);
                return -1;
        }
@@ -136,7 +136,7 @@ int ocv_verify_tx_params(const u8 *oci_ie, size_t oci_ie_len,
         */
        if (tx_chanwidth > oci.chanwidth) {
                os_snprintf(ocv_errorstr, sizeof(ocv_errorstr),
-                           "OCV failed: channel bandwidth mismatch in received OCI (we use %d but receiver only supports %d)",
+                           "channel bandwidth mismatch in received OCI (we use %d but receiver only supports %d)",
                            tx_chanwidth, oci.chanwidth);
                return -1;
        }
@@ -150,7 +150,7 @@ int ocv_verify_tx_params(const u8 *oci_ie, size_t oci_ie_len,
        if (tx_chanwidth == 40 && ci->frequency < 2500 &&
            ci->sec_channel != oci.sec_channel) {
                os_snprintf(ocv_errorstr, sizeof(ocv_errorstr),
-                           "OCV failed: secondary channel mismatch in received OCI (we use %d but receiver is using %d)",
+                           "secondary channel mismatch in received OCI (we use %d but receiver is using %d)",
                            ci->sec_channel, oci.sec_channel);
                return -1;
        }
@@ -163,7 +163,7 @@ int ocv_verify_tx_params(const u8 *oci_ie, size_t oci_ie_len,
             ci->chanwidth == CHAN_WIDTH_80P80) &&
            tx_seg1_idx != oci.seg1_idx) {
                os_snprintf(ocv_errorstr, sizeof(ocv_errorstr),
-                           "OCV failed: frequency segment 1 mismatch in received OCI (we use %d but receiver is using %d)",
+                           "frequency segment 1 mismatch in received OCI (we use %d but receiver is using %d)",
                            tx_seg1_idx, oci.seg1_idx);
                return -1;
        }
index 0e6e2212c11ae5a5c96c22c8514c5c266ed0bbf5..482cc06233747f91b401379a199fe2de65a3bfb8 100644 (file)
@@ -1717,7 +1717,7 @@ static void wpa_supplicant_process_3_of_4(struct wpa_sm *sm,
                if (ocv_verify_tx_params(ie.oci, ie.oci_len, &ci,
                                         channel_width_to_int(ci.chanwidth),
                                         ci.seg1_idx) != 0) {
-                       wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, "%s",
+                       wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, "OCV failed: %s",
                                ocv_errorstr);
                        return;
                }
@@ -1864,7 +1864,7 @@ static int wpa_supplicant_process_1_of_2_rsn(struct wpa_sm *sm,
                if (ocv_verify_tx_params(ie.oci, ie.oci_len, &ci,
                                         channel_width_to_int(ci.chanwidth),
                                         ci.seg1_idx) != 0) {
-                       wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, "%s",
+                       wpa_msg(sm->ctx->msg_ctx, MSG_WARNING, "OCV failed: %s",
                                ocv_errorstr);
                        return -1;
                }
@@ -4764,7 +4764,8 @@ int fils_process_assoc_resp(struct wpa_sm *sm, const u8 *resp, size_t len)
                if (ocv_verify_tx_params(elems.oci, elems.oci_len, &ci,
                                         channel_width_to_int(ci.chanwidth),
                                         ci.seg1_idx) != 0) {
-                       wpa_printf(MSG_WARNING, "FILS: %s", ocv_errorstr);
+                       wpa_printf(MSG_WARNING, "FILS: OCV failed: %s",
+                                  ocv_errorstr);
                        goto fail;
                }
        }
index 63a4175ab4585fcd8cebc2f04a2f7d61ad083eed..0cb327d7ed7734b04a477ff3d6f371dca0a2d978 100644 (file)
@@ -1159,7 +1159,7 @@ int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
                if (ocv_verify_tx_params(parse.oci, parse.oci_len, &ci,
                                         channel_width_to_int(ci.chanwidth),
                                         ci.seg1_idx) != 0) {
-                       wpa_printf(MSG_WARNING, "%s", ocv_errorstr);
+                       wpa_printf(MSG_WARNING, "OCV failed: %s", ocv_errorstr);
                        return -1;
                }
        }
index 12aafcb9704642ffefbaee1caf4b33dd308c2fb2..ea62abf5b48d44fdc76a8551622b1cdf3b715243 100644 (file)
@@ -1291,7 +1291,7 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s,
                        if (ocv_verify_tx_params(elems.oci, elems.oci_len, &ci,
                                                 tx_chanwidth, tx_seg1_idx) !=
                            0) {
-                               wpa_printf(MSG_WARNING, "MPM: %s",
+                               wpa_printf(MSG_WARNING, "MPM: OCV failed: %s",
                                           ocv_errorstr);
                                return;
                        }
index 28167cf278e897c96d4e1f46d743f290c1ad7111..7e8de4eb7d9e5152570c02d77b10012cd2b30aa9 100644 (file)
@@ -2827,7 +2827,7 @@ void sme_sa_query_rx(struct wpa_supplicant *wpa_s, const u8 *sa,
                if (ocv_verify_tx_params(elems.oci, elems.oci_len, &ci,
                                         channel_width_to_int(ci.chanwidth),
                                         ci.seg1_idx) != 0) {
-                       wpa_printf(MSG_WARNING, "%s", ocv_errorstr);
+                       wpa_printf(MSG_WARNING, "OCV failed: %s", ocv_errorstr);
                        return;
                }
        }
index 06cb70fe55c3aab6d3ed32514eabfa87cbef00ed..411ce886d3536f6c1588bb3f1f2881c5a13d5d9e 100644 (file)
@@ -375,7 +375,8 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s,
                if (ocv_verify_tx_params(oci_ie, oci_ie_len, &ci,
                                         channel_width_to_int(ci.chanwidth),
                                         ci.seg1_idx) != 0) {
-                       wpa_msg(wpa_s, MSG_WARNING, "WNM: %s", ocv_errorstr);
+                       wpa_msg(wpa_s, MSG_WARNING, "WNM: OCV failed: %s",
+                               ocv_errorstr);
                        return;
                }
        }