mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-30 18:07:52 +00:00 
			
		
		
		
	hostapd: add dynamic_probe_resp support
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		| @@ -170,7 +170,7 @@ radius_parse(char *buf, int len, int port, enum socket_type type, int tx) | ||||
|  | ||||
| 	len -= sizeof(*hdr); | ||||
|  | ||||
| 	while (len > 0) { | ||||
| 	while (len > 1) { | ||||
| 		struct radius_tlv *tlv = (struct radius_tlv *)avp; | ||||
|  | ||||
| 		if (len < tlv->len) { | ||||
|   | ||||
| @@ -4,10 +4,9 @@ PKG_NAME:=ucentral-schema | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| PKG_SOURCE_URL=https://github.com/Telecominfraproject/wlan-ucentral-schema.git | ||||
| PKG_MIRROR_HASH:=19cc22cf95f6497e34baafad2dbace0d01754a3b839954098eadceba332c2930 | ||||
| PKG_SOURCE_PROTO:=git | ||||
| PKG_SOURCE_DATE:=2022-05-29 | ||||
| PKG_SOURCE_VERSION:=c72603fe12b0326691a96574aa438519c4dcd01e | ||||
| PKG_SOURCE_VERSION:=c0d84b4044d3d523c909ea46e430ec94d7868de0 | ||||
|  | ||||
| PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||
| PKG_LICENSE:=BSD-3-Clause | ||||
|   | ||||
| @@ -394,6 +394,8 @@ hostapd_common_add_bss_config() { | ||||
| 	config_add_boolean ratelimit | ||||
|  | ||||
| 	config_add_string uci_section | ||||
|  | ||||
| 	config_add_boolean dynamic_probe_resp | ||||
| } | ||||
|  | ||||
| hostapd_set_vlan_file() { | ||||
| @@ -629,7 +631,7 @@ hostapd_set_bss_options() { | ||||
| 		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | ||||
| 		multicast_to_unicast_all proxy_arp per_sta_vif \ | ||||
| 		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ | ||||
| 		vendor_elements fils uci_section | ||||
| 		vendor_elements fils uci_section dynamic_probe_resp | ||||
|  | ||||
| 	set_default fils 0 | ||||
| 	set_default isolate 0 | ||||
| @@ -652,6 +654,7 @@ hostapd_set_bss_options() { | ||||
| 	set_default airtime_bss_weight 0 | ||||
| 	set_default airtime_bss_limit 0 | ||||
| 	set_default eap_server 0 | ||||
| 	set_default dynamic_probe_resp 0 | ||||
|  | ||||
| 	/usr/sbin/hostapd -vfils || fils=0 | ||||
|  | ||||
| @@ -677,6 +680,7 @@ hostapd_set_bss_options() { | ||||
| 	append bss_conf "preamble=$short_preamble" "$N" | ||||
| 	append bss_conf "wmm_enabled=$wmm" "$N" | ||||
| 	append bss_conf "ignore_broadcast_ssid=$hidden" "$N" | ||||
| 	append bss_conf "dynamic_probe_resp=$dynamic_probe_resp" "$N" | ||||
| 	append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N" | ||||
| 	append bss_conf "utf8_ssid=$utf8_ssid" "$N" | ||||
| 	append bss_conf "multi_ap=$multi_ap" "$N" | ||||
|   | ||||
							
								
								
									
										49
									
								
								feeds/wifi-ax/hostapd/patches/999-probe-request.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								feeds/wifi-ax/hostapd/patches/999-probe-request.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| Index: hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||
| =================================================================== | ||||
| --- hostapd-2021-02-20-59e9794c.orig/hostapd/config_file.c | ||||
| +++ hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||
| @@ -3339,6 +3339,8 @@ static int hostapd_config_fill(struct ho | ||||
|  		bss->ignore_broadcast_ssid = atoi(pos); | ||||
|  	} else if (os_strcmp(buf, "no_probe_resp_if_max_sta") == 0) { | ||||
|  		bss->no_probe_resp_if_max_sta = atoi(pos); | ||||
| +	} else if (os_strcmp(buf, "dynamic_probe_resp") == 0) { | ||||
| +		bss->dynamic_probe_resp = atoi(pos); | ||||
|  #ifdef CONFIG_WEP | ||||
|  	} else if (os_strcmp(buf, "wep_default_key") == 0) { | ||||
|  		bss->ssid.wep.idx = atoi(pos); | ||||
| Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||
| =================================================================== | ||||
| --- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.h | ||||
| +++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||
| @@ -460,6 +460,7 @@ struct hostapd_bss_config { | ||||
|  	int ap_max_inactivity; | ||||
|  	int ignore_broadcast_ssid; | ||||
|  	int no_probe_resp_if_max_sta; | ||||
| +	int dynamic_probe_resp; | ||||
|   | ||||
|  	int wmm_enabled; | ||||
|  	int wmm_uapsd; | ||||
| Index: hostapd-2021-02-20-59e9794c/src/ap/beacon.c | ||||
| =================================================================== | ||||
| --- hostapd-2021-02-20-59e9794c.orig/src/ap/beacon.c | ||||
| +++ hostapd-2021-02-20-59e9794c/src/ap/beacon.c | ||||
| @@ -920,7 +920,8 @@ void handle_probe_req(struct hostapd_dat | ||||
|  	} | ||||
|  #endif /* CONFIG_P2P */ | ||||
|   | ||||
| -	if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && | ||||
| +	if (!hapd->conf->dynamic_probe_resp && | ||||
| +	    hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && | ||||
|  	    elems.ssid_list_len == 0 && elems.short_ssid_list_len == 0) { | ||||
|  		wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for " | ||||
|  			   "broadcast SSID ignored", MAC2STR(mgmt->sa)); | ||||
| @@ -967,7 +968,8 @@ void handle_probe_req(struct hostapd_dat | ||||
|  		return; | ||||
|  	} | ||||
|   | ||||
| -	if (hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { | ||||
| +	if (!hapd->conf->dynamic_probe_resp && | ||||
| +	    hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { | ||||
|  		wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for " | ||||
|  			   "broadcast SSID ignored", MAC2STR(mgmt->sa)); | ||||
|  		return; | ||||
							
								
								
									
										103
									
								
								patches/wifi/0020-hostapd-add-uci-section.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								patches/wifi/0020-hostapd-add-uci-section.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | ||||
| From 518549798a9bdd7a62d324a9127a296cf3aa4a94 Mon Sep 17 00:00:00 2001 | ||||
| From: John Crispin <john@phrozen.org> | ||||
| Date: Wed, 16 Nov 2022 16:38:23 +0100 | ||||
| Subject: [PATCH 20/21] hostapd: add uci-section | ||||
|  | ||||
| Signed-off-by: John Crispin <john@phrozen.org> | ||||
| --- | ||||
|  .../network/services/hostapd/files/hostapd.sh |  6 ++- | ||||
|  .../hostapd/patches/901-cfg-section.patch     | 51 +++++++++++++++++++ | ||||
|  2 files changed, 56 insertions(+), 1 deletion(-) | ||||
|  create mode 100644 package/network/services/hostapd/patches/901-cfg-section.patch | ||||
|  | ||||
| diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh | ||||
| index 3ac9e7b590..c308d1d2de 100644 | ||||
| --- a/package/network/services/hostapd/files/hostapd.sh | ||||
| +++ b/package/network/services/hostapd/files/hostapd.sh | ||||
| @@ -392,6 +392,8 @@ hostapd_common_add_bss_config() { | ||||
|  	config_add_string fils_dhcp | ||||
|   | ||||
|  	config_add_boolean ratelimit | ||||
| + | ||||
| +	config_add_string uci_section | ||||
|  } | ||||
|   | ||||
|  hostapd_set_vlan_file() { | ||||
| @@ -627,7 +629,7 @@ hostapd_set_bss_options() { | ||||
|  		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | ||||
|  		multicast_to_unicast_all proxy_arp per_sta_vif \ | ||||
|  		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ | ||||
| -		vendor_elements fils | ||||
| +		vendor_elements fils uci_section | ||||
|   | ||||
|  	set_default fils 0 | ||||
|  	set_default isolate 0 | ||||
| @@ -1152,6 +1154,8 @@ hostapd_set_bss_options() { | ||||
|  		append bss_conf "per_sta_vif=$per_sta_vif" "$N" | ||||
|  	fi | ||||
|   | ||||
| +	[ -n "$uci_section" ] && append bss_conf "uci_section=$uci_section" "$N" | ||||
| + | ||||
|  	json_get_values opts hostapd_bss_options | ||||
|  	for val in $opts; do | ||||
|  		append bss_conf "$val" "$N" | ||||
| diff --git a/package/network/services/hostapd/patches/901-cfg-section.patch b/package/network/services/hostapd/patches/901-cfg-section.patch | ||||
| new file mode 100644 | ||||
| index 0000000000..dcfdd658fe | ||||
| --- /dev/null | ||||
| +++ b/package/network/services/hostapd/patches/901-cfg-section.patch | ||||
| @@ -0,0 +1,51 @@ | ||||
| +Index: hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||
| +=================================================================== | ||||
| +--- hostapd-2021-02-20-59e9794c.orig/hostapd/config_file.c | ||||
| ++++ hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||
| +@@ -2366,6 +2366,8 @@ static int hostapd_config_fill(struct ho | ||||
| + 			return 1; | ||||
| + 		} | ||||
| + 		conf->driver = driver; | ||||
| ++	} else if (os_strcmp(buf, "uci_section") == 0) { | ||||
| ++		bss->uci_section = os_strdup(pos); | ||||
| + 	} else if (os_strcmp(buf, "driver_params") == 0) { | ||||
| + 		os_free(conf->driver_params); | ||||
| + 		conf->driver_params = os_strdup(pos); | ||||
| +Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||
| +=================================================================== | ||||
| +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.h | ||||
| ++++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||
| +@@ -279,6 +279,7 @@ struct hostapd_bss_config { | ||||
| + 	char snoop_iface[IFNAMSIZ + 1]; | ||||
| + 	char vlan_bridge[IFNAMSIZ + 1]; | ||||
| + 	char wds_bridge[IFNAMSIZ + 1]; | ||||
| ++	char *uci_section; | ||||
| +  | ||||
| + 	char *config_id; | ||||
| +  | ||||
| +Index: hostapd-2021-02-20-59e9794c/src/ap/ubus.c | ||||
| +=================================================================== | ||||
| +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ubus.c | ||||
| ++++ hostapd-2021-02-20-59e9794c/src/ap/ubus.c | ||||
| +@@ -467,6 +467,9 @@ hostapd_bss_get_status(struct ubus_conte | ||||
| + 			hapd->iface->cac_started ? hapd->iface->dfs_cac_ms / 1000 - now.sec : 0); | ||||
| + 	blobmsg_close_table(&b, dfs_table); | ||||
| +  | ||||
| ++	if (hapd->conf->uci_section) | ||||
| ++		blobmsg_add_string(&b, "uci_section", hapd->conf->uci_section); | ||||
| ++ | ||||
| + 	ubus_send_reply(ctx, req, b.head); | ||||
| +  | ||||
| + 	return 0; | ||||
| +Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.c | ||||
| +=================================================================== | ||||
| +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.c | ||||
| ++++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.c | ||||
| +@@ -785,6 +785,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->uci_section); | ||||
| + 	os_free(conf->config_id); | ||||
| + 	os_free(conf->ca_cert); | ||||
| + 	os_free(conf->server_cert); | ||||
| --  | ||||
| 2.25.1 | ||||
|  | ||||
							
								
								
									
										108
									
								
								patches/wifi/0021-hostapd-add-dynamic_probe_resp.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								patches/wifi/0021-hostapd-add-dynamic_probe_resp.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,108 @@ | ||||
| From 4688450129baef1b5e495256947075f992778a1f Mon Sep 17 00:00:00 2001 | ||||
| From: John Crispin <john@phrozen.org> | ||||
| Date: Wed, 16 Nov 2022 16:40:01 +0100 | ||||
| Subject: [PATCH 21/21] hostapd: add dynamic_probe_resp | ||||
|  | ||||
| Signed-off-by: John Crispin <john@phrozen.org> | ||||
| --- | ||||
|  .../network/services/hostapd/files/hostapd.sh |  6 ++- | ||||
|  .../hostapd/patches/999-probe-request.patch   | 49 +++++++++++++++++++ | ||||
|  2 files changed, 54 insertions(+), 1 deletion(-) | ||||
|  create mode 100644 package/network/services/hostapd/patches/999-probe-request.patch | ||||
|  | ||||
| diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh | ||||
| index c308d1d2de..8362158cb0 100644 | ||||
| --- a/package/network/services/hostapd/files/hostapd.sh | ||||
| +++ b/package/network/services/hostapd/files/hostapd.sh | ||||
| @@ -394,6 +394,8 @@ hostapd_common_add_bss_config() { | ||||
|  	config_add_boolean ratelimit | ||||
|   | ||||
|  	config_add_string uci_section | ||||
| + | ||||
| +	config_add_boolean dynamic_probe_resp | ||||
|  } | ||||
|   | ||||
|  hostapd_set_vlan_file() { | ||||
| @@ -629,7 +631,7 @@ hostapd_set_bss_options() { | ||||
|  		airtime_bss_weight airtime_bss_limit airtime_sta_weight \ | ||||
|  		multicast_to_unicast_all proxy_arp per_sta_vif \ | ||||
|  		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \ | ||||
| -		vendor_elements fils uci_section | ||||
| +		vendor_elements fils uci_section dynamic_probe_resp | ||||
|   | ||||
|  	set_default fils 0 | ||||
|  	set_default isolate 0 | ||||
| @@ -652,6 +654,7 @@ hostapd_set_bss_options() { | ||||
|  	set_default airtime_bss_weight 0 | ||||
|  	set_default airtime_bss_limit 0 | ||||
|  	set_default eap_server 0 | ||||
| +	set_default dynamic_probe_resp 0 | ||||
|   | ||||
|  	/usr/sbin/hostapd -vfils || fils=0 | ||||
|   | ||||
| @@ -677,6 +680,7 @@ hostapd_set_bss_options() { | ||||
|  	append bss_conf "preamble=$short_preamble" "$N" | ||||
|  	append bss_conf "wmm_enabled=$wmm" "$N" | ||||
|  	append bss_conf "ignore_broadcast_ssid=$hidden" "$N" | ||||
| +	append bss_conf "dynamic_probe_resp=$dynamic_probe_resp" "$N" | ||||
|  	append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N" | ||||
|  	append bss_conf "utf8_ssid=$utf8_ssid" "$N" | ||||
|  	append bss_conf "multi_ap=$multi_ap" "$N" | ||||
| diff --git a/package/network/services/hostapd/patches/999-probe-request.patch b/package/network/services/hostapd/patches/999-probe-request.patch | ||||
| new file mode 100644 | ||||
| index 0000000000..3b79338c2f | ||||
| --- /dev/null | ||||
| +++ b/package/network/services/hostapd/patches/999-probe-request.patch | ||||
| @@ -0,0 +1,49 @@ | ||||
| +Index: hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||
| +=================================================================== | ||||
| +--- hostapd-2021-02-20-59e9794c.orig/hostapd/config_file.c | ||||
| ++++ hostapd-2021-02-20-59e9794c/hostapd/config_file.c | ||||
| +@@ -3339,6 +3339,8 @@ static int hostapd_config_fill(struct ho | ||||
| + 		bss->ignore_broadcast_ssid = atoi(pos); | ||||
| + 	} else if (os_strcmp(buf, "no_probe_resp_if_max_sta") == 0) { | ||||
| + 		bss->no_probe_resp_if_max_sta = atoi(pos); | ||||
| ++	} else if (os_strcmp(buf, "dynamic_probe_resp") == 0) { | ||||
| ++		bss->dynamic_probe_resp = atoi(pos); | ||||
| + #ifdef CONFIG_WEP | ||||
| + 	} else if (os_strcmp(buf, "wep_default_key") == 0) { | ||||
| + 		bss->ssid.wep.idx = atoi(pos); | ||||
| +Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||
| +=================================================================== | ||||
| +--- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.h | ||||
| ++++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.h | ||||
| +@@ -460,6 +460,7 @@ struct hostapd_bss_config { | ||||
| + 	int ap_max_inactivity; | ||||
| + 	int ignore_broadcast_ssid; | ||||
| + 	int no_probe_resp_if_max_sta; | ||||
| ++	int dynamic_probe_resp; | ||||
| +  | ||||
| + 	int wmm_enabled; | ||||
| + 	int wmm_uapsd; | ||||
| +Index: hostapd-2021-02-20-59e9794c/src/ap/beacon.c | ||||
| +=================================================================== | ||||
| +--- hostapd-2021-02-20-59e9794c.orig/src/ap/beacon.c | ||||
| ++++ hostapd-2021-02-20-59e9794c/src/ap/beacon.c | ||||
| +@@ -920,7 +920,8 @@ void handle_probe_req(struct hostapd_dat | ||||
| + 	} | ||||
| + #endif /* CONFIG_P2P */ | ||||
| +  | ||||
| +-	if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && | ||||
| ++	if (!hapd->conf->dynamic_probe_resp && | ||||
| ++	    hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && | ||||
| + 	    elems.ssid_list_len == 0 && elems.short_ssid_list_len == 0) { | ||||
| + 		wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for " | ||||
| + 			   "broadcast SSID ignored", MAC2STR(mgmt->sa)); | ||||
| +@@ -967,7 +968,8 @@ void handle_probe_req(struct hostapd_dat | ||||
| + 		return; | ||||
| + 	} | ||||
| +  | ||||
| +-	if (hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { | ||||
| ++	if (!hapd->conf->dynamic_probe_resp && | ||||
| ++	    hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) { | ||||
| + 		wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for " | ||||
| + 			   "broadcast SSID ignored", MAC2STR(mgmt->sa)); | ||||
| + 		return; | ||||
| --  | ||||
| 2.25.1 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin