[openwrt/openwrt] hostapd: add patch for setting 4addr mode in multi_ap

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 13 08:46:01 EST 2021


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/68073e2d46d618d4452b653c06d14a9d361623d3

commit 68073e2d46d618d4452b653c06d14a9d361623d3
Author: Raphaël Mélotte <raphael.melotte at mind.be>
AuthorDate: Tue Feb 9 07:54:10 2021 +0100

    hostapd: add patch for setting 4addr mode in multi_ap
    
    This patch is required to be able to roam from one backhaul AP to
    another one in the same ESS.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
    (daniel at makrotopia.org: PKG_REVISION bump and refreshed patches)
    Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
---
 package/network/services/hostapd/Makefile          |  2 +-
 .../hostapd/patches/110-notify-mgmt-frames.patch   | 33 ++++++-------------
 .../patches/120-reconfigure-wps-credentials.patch  | 17 +++-------
 .../patches/130-wpa_supplicant-multi_ap_roam.patch | 37 ++++++++++++++++++++++
 .../services/hostapd/patches/200-multicall.patch   |  4 +--
 .../hostapd/patches/370-ap_sta_support.patch       |  4 +--
 ...ying-of-secondary-device-types-for-P2P-gr.patch |  7 +---
 7 files changed, 57 insertions(+), 47 deletions(-)

diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 6ab97c6e92..62f74923f0 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=30
+PKG_RELEASE:=31
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
diff --git a/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch b/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch
index 9466b3dab6..9e187253d4 100644
--- a/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch
+++ b/package/network/services/hostapd/patches/110-notify-mgmt-frames.patch
@@ -26,24 +26,20 @@ Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
  src/common/wpa_ctrl.h |  3 +++
  5 files changed, 36 insertions(+)
 
-diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index e09e6e141..6b88ecd17 100644
 --- a/hostapd/config_file.c
 +++ b/hostapd/config_file.c
-@@ -4323,6 +4323,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4456,6 +4456,8 @@ static int hostapd_config_fill(struct ho
  		bss->multicast_to_unicast = atoi(pos);
  	} else if (os_strcmp(buf, "broadcast_deauth") == 0) {
  		bss->broadcast_deauth = atoi(pos);
 +	} else if (os_strcmp(buf, "notify_mgmt_frames") == 0) {
 +		conf->notify_mgmt_frames = atoi(pos);
  #ifdef CONFIG_DPP
- 	} else if (os_strcmp(buf, "dpp_connector") == 0) {
- 		os_free(bss->dpp_connector);
-diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
-index ce3ecdddf..28dcd4f57 100644
+ 	} else if (os_strcmp(buf, "dpp_name") == 0) {
+ 		os_free(bss->dpp_name);
 --- a/hostapd/hostapd.conf
 +++ b/hostapd/hostapd.conf
-@@ -550,6 +550,10 @@ wmm_ac_vo_acm=0
+@@ -571,6 +571,10 @@ wmm_ac_vo_acm=0
  # Default: 1 (enabled)
  #broadcast_deauth=1
  
@@ -54,11 +50,9 @@ index ce3ecdddf..28dcd4f57 100644
  ##### IEEE 802.11n related configuration ######################################
  
  # ieee80211n: Whether IEEE 802.11n (HT) is enabled
-diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index ea581a822..2f89d6ab9 100644
 --- a/src/ap/ap_config.h
 +++ b/src/ap/ap_config.h
-@@ -1008,6 +1008,8 @@ struct hostapd_config {
+@@ -1060,6 +1060,8 @@ struct hostapd_config {
  	unsigned int airtime_update_interval;
  #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1)
  #endif /* CONFIG_AIRTIME_POLICY */
@@ -67,11 +61,9 @@ index ea581a822..2f89d6ab9 100644
  };
  
  
-diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
-index c85a28db4..fc1291024 100644
 --- a/src/ap/ieee802_11.c
 +++ b/src/ap/ieee802_11.c
-@@ -4591,6 +4591,28 @@ static int handle_action(struct hostapd_data *hapd,
+@@ -4878,6 +4878,28 @@ static int handle_action(struct hostapd_
  	return 1;
  }
  
@@ -100,7 +92,7 @@ index c85a28db4..fc1291024 100644
  
  /**
   * ieee802_11_mgmt - process incoming IEEE 802.11 management frames
-@@ -4665,6 +4687,9 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
+@@ -4969,6 +4991,9 @@ int ieee802_11_mgmt(struct hostapd_data
  	if (hapd->iconf->track_sta_max_num)
  		sta_track_add(hapd->iface, mgmt->sa, ssi_signal);
  
@@ -110,13 +102,11 @@ index c85a28db4..fc1291024 100644
  	switch (stype) {
  	case WLAN_FC_STYPE_AUTH:
  		wpa_printf(MSG_DEBUG, "mgmt::auth");
-diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
-index b24ae63e5..eeff9fcaa 100644
 --- a/src/common/wpa_ctrl.h
 +++ b/src/common/wpa_ctrl.h
-@@ -375,6 +375,9 @@ extern "C" {
- #define WDS_STA_INTERFACE_ADDED "WDS-STA-INTERFACE-ADDED "
- #define WDS_STA_INTERFACE_REMOVED "WDS-STA-INTERFACE-REMOVED "
+@@ -396,6 +396,9 @@ extern "C" {
+ #define BIT(x) (1U << (x))
+ #endif
  
 +/* Event triggered for received management frame */
 +#define AP_MGMT_FRAME_RECEIVED "AP-MGMT-FRAME-RECEIVED "
@@ -124,6 +114,3 @@ index b24ae63e5..eeff9fcaa 100644
  /* BSS command information masks */
  
  #define WPA_BSS_MASK_ALL		0xFFFDFFFF
--- 
-2.28.0
-
diff --git a/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch b/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch
index d9489aab36..1826b6685b 100644
--- a/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch
+++ b/package/network/services/hostapd/patches/120-reconfigure-wps-credentials.patch
@@ -19,11 +19,9 @@ Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
  src/wps/wps_registrar.c | 29 ++++++++++++++
  3 files changed, 118 insertions(+), 3 deletions(-)
 
-diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
-index dc8aa8f65..ff942a67b 100644
 --- a/src/ap/wps_hostapd.c
 +++ b/src/ap/wps_hostapd.c
-@@ -1375,6 +1375,43 @@ static void hostapd_wps_nfc_clear(struct wps_context *wps)
+@@ -1375,6 +1375,43 @@ static void hostapd_wps_nfc_clear(struct
  #endif /* CONFIG_WPS_NFC */
  }
  
@@ -67,7 +65,7 @@ index dc8aa8f65..ff942a67b 100644
  
  void hostapd_deinit_wps(struct hostapd_data *hapd)
  {
-@@ -1409,11 +1446,54 @@ void hostapd_update_wps(struct hostapd_data *hapd)
+@@ -1409,11 +1446,54 @@ void hostapd_update_wps(struct hostapd_d
  	hapd->wps->upc = hapd->conf->upc;
  #endif /* CONFIG_WPS_UPNP */
  
@@ -125,11 +123,9 @@ index dc8aa8f65..ff942a67b 100644
  	else
  		hostapd_deinit_wps(hapd);
  }
-diff --git a/src/wps/wps.h b/src/wps/wps.h
-index 93888b011..110e3ea52 100644
 --- a/src/wps/wps.h
 +++ b/src/wps/wps.h
-@@ -938,6 +938,12 @@ struct wpabuf * wps_build_nfc_handover_sel_p2p(struct wps_context *ctx,
+@@ -938,6 +938,12 @@ struct wpabuf * wps_build_nfc_handover_s
  					       struct wpabuf *nfc_dh_pubkey,
  					       struct wpabuf *nfc_dev_pw);
  
@@ -142,11 +138,9 @@ index 93888b011..110e3ea52 100644
  /* ndef.c */
  struct wpabuf * ndef_parse_wifi(const struct wpabuf *buf);
  struct wpabuf * ndef_build_wifi(const struct wpabuf *buf);
-diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
-index 9e1ee36da..d6b27be28 100644
 --- a/src/wps/wps_registrar.c
 +++ b/src/wps/wps_registrar.c
-@@ -3669,6 +3669,35 @@ int wps_registrar_config_ap(struct wps_registrar *reg,
+@@ -3669,6 +3669,35 @@ int wps_registrar_config_ap(struct wps_r
  }
  
  
@@ -182,6 +176,3 @@ index 9e1ee36da..d6b27be28 100644
  #ifdef CONFIG_WPS_NFC
  
  int wps_registrar_add_nfc_pw_token(struct wps_registrar *reg,
--- 
-2.29.2
-
diff --git a/package/network/services/hostapd/patches/130-wpa_supplicant-multi_ap_roam.patch b/package/network/services/hostapd/patches/130-wpa_supplicant-multi_ap_roam.patch
new file mode 100644
index 0000000000..fd3017af92
--- /dev/null
+++ b/package/network/services/hostapd/patches/130-wpa_supplicant-multi_ap_roam.patch
@@ -0,0 +1,37 @@
+From 8a4893dd06eb236460db4937f3c54e246739ad28 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte at mind.be>
+Date: Wed, 3 Feb 2021 14:23:17 +0100
+Subject: [PATCH] wpa_supplicant: multi_ap: only enable 4addr mode if not
+ already enabled
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If 4addr mode is already enabled, the call to enable it a second time
+may fail. If this happens when roaming, it leads to deauthentication.
+
+Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
+---
+ wpa_supplicant/events.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/wpa_supplicant/events.c
++++ b/wpa_supplicant/events.c
+@@ -2589,11 +2589,13 @@ static void multi_ap_set_4addr_mode(stru
+ 		goto fail;
+ 	}
+ 
+-	if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) {
+-		wpa_printf(MSG_ERROR, "Failed to set 4addr mode");
+-		goto fail;
++	if (wpa_s->enabled_4addr_mode == 0) {
++		if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) {
++			wpa_printf(MSG_ERROR, "Failed to set 4addr mode");
++			goto fail;
++		}
++		wpa_s->enabled_4addr_mode = 1;
+ 	}
+-	wpa_s->enabled_4addr_mode = 1;
+ 	return;
+ 
+ fail:
diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch
index 9119a24c55..4f3e3decfe 100644
--- a/package/network/services/hostapd/patches/200-multicall.patch
+++ b/package/network/services/hostapd/patches/200-multicall.patch
@@ -231,7 +231,7 @@
  	os_memset(&global, 0, sizeof(global));
 --- a/wpa_supplicant/events.c
 +++ b/wpa_supplicant/events.c
-@@ -4579,8 +4579,8 @@ static void wpas_event_unprot_beacon(str
+@@ -4581,8 +4581,8 @@ static void wpas_event_unprot_beacon(str
  }
  
  
@@ -242,7 +242,7 @@
  {
  	struct wpa_supplicant *wpa_s = ctx;
  	int resched;
-@@ -5398,7 +5398,7 @@ void wpa_supplicant_event(void *ctx, enu
+@@ -5400,7 +5400,7 @@ void wpa_supplicant_event(void *ctx, enu
  }
  
  
diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch
index 1c5f72ddc0..a7a646d2d1 100644
--- a/package/network/services/hostapd/patches/370-ap_sta_support.patch
+++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch
@@ -274,7 +274,7 @@
  	if (ieee802_11_build_ap_params(hapd, &params) < 0)
 --- a/wpa_supplicant/events.c
 +++ b/wpa_supplicant/events.c
-@@ -4579,6 +4579,60 @@ static void wpas_event_unprot_beacon(str
+@@ -4581,6 +4581,60 @@ static void wpas_event_unprot_beacon(str
  }
  
  
@@ -335,7 +335,7 @@
  void supplicant_event(void *ctx, enum wpa_event_type event,
  		      union wpa_event_data *data)
  {
-@@ -4881,8 +4935,10 @@ void supplicant_event(void *ctx, enum wp
+@@ -4883,8 +4937,10 @@ void supplicant_event(void *ctx, enum wp
  			channel_width_to_string(data->ch_switch.ch_width),
  			data->ch_switch.cf1,
  			data->ch_switch.cf2);
diff --git a/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch b/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch
index 4657b55d85..944f7d71c9 100644
--- a/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch
+++ b/package/network/services/hostapd/patches/801-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch
@@ -20,11 +20,9 @@ Signed-off-by: Jouni Malinen <jouni at codeaurora.org>
  src/p2p/p2p.c | 2 ++
  1 file changed, 2 insertions(+)
 
-diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
-index 74b7b52ae05c..5cbfc217fc1f 100644
 --- a/src/p2p/p2p.c
 +++ b/src/p2p/p2p.c
-@@ -453,6 +453,8 @@ static void p2p_copy_client_info(struct p2p_device *dev,
+@@ -453,6 +453,8 @@ static void p2p_copy_client_info(struct
  	dev->info.config_methods = cli->config_methods;
  	os_memcpy(dev->info.pri_dev_type, cli->pri_dev_type, 8);
  	dev->info.wps_sec_dev_type_list_len = 8 * cli->num_sec_dev_types;
@@ -33,6 +31,3 @@ index 74b7b52ae05c..5cbfc217fc1f 100644
  	os_memcpy(dev->info.wps_sec_dev_type_list, cli->sec_dev_types,
  		  dev->info.wps_sec_dev_type_list_len);
  }
--- 
-2.25.1
-



More information about the lede-commits mailing list