hostapd: update to 2023-03-29
[openwrt/openwrt.git] / package / network / services / hostapd / patches / 600-ubus_support.patch
index 521e7df82e2b971dd438cdbc3c4b8df22a5892fd..aa68079fb266832e4a1f3e9d2061079374610d90 100644 (file)
@@ -39,7 +39,7 @@
        int interface_added; /* virtual interface added for this BSS */
        unsigned int started:1;
        unsigned int disabled:1;
-@@ -673,6 +675,7 @@ hostapd_alloc_bss_data(struct hostapd_if
+@@ -682,6 +684,7 @@ hostapd_alloc_bss_data(struct hostapd_if
                       struct hostapd_bss_config *bss);
  int hostapd_setup_interface(struct hostapd_iface *iface);
  int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
@@ -49,7 +49,7 @@
  struct hostapd_iface * hostapd_alloc_iface(void);
 --- a/src/ap/hostapd.c
 +++ b/src/ap/hostapd.c
-@@ -401,6 +401,7 @@ void hostapd_free_hapd_data(struct hosta
+@@ -435,6 +435,7 @@ void hostapd_free_hapd_data(struct hosta
        hapd->beacon_set_done = 0;
  
        wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
@@ -57,7 +57,7 @@
        accounting_deinit(hapd);
        hostapd_deinit_wpa(hapd);
        vlan_deinit(hapd);
-@@ -1431,6 +1432,8 @@ static int hostapd_setup_bss(struct host
+@@ -1185,6 +1186,8 @@ static int hostapd_start_beacon(struct h
        if (hapd->driver && hapd->driver->set_operstate)
                hapd->driver->set_operstate(hapd->drv_priv, 1);
  
@@ -66,7 +66,7 @@
        return 0;
  }
  
-@@ -2050,6 +2053,7 @@ static int hostapd_setup_interface_compl
+@@ -2126,6 +2129,7 @@ static int hostapd_setup_interface_compl
        if (err)
                goto fail;
  
@@ -74,7 +74,7 @@
        wpa_printf(MSG_DEBUG, "Completing interface initialization");
        if (iface->freq) {
  #ifdef NEED_AP_MLME
-@@ -2248,6 +2252,7 @@ dfs_offload:
+@@ -2342,6 +2346,7 @@ dfs_offload:
  
  fail:
        wpa_printf(MSG_ERROR, "Interface initialization failed");
@@ -82,7 +82,7 @@
        hostapd_set_state(iface, HAPD_IFACE_DISABLED);
        wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
  #ifdef CONFIG_FST
-@@ -2723,6 +2728,7 @@ void hostapd_interface_deinit_free(struc
+@@ -2817,6 +2822,7 @@ void hostapd_interface_deinit_free(struc
                   (unsigned int) iface->conf->num_bss);
        driver = iface->bss[0]->driver;
        drv_priv = iface->bss[0]->drv_priv;
@@ -92,7 +92,7 @@
                   __func__, driver, drv_priv);
 --- a/src/ap/ieee802_11.c
 +++ b/src/ap/ieee802_11.c
-@@ -3573,13 +3573,18 @@ static void handle_auth(struct hostapd_d
+@@ -2740,13 +2740,18 @@ static void handle_auth(struct hostapd_d
        u16 auth_alg, auth_transaction, status_code;
        u16 resp = WLAN_STATUS_SUCCESS;
        struct sta_info *sta = NULL;
  
        if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
                wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
-@@ -3747,6 +3752,13 @@ static void handle_auth(struct hostapd_d
+@@ -2914,6 +2919,13 @@ static void handle_auth(struct hostapd_d
                resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
                goto fail;
        }
        if (res == HOSTAPD_ACL_PENDING)
                return;
  
-@@ -5488,7 +5500,7 @@ static void handle_assoc(struct hostapd_
+@@ -4695,7 +4707,7 @@ static void handle_assoc(struct hostapd_
        int resp = WLAN_STATUS_SUCCESS;
        u16 reply_res = WLAN_STATUS_UNSPECIFIED_FAILURE;
        const u8 *pos;
        struct sta_info *sta;
        u8 *tmp = NULL;
  #ifdef CONFIG_FILS
-@@ -5701,6 +5713,11 @@ static void handle_assoc(struct hostapd_
+@@ -4908,6 +4920,11 @@ static void handle_assoc(struct hostapd_
                left = res;
        }
  #endif /* CONFIG_FILS */
  
        /* followed by SSID and Supported rates; and HT capabilities if 802.11n
         * is used */
-@@ -5799,6 +5816,13 @@ static void handle_assoc(struct hostapd_
+@@ -5006,6 +5023,13 @@ static void handle_assoc(struct hostapd_
        }
  #endif /* CONFIG_FILS */
  
   fail:
  
        /*
-@@ -5892,6 +5916,7 @@ static void handle_disassoc(struct hosta
+@@ -5099,6 +5123,7 @@ static void handle_disassoc(struct hosta
        wpa_printf(MSG_DEBUG, "disassocation: STA=" MACSTR " reason_code=%d",
                   MAC2STR(mgmt->sa),
                   le_to_host16(mgmt->u.disassoc.reason_code));
  
        sta = ap_get_sta(hapd, mgmt->sa);
        if (sta == NULL) {
-@@ -5961,6 +5986,8 @@ static void handle_deauth(struct hostapd
+@@ -5168,6 +5193,8 @@ static void handle_deauth(struct hostapd
        /* Clear the PTKSA cache entries for PASN */
        ptksa_cache_flush(hapd->ptksa, mgmt->sa, WPA_CIPHER_NONE);
  
                wpa_msg(hapd->msg_ctx, MSG_DEBUG, "Station " MACSTR " trying "
 --- a/src/ap/beacon.c
 +++ b/src/ap/beacon.c
-@@ -919,6 +919,12 @@ void handle_probe_req(struct hostapd_dat
+@@ -1006,6 +1006,12 @@ void handle_probe_req(struct hostapd_dat
        u16 csa_offs[2];
        size_t csa_offs_len;
        struct radius_sta rad_info;
  
        if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
            ssi_signal < hapd->iconf->rssi_ignore_probe_request)
-@@ -1105,6 +1111,12 @@ void handle_probe_req(struct hostapd_dat
+@@ -1192,6 +1198,12 @@ void handle_probe_req(struct hostapd_dat
        }
  #endif /* CONFIG_P2P */
  
                ap_free_sta(hapd, sta);
                break;
        }
-@@ -1298,12 +1300,25 @@ void ap_sta_set_authorized(struct hostap
+@@ -1305,15 +1307,28 @@ void ap_sta_set_authorized(struct hostap
                                        sta->addr, authorized, dev_addr);
  
        if (authorized) {
 +                      [WLAN_AUTH_PASN] = "pasn",
 +              };
 +              const char *auth_alg = NULL;
+               const u8 *dpp_pkhash;
                const char *keyid;
+               char dpp_pkhash_buf[100];
                char keyid_buf[100];
                char ip_addr[100];
 +              char alg_buf[100];
  
+               dpp_pkhash_buf[0] = '\0';
                keyid_buf[0] = '\0';
                ip_addr[0] = '\0';
 +              alg_buf[0] = '\0';
  #ifdef CONFIG_P2P
                if (wpa_auth_get_ip_addr(sta->wpa_sm, ip_addr_buf) == 0) {
                        os_snprintf(ip_addr, sizeof(ip_addr),
-@@ -1313,22 +1328,31 @@ void ap_sta_set_authorized(struct hostap
+@@ -1323,6 +1338,13 @@ void ap_sta_set_authorized(struct hostap
                }
  #endif /* CONFIG_P2P */
  
 +
 +              if (auth_alg)
 +                      os_snprintf(alg_buf, sizeof(alg_buf),
-+                                  " auth_alg=%s", auth_alg);
++                              " auth_alg=%s", auth_alg);
 +
                keyid = ap_sta_wpa_get_keyid(hapd, sta);
                if (keyid) {
                        os_snprintf(keyid_buf, sizeof(keyid_buf),
-                                   " keyid=%s", keyid);
+@@ -1341,17 +1363,19 @@ void ap_sta_set_authorized(struct hostap
+                                        dpp_pkhash, SHA256_MAC_LEN);
                }
  
--              wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s",
--                      buf, ip_addr, keyid_buf);
+-              wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s",
+-                      buf, ip_addr, keyid_buf, dpp_pkhash_buf);
 +              hostapd_ubus_notify_authorized(hapd, sta, auth_alg);
-+              wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s",
-+                      buf, ip_addr, keyid_buf, alg_buf);
++              wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s%s",
++                      buf, ip_addr, keyid_buf, dpp_pkhash_buf, alg_buf);
  
                if (hapd->msg_ctx_parent &&
                    hapd->msg_ctx_parent != hapd->msg_ctx)
                        wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
--                                        AP_STA_CONNECTED "%s%s%s",
--                                        buf, ip_addr, keyid_buf);
-+                                        AP_STA_CONNECTED "%s%s%s%s",
-+                                        buf, ip_addr, keyid_buf, alg_buf);
+-                                        AP_STA_CONNECTED "%s%s%s%s",
++                                        AP_STA_CONNECTED "%s%s%s%s%s",
+                                         buf, ip_addr, keyid_buf,
+-                                        dpp_pkhash_buf);
++                                        dpp_pkhash_buf, alg_buf);
        } else {
                wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
 +              hostapd_ubus_notify(hapd, "disassoc", sta->addr);
                    hapd->msg_ctx_parent != hapd->msg_ctx)
 --- a/src/ap/wpa_auth_glue.c
 +++ b/src/ap/wpa_auth_glue.c
-@@ -268,6 +268,7 @@ static void hostapd_wpa_auth_psk_failure
+@@ -269,6 +269,7 @@ static void hostapd_wpa_auth_psk_failure
        struct hostapd_data *hapd = ctx;
        wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR,
                MAC2STR(addr));
  
 --- a/wpa_supplicant/Makefile
 +++ b/wpa_supplicant/Makefile
-@@ -183,6 +183,12 @@ ifdef CONFIG_EAPOL_TEST
+@@ -194,6 +194,12 @@ ifdef CONFIG_EAPOL_TEST
  CFLAGS += -Werror -DEAPOL_TEST
  endif
  
  ifdef CONFIG_CODE_COVERAGE
  CFLAGS += -O0 -fprofile-arcs -ftest-coverage
  LIBS += -lgcov
-@@ -977,6 +983,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
+@@ -989,6 +995,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
  CFLAGS += -DCONFIG_CTRL_IFACE_MIB
  endif
  OBJS += ../src/ap/ctrl_iface_ap.o
  CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
 --- a/wpa_supplicant/wpa_supplicant.c
 +++ b/wpa_supplicant/wpa_supplicant.c
-@@ -7285,6 +7285,8 @@ struct wpa_supplicant * wpa_supplicant_a
+@@ -7608,6 +7608,8 @@ struct wpa_supplicant * wpa_supplicant_a
        }
  #endif /* CONFIG_P2P */
  
        return wpa_s;
  }
  
-@@ -7311,6 +7313,8 @@ int wpa_supplicant_remove_iface(struct w
+@@ -7634,6 +7636,8 @@ int wpa_supplicant_remove_iface(struct w
        struct wpa_supplicant *parent = wpa_s->parent;
  #endif /* CONFIG_MESH */
  
        /* Remove interface from the global list of interfaces */
        prev = global->ifaces;
        if (prev == wpa_s) {
-@@ -7614,8 +7618,12 @@ int wpa_supplicant_run(struct wpa_global
+@@ -7980,8 +7984,12 @@ int wpa_supplicant_run(struct wpa_global
        eloop_register_signal_terminate(wpa_supplicant_terminate, global);
        eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
  
  
 --- a/wpa_supplicant/wpa_supplicant_i.h
 +++ b/wpa_supplicant/wpa_supplicant_i.h
-@@ -20,6 +20,7 @@
- #include "wps/wps_defs.h"
+@@ -21,6 +21,7 @@
  #include "config_ssid.h"
  #include "wmm_ac.h"
+ #include "pasn/pasn_common.h"
 +#include "ubus.h"
  
  extern const char *const wpa_supplicant_version;
  extern const char *const wpa_supplicant_license;
-@@ -323,6 +324,8 @@ struct wpa_global {
+@@ -324,6 +325,8 @@ struct wpa_global {
  #endif /* CONFIG_WIFI_DISPLAY */
  
        struct psk_list_entry *add_psk; /* From group formation */
  };
  
  
-@@ -707,6 +710,7 @@ struct wpa_supplicant {
+@@ -655,6 +658,7 @@ struct wpa_supplicant {
        unsigned char own_addr[ETH_ALEN];
        unsigned char perm_addr[ETH_ALEN];
        char ifname[100];
  
  
  #ifndef WPS_PIN_SCAN_IGNORE_SEL_REG
-@@ -391,6 +392,8 @@ static int wpa_supplicant_wps_cred(void
+@@ -402,6 +403,8 @@ static int wpa_supplicant_wps_cred(void
        wpa_hexdump_key(MSG_DEBUG, "WPS: Received Credential attribute",
                        cred->cred_attr, cred->cred_attr_len);
  
  
 --- a/hostapd/main.c
 +++ b/hostapd/main.c
-@@ -897,6 +897,7 @@ int main(int argc, char *argv[])
+@@ -901,6 +901,7 @@ int main(int argc, char *argv[])
        }
  
        hostapd_global_ctrl_iface_init(&interfaces);
  
        if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
                wpa_printf(MSG_ERROR, "Failed to start eloop");
-@@ -906,6 +907,7 @@ int main(int argc, char *argv[])
+@@ -910,6 +911,7 @@ int main(int argc, char *argv[])
        ret = 0;
  
   out:
  
 --- a/src/ap/dfs.c
 +++ b/src/ap/dfs.c
-@@ -1203,6 +1203,8 @@ int hostapd_dfs_pre_cac_expired(struct h
+@@ -1211,6 +1211,8 @@ int hostapd_dfs_pre_cac_expired(struct h
                "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d",
                freq, ht_enabled, chan_offset, chan_width, cf1, cf2);
  
        }
 --- a/src/ap/sta_info.h
 +++ b/src/ap/sta_info.h
-@@ -328,6 +328,7 @@ struct sta_info {
+@@ -293,6 +293,7 @@ struct sta_info {
  #endif /* CONFIG_TESTING_OPTIONS */
  #ifdef CONFIG_AIRTIME_POLICY
        unsigned int airtime_weight;