[PATCH] hostapd: add support for unicast beacons

Raphaël Mélotte raphael.melotte at mind.be
Mon Jan 9 05:47:12 PST 2023


Also refresh patches.

Upstream status:
https://patchwork.ozlabs.org/project/hostap/patch/20230105200945.761324-1-raphael.melotte@mind.be/

Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
---
 .../620-add-support-for-unicast-beacons.patch | 70 +++++++++++++++++++
 .../hostapd/patches/700-wifi-reload.patch     |  2 +-
 .../patches/720-iface_max_num_sta.patch       |  2 +-
 ...750-qos_map_set_without_interworking.patch |  2 +-
 4 files changed, 73 insertions(+), 3 deletions(-)
 create mode 100644 package/network/services/hostapd/patches/620-add-support-for-unicast-beacons.patch

diff --git a/package/network/services/hostapd/patches/620-add-support-for-unicast-beacons.patch b/package/network/services/hostapd/patches/620-add-support-for-unicast-beacons.patch
new file mode 100644
index 0000000000..c465b5d577
--- /dev/null
+++ b/package/network/services/hostapd/patches/620-add-support-for-unicast-beacons.patch
@@ -0,0 +1,70 @@
+--- a/hostapd/config_file.c
++++ b/hostapd/config_file.c
+@@ -3399,6 +3399,12 @@ static int hostapd_config_fill(struct ho
+ 				   line);
+ 			return 1;
+ 		}
++	} else if (os_strcmp(buf, "beacon_da") == 0) {
++		if (hwaddr_aton(pos, bss->beacon_da)) {
++			wpa_printf(MSG_ERROR, "Line %d: invalid beacon_da item",
++				   line);
++			return 1;
++		}
+ 	} else if (os_strcmp(buf, "use_driver_iface_addr") == 0) {
+ 		conf->use_driver_iface_addr = atoi(pos);
+ 	} else if (os_strcmp(buf, "ieee80211w") == 0) {
+--- a/hostapd/ctrl_iface.c
++++ b/hostapd/ctrl_iface.c
+@@ -1040,6 +1040,14 @@ static int hostapd_ctrl_iface_get_config
+ 		return pos - buf;
+ 	pos += ret;
+ 
++	if (!is_zero_ether_addr(hapd->conf->beacon_da)) {
++		ret = os_snprintf(pos, end - pos, "beacon_da=" MACSTR "\n",
++				  MAC2STR(hapd->conf->beacon_da));
++		if (os_snprintf_error(end - pos, ret))
++			return pos - buf;
++		pos += ret;
++	}
++
+ #ifdef CONFIG_WPS
+ 	ret = os_snprintf(pos, end - pos, "wps_state=%s\n",
+ 			  hapd->conf->wps_state == 0 ? "disabled" :
+--- a/hostapd/hostapd.conf
++++ b/hostapd/hostapd.conf
+@@ -94,6 +94,9 @@ ssid=test
+ # UTF-8 SSID: Whether the SSID is to be interpreted using UTF-8 encoding
+ #utf8_ssid=1
+ 
++# Destination address for beacon frames (defaults to broadcast)
++#beacon_da=ff:ff:ff:ff:ff:ff
++
+ # Country code (ISO/IEC 3166-1). Used to set regulatory domain.
+ # Set as needed to indicate country in which device is operating.
+ # This can limit available channels and transmit power.
+--- a/src/ap/ap_config.h
++++ b/src/ap/ap_config.h
+@@ -470,6 +470,7 @@ struct hostapd_bss_config {
+ 	struct hostapd_vlan *vlan;
+ 
+ 	macaddr bssid;
++	macaddr beacon_da;
+ 
+ 	/*
+ 	 * Maximum listen interval that STAs can use when associating with this
+--- a/src/ap/beacon.c
++++ b/src/ap/beacon.c
+@@ -1595,7 +1595,12 @@ int ieee802_11_build_ap_params(struct ho
+ 	head->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
+ 					   WLAN_FC_STYPE_BEACON);
+ 	head->duration = host_to_le16(0);
+-	os_memset(head->da, 0xff, ETH_ALEN);
++	if (is_zero_ether_addr(hapd->conf->beacon_da) ||
++	    is_broadcast_ether_addr(hapd->conf->beacon_da))
++		os_memset(head->da, 0xff, ETH_ALEN);
++	else {
++		os_memcpy(head->da, hapd->conf->beacon_da, ETH_ALEN);
++	}
+ 
+ 	os_memcpy(head->sa, hapd->own_addr, ETH_ALEN);
+ 	os_memcpy(head->bssid, hapd->own_addr, ETH_ALEN);
diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch
index 174127df6e..da9837d137 100644
--- a/package/network/services/hostapd/patches/700-wifi-reload.patch
+++ b/package/network/services/hostapd/patches/700-wifi-reload.patch
@@ -47,7 +47,7 @@
  	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 {
+@@ -970,6 +972,7 @@ struct eht_phy_capabilities_info {
  struct hostapd_config {
  	struct hostapd_bss_config **bss, *last_bss;
  	size_t num_bss;
diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch
index ed76d22dd0..e50965de06 100644
--- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch
+++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch
@@ -71,7 +71,7 @@
  			   " since no room for additional STA",
 --- a/src/ap/ap_config.h
 +++ b/src/ap/ap_config.h
-@@ -1010,6 +1010,8 @@ struct hostapd_config {
+@@ -1011,6 +1011,8 @@ struct hostapd_config {
  	unsigned int track_sta_max_num;
  	unsigned int track_sta_max_age;
  
diff --git a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch
index 479d561555..589d0d0829 100644
--- a/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch
+++ b/package/network/services/hostapd/patches/750-qos_map_set_without_interworking.patch
@@ -18,7 +18,7 @@
  
  #ifdef CONFIG_HS20
  static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf,
-@@ -4046,10 +4046,10 @@ static int hostapd_config_fill(struct ho
+@@ -4052,10 +4052,10 @@ static int hostapd_config_fill(struct ho
  		bss->gas_frag_limit = val;
  	} else if (os_strcmp(buf, "gas_comeback_delay") == 0) {
  		bss->gas_comeback_delay = atoi(pos);
-- 
2.38.1




More information about the openwrt-devel mailing list