]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Make hostapd_drv_send_mlme() more generic
authorJouni Malinen <j@w1.fi>
Fri, 3 Jan 2020 11:34:37 +0000 (13:34 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 3 Jan 2020 11:34:37 +0000 (13:34 +0200)
Merge hostapd_drv_send_mlme_csa() functionality into
hostapd_drv_send_mlme() to get a single driver ops handler function for
hostapd. In addition, add a new no_encrypt parameter in preparation for
functionality that is needed to get rid of the separate send_frame()
driver op.

Signed-off-by: Jouni Malinen <j@w1.fi>
hostapd/ctrl_iface.c
src/ap/ap_drv_ops.c
src/ap/ap_drv_ops.h
src/ap/beacon.c
src/ap/ctrl_iface_ap.c
src/ap/ieee802_11.c
src/ap/ieee802_11_shared.c
src/ap/wmm.c
src/ap/wnm_ap.c
src/ap/wpa_auth_glue.c

index bc8aaf276da9ba46a91a7efbe058fcc10ff4521b..cb4d8fac277b484aada1648fde11794286f95300 100644 (file)
@@ -1662,7 +1662,7 @@ static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd)
                return -1;
        }
 
-       res = hostapd_drv_send_mlme(hapd, buf, len, 0);
+       res = hostapd_drv_send_mlme(hapd, buf, len, 0, NULL, 0, 0);
        os_free(buf);
        return res;
 }
index 75858668927c38ceb640b0370fce065b674286be..ec1d970eaed9b7a201e1ddc82d6be9d42b1ce735 100644 (file)
@@ -693,21 +693,12 @@ int hostapd_drv_set_key(const char *ifname, struct hostapd_data *hapd,
 
 
 int hostapd_drv_send_mlme(struct hostapd_data *hapd,
-                         const void *msg, size_t len, int noack)
+                         const void *msg, size_t len, int noack,
+                         const u16 *csa_offs, size_t csa_offs_len,
+                         int no_encrypt)
 {
        if (!hapd->driver || !hapd->driver->send_mlme || !hapd->drv_priv)
                return 0;
-       return hapd->driver->send_mlme(hapd->drv_priv, msg, len, noack, 0,
-                                      NULL, 0);
-}
-
-
-int hostapd_drv_send_mlme_csa(struct hostapd_data *hapd,
-                             const void *msg, size_t len, int noack,
-                             const u16 *csa_offs, size_t csa_offs_len)
-{
-       if (hapd->driver == NULL || hapd->driver->send_mlme == NULL)
-               return 0;
        return hapd->driver->send_mlme(hapd->drv_priv, msg, len, noack, 0,
                                       csa_offs, csa_offs_len);
 }
index fa413df08d89819d5fa7421017f7cbd1af628e68..b0170df583d67bfede7aaf9f98cc7fd0f3c41e82 100644 (file)
@@ -93,10 +93,9 @@ int hostapd_drv_set_key(const char *ifname,
                        const u8 *seq, size_t seq_len,
                        const u8 *key, size_t key_len);
 int hostapd_drv_send_mlme(struct hostapd_data *hapd,
-                         const void *msg, size_t len, int noack);
-int hostapd_drv_send_mlme_csa(struct hostapd_data *hapd,
-                             const void *msg, size_t len, int noack,
-                             const u16 *csa_offs, size_t csa_offs_len);
+                         const void *msg, size_t len, int noack,
+                         const u16 *csa_offs, size_t csa_offs_len,
+                         int no_encrypt);
 int hostapd_drv_sta_deauth(struct hostapd_data *hapd,
                           const u8 *addr, int reason);
 int hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
index f3f496ba923ed930ecf7466d44a6300823dbc4c4..29c7e383de9cd1fff5f237f7054821bb0caca4c1 100644 (file)
@@ -1000,9 +1000,9 @@ void handle_probe_req(struct hostapd_data *hapd,
                                hapd->cs_c_off_ecsa_proberesp;
        }
 
-       ret = hostapd_drv_send_mlme_csa(hapd, resp, resp_len, noack,
-                                       csa_offs_len ? csa_offs : NULL,
-                                       csa_offs_len);
+       ret = hostapd_drv_send_mlme(hapd, resp, resp_len, noack,
+                                   csa_offs_len ? csa_offs : NULL,
+                                   csa_offs_len, 0);
 
        if (ret < 0)
                wpa_printf(MSG_INFO, "handle_probe_req: send failed");
index 73238f2c5cdbafdd73de0ad12e24d98733a34558..335d5a7b1a6eea56e1764d9fbe2630fe644e2e51 100644 (file)
@@ -495,7 +495,8 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
        pos += 2;
        *pos++ = minor_reason_code;
 
-       ret = hostapd_drv_send_mlme(hapd, mgmt, pos - (u8 *) mgmt, 0);
+       ret = hostapd_drv_send_mlme(hapd, mgmt, pos - (u8 *) mgmt, 0, NULL, 0,
+                                   0);
        os_free(mgmt);
 
        return ret < 0 ? -1 : 0;
index 0fb2ec116c3540ee5e2a56f6ffecb9d26ec3ea74..84dea20ca5065f5b844f7f7aa9fa631d18967219 100644 (file)
@@ -349,7 +349,7 @@ static int send_auth_reply(struct hostapd_data *hapd,
                   " auth_alg=%d auth_transaction=%d resp=%d (IE len=%lu) (dbg=%s)",
                   MAC2STR(dst), auth_alg, auth_transaction,
                   resp, (unsigned long) ies_len, dbg);
-       if (hostapd_drv_send_mlme(hapd, reply, rlen, 0) < 0)
+       if (hostapd_drv_send_mlme(hapd, reply, rlen, 0, NULL, 0, 0) < 0)
                wpa_printf(MSG_INFO, "send_auth_reply: send failed");
        else
                reply_res = WLAN_STATUS_SUCCESS;
@@ -3462,7 +3462,7 @@ static void send_deauth(struct hostapd_data *hapd, const u8 *addr,
        send_len = IEEE80211_HDRLEN + sizeof(reply.u.deauth);
        reply.u.deauth.reason_code = host_to_le16(reason_code);
 
-       if (hostapd_drv_send_mlme(hapd, &reply, send_len, 0) < 0)
+       if (hostapd_drv_send_mlme(hapd, &reply, send_len, 0, NULL, 0, 0) < 0)
                wpa_printf(MSG_INFO, "Failed to send deauth: %s",
                           strerror(errno));
 }
@@ -3848,7 +3848,7 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
        }
 #endif /* CONFIG_FILS */
 
-       if (hostapd_drv_send_mlme(hapd, reply, send_len, 0) < 0) {
+       if (hostapd_drv_send_mlme(hapd, reply, send_len, 0, NULL, 0, 0) < 0) {
                wpa_printf(MSG_INFO, "Failed to send assoc resp: %s",
                           strerror(errno));
                res = WLAN_STATUS_UNSPECIFIED_FAILURE;
@@ -4678,7 +4678,7 @@ static int handle_action(struct hostapd_data *hapd,
                os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN);
                resp->u.action.category |= 0x80;
 
-               if (hostapd_drv_send_mlme(hapd, resp, len, 0) < 0) {
+               if (hostapd_drv_send_mlme(hapd, resp, len, 0, NULL, 0, 0) < 0) {
                        wpa_printf(MSG_ERROR, "IEEE 802.11: Failed to send "
                                   "Action frame");
                }
index 1e1cc3825a4b19667bf1caa1081cedcfb396da61..ab81d083ef73cf2b88ffaf11af0415947896fe1c 100644 (file)
@@ -112,7 +112,8 @@ void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
                end += oci_ie_len;
        }
 #endif /* CONFIG_OCV */
-       if (hostapd_drv_send_mlme(hapd, mgmt, end - (u8 *) mgmt, 0) < 0)
+       if (hostapd_drv_send_mlme(hapd, mgmt, end - (u8 *) mgmt, 0, NULL, 0, 0)
+           < 0)
                wpa_printf(MSG_INFO, "ieee802_11_send_sa_query_req: send failed");
 
        os_free(mgmt);
@@ -193,7 +194,8 @@ static void ieee802_11_send_sa_query_resp(struct hostapd_data *hapd,
                end += oci_ie_len;
        }
 #endif /* CONFIG_OCV */
-       if (hostapd_drv_send_mlme(hapd, resp, end - (u8 *) resp, 0) < 0)
+       if (hostapd_drv_send_mlme(hapd, resp, end - (u8 *) resp, 0, NULL, 0, 0)
+           < 0)
                wpa_printf(MSG_INFO, "ieee80211_mgmt_sa_query_request: send failed");
 
        os_free(resp);
index 9f52dee32def0563162849769934432fde16a6e5..881fd9f239b79d64adca8c88a57cca585ed0040b 100644 (file)
@@ -209,7 +209,7 @@ static void wmm_send_action(struct hostapd_data *hapd, const u8 *addr,
        os_memcpy(t, tspec, sizeof(struct wmm_tspec_element));
        len = ((u8 *) (t + 1)) - buf;
 
-       if (hostapd_drv_send_mlme(hapd, m, len, 0) < 0)
+       if (hostapd_drv_send_mlme(hapd, m, len, 0, NULL, 0, 0) < 0)
                wpa_printf(MSG_INFO, "wmm_send_action: send failed");
 }
 
index e4dcfe9e0ab020355a3d0ce703b6e114b1f1379f..29ca950926d91bee2d959b4cac071ac3dc53ba56 100644 (file)
@@ -641,7 +641,7 @@ int wnm_send_disassoc_imminent(struct hostapd_data *hapd,
 
        wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request frame to indicate imminent disassociation (disassoc_timer=%d) to "
                   MACSTR, disassoc_timer, MAC2STR(sta->addr));
-       if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0) < 0) {
+       if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) {
                wpa_printf(MSG_DEBUG, "Failed to send BSS Transition "
                           "Management Request frame");
                return -1;
@@ -714,7 +714,7 @@ int wnm_send_ess_disassoc_imminent(struct hostapd_data *hapd,
        os_memcpy(pos, url, url_len);
        pos += url_len;
 
-       if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0) < 0) {
+       if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) {
                wpa_printf(MSG_DEBUG, "Failed to send BSS Transition "
                           "Management Request frame");
                return -1;
@@ -790,7 +790,7 @@ int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta,
                                  mbo_len);
        }
 
-       if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0) < 0) {
+       if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) {
                wpa_printf(MSG_DEBUG,
                           "Failed to send BSS Transition Management Request frame");
                os_free(buf);
@@ -834,7 +834,7 @@ int wnm_send_coloc_intf_req(struct hostapd_data *hapd, struct sta_info *sta,
        wpa_printf(MSG_DEBUG, "WNM: Sending Collocated Interference Request to "
                   MACSTR " (dialog_token=%u auto_report=%u timeout=%u)",
                   MAC2STR(sta->addr), dialog_token, auto_report, timeout);
-       if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0) < 0) {
+       if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) {
                wpa_printf(MSG_DEBUG,
                           "WNM: Failed to send Collocated Interference Request frame");
                return -1;
index 8ac70faa7cd6b3d7989511ea4cc99b1801cf215c..b655ae57b2021564c8c2ccf875ea3413ce51e38a 100644 (file)
@@ -918,7 +918,7 @@ static int hostapd_wpa_auth_send_ft_action(void *ctx, const u8 *dst,
        os_memcpy(m->bssid, hapd->own_addr, ETH_ALEN);
        os_memcpy(&m->u, data, data_len);
 
-       res = hostapd_drv_send_mlme(hapd, (u8 *) m, mlen, 0);
+       res = hostapd_drv_send_mlme(hapd, (u8 *) m, mlen, 0, NULL, 0, 0);
        os_free(m);
        return res;
 }