hostapd: update to 2023-03-29
[openwrt/staging/dedeckeh.git] / package / network / services / hostapd / patches / 700-wifi-reload.patch
index 174127df6e117247b2c28eaff0c7f05a928f60c5..5ac7f711a5cdeed38aa3ea2cec38dd6377417da0 100644 (file)
@@ -1,6 +1,6 @@
 --- a/hostapd/config_file.c
 +++ b/hostapd/config_file.c
-@@ -2416,6 +2416,8 @@ static int hostapd_config_fill(struct ho
+@@ -2418,6 +2418,8 @@ static int hostapd_config_fill(struct ho
                bss->isolate = atoi(pos);
        } else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
                bss->ap_max_inactivity = atoi(pos);
@@ -8,8 +8,8 @@
 +              bss->config_id = os_strdup(pos);
        } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
                bss->skip_inactivity_poll = atoi(pos);
-       } else if (os_strcmp(buf, "country_code") == 0) {
-@@ -3121,6 +3123,8 @@ static int hostapd_config_fill(struct ho
+       } else if (os_strcmp(buf, "config_id") == 0) {
+@@ -3128,6 +3130,8 @@ static int hostapd_config_fill(struct ho
                }
        } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) {
                conf->acs_exclude_dfs = atoi(pos);
        } else if (os_strcmp(buf, "channel") == 0) {
 --- a/src/ap/ap_config.c
 +++ b/src/ap/ap_config.c
-@@ -796,6 +796,7 @@ void hostapd_config_free_bss(struct host
-       os_free(conf->radius_req_attr_sqlite);
-       os_free(conf->rsn_preauth_interfaces);
-       os_free(conf->ctrl_interface);
-+      os_free(conf->config_id);
-       os_free(conf->ca_cert);
-       os_free(conf->server_cert);
-       os_free(conf->server_cert2);
-@@ -995,6 +996,7 @@ void hostapd_config_free(struct hostapd_
+@@ -997,6 +997,7 @@ void hostapd_config_free(struct hostapd_
  
        for (i = 0; i < conf->num_bss; i++)
                hostapd_config_free_bss(conf->bss[i]);
        os_free(conf->basic_rates);
 --- a/src/ap/ap_config.h
 +++ b/src/ap/ap_config.h
-@@ -285,6 +285,8 @@ struct hostapd_bss_config {
-       char vlan_bridge[IFNAMSIZ + 1];
-       char wds_bridge[IFNAMSIZ + 1];
-+      char *config_id;
-+
-       enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
-       unsigned int logger_syslog; /* module bitfield */
-@@ -969,6 +971,7 @@ struct eht_phy_capabilities_info {
+@@ -987,6 +987,7 @@ struct eht_phy_capabilities_info {
  struct hostapd_config {
        struct hostapd_bss_config **bss, *last_bss;
        size_t num_bss;
@@ -57,7 +40,7 @@
        int rts_threshold;
 --- a/src/ap/hostapd.c
 +++ b/src/ap/hostapd.c
-@@ -224,6 +224,10 @@ static int hostapd_iface_conf_changed(st
+@@ -254,6 +254,10 @@ static int hostapd_iface_conf_changed(st
  {
        size_t i;
  
@@ -68,7 +51,7 @@
        if (newconf->num_bss != oldconf->num_bss)
                return 1;
  
-@@ -237,7 +241,7 @@ static int hostapd_iface_conf_changed(st
+@@ -267,7 +271,7 @@ static int hostapd_iface_conf_changed(st
  }
  
  
  {
        struct hapd_interfaces *interfaces = iface->interfaces;
        struct hostapd_data *hapd = iface->bss[0];
-@@ -260,13 +264,16 @@ int hostapd_reload_config(struct hostapd
-       if (newconf == NULL)
-               return -1;
--      hostapd_clear_old(iface);
--
-       oldconf = hapd->iconf;
-       if (hostapd_iface_conf_changed(newconf, oldconf)) {
+@@ -295,6 +299,9 @@ int hostapd_reload_config(struct hostapd
                char *fname;
                int res;
  
 +              if (reconf)
 +                      return -1;
 +
-+              hostapd_clear_old(iface);
-+
+               hostapd_clear_old(iface);
                wpa_printf(MSG_DEBUG,
-                          "Configuration changes include interface/BSS modification - force full disable+enable sequence");
-               fname = os_strdup(iface->config_fname);
-@@ -291,6 +298,24 @@ int hostapd_reload_config(struct hostapd
+@@ -321,6 +328,24 @@ int hostapd_reload_config(struct hostapd
                        wpa_printf(MSG_ERROR,
                                   "Failed to enable interface on config reload");
                return res;
        }
        iface->conf = newconf;
  
-@@ -307,6 +332,12 @@ int hostapd_reload_config(struct hostapd
+@@ -337,6 +362,12 @@ int hostapd_reload_config(struct hostapd
  
        for (j = 0; j < iface->num_bss; j++) {
                hapd = iface->bss[j];
 +              }
 +              if (newconf->bss[j]->config_id)
 +                      hapd->config_id = strdup(newconf->bss[j]->config_id);
-               hapd->iconf = newconf;
-               hapd->conf = newconf->bss[j];
-               hostapd_reload_bss(hapd);
-@@ -2420,6 +2451,10 @@ hostapd_alloc_bss_data(struct hostapd_if
+               if (!hapd->conf->config_id || !newconf->bss[j]->config_id ||
+                   os_strcmp(hapd->conf->config_id,
+                             newconf->bss[j]->config_id) != 0)
+@@ -2514,6 +2545,10 @@ hostapd_alloc_bss_data(struct hostapd_if
        hapd->iconf = conf;
        hapd->conf = bss;
        hapd->iface = hapd_iface;
        int interface_added; /* virtual interface added for this BSS */
        unsigned int started:1;
        unsigned int disabled:1;
-@@ -667,7 +668,7 @@ struct hostapd_iface {
+@@ -676,7 +677,7 @@ struct hostapd_iface {
  int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
                               int (*cb)(struct hostapd_iface *iface,
                                         void *ctx), void *ctx);
  hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -4852,6 +4852,9 @@ static int wpa_driver_nl80211_set_ap(voi
+@@ -5054,6 +5054,9 @@ static int wpa_driver_nl80211_set_ap(voi
        if (ret) {
                wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
                           ret, strerror(-ret));
-+              if (!bss->beacon_set)
++              if (!bss->flink->beacon_set)
 +                      ret = 0;
-+              bss->beacon_set = 0;
++              bss->flink->beacon_set = 0;
        } else {
-               bss->beacon_set = 1;
+               bss->flink->beacon_set = 1;
                nl80211_set_bss(bss, params->cts_protect, params->preamble,
 --- a/hostapd/ctrl_iface.c
 +++ b/hostapd/ctrl_iface.c
-@@ -186,7 +186,7 @@ static int hostapd_ctrl_iface_update(str
+@@ -187,7 +187,7 @@ static int hostapd_ctrl_iface_update(str
        iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
        reload_opts = txt;
  
  }
 --- a/hostapd/main.c
 +++ b/hostapd/main.c
-@@ -317,7 +317,7 @@ static void handle_term(int sig, void *s
+@@ -320,7 +320,7 @@ static void handle_term(int sig, void *s
  
  static int handle_reload_iface(struct hostapd_iface *iface, void *ctx)
  {