diff mbox series

hostapd: Add MBSSID DTIM fields for nontransmitting VAP

Message ID 20200805044552.25245-1-alokad@codeaurora.org
State New
Headers show
Series hostapd: Add MBSSID DTIM fields for nontransmitting VAP | expand

Commit Message

Aloka Dixit Aug. 5, 2020, 4:45 a.m. UTC
This patch adds missing mandatory fields in MBSSID Index element
(DTIM period and count) for non transmitting interfaces.

Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
---
Depends-on: "multiple_bssid: add support" series in upstream review

 src/ap/beacon.c     |  4 ++--
 src/ap/ieee802_11.c | 18 +++++++++++++-----
 src/ap/ieee802_11.h |  3 ++-
 3 files changed, 17 insertions(+), 8 deletions(-)


base-commit: 02f4946172dea335d1ed7fde7e8de3ebbdef859a
prerequisite-patch-id: 6f0719fba383f1e0dc762be7da5788029f34cc3a
prerequisite-patch-id: 22601d88ad72e4e9addec18b0c9257c484045832
prerequisite-patch-id: 0705e4aacca8246468960bbc15f8286d666af505
prerequisite-patch-id: 8d54a8fe0bca799e6bcc4a00dd85106a8237dd5d
prerequisite-patch-id: ac87754ecaa990144d7fbf75ed2cebd2beab5de4
prerequisite-patch-id: e7bb814f80cee4bfe863b990695fcc3ba5229248
prerequisite-patch-id: 95cb792fddaafba73bb5e62dc6062b8e851b1421

Comments

John Crispin Aug. 5, 2020, 6:25 p.m. UTC | #1
Thanks, I will fold these 2 patches into my next version of the series

     John


On 05.08.20 06:45, Aloka Dixit wrote:
> This patch adds missing mandatory fields in MBSSID Index element
> (DTIM period and count) for non transmitting interfaces.
>
> Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
> ---
> Depends-on: "multiple_bssid: add support" series in upstream review
>
>   src/ap/beacon.c     |  4 ++--
>   src/ap/ieee802_11.c | 18 +++++++++++++-----
>   src/ap/ieee802_11.h |  3 ++-
>   3 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/src/ap/beacon.c b/src/ap/beacon.c
> index 03cca305a93e..5beaa5448b04 100644
> --- a/src/ap/beacon.c
> +++ b/src/ap/beacon.c
> @@ -529,7 +529,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
>   	pos = hostapd_get_mde(hapd, pos, epos - pos);
>   
>           if (hapd->iconf->multiple_bssid)
> -		pos = hostapd_eid_multiple_bssid(hapd, pos, epos);
> +		pos = hostapd_eid_multiple_bssid(hapd, pos, epos, 0);
>   
>   	/* eCSA IE */
>   	csa_pos = hostapd_eid_ecsa(hapd, pos);
> @@ -1255,7 +1255,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
>   	tailpos = hostapd_get_mde(hapd, tailpos, tailend - tailpos);
>   
>   	if (hapd->iconf->multiple_bssid)
> -		tailpos = hostapd_eid_multiple_bssid(hapd, tailpos, tailend);
> +		tailpos = hostapd_eid_multiple_bssid(hapd, tailpos, tailend, 1);
>   
>   	/* eCSA IE */
>   	csa_pos = hostapd_eid_ecsa(hapd, tailpos);
> diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
> index b0575337b2ee..dac144bb7cfa 100644
> --- a/src/ap/ieee802_11.c
> +++ b/src/ap/ieee802_11.c
> @@ -5659,7 +5659,8 @@ int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd)
>   
>   
>   static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
> -					     u8 *eid, u8 *end, int *count)
> +					     u8 *eid, u8 *end, int *count,
> +					     u8 is_beacon)
>   {
>   	u8 *size_offset, *num_offset, num = 0;
>   	int i;
> @@ -5670,7 +5671,7 @@ static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
>   
>   	for (i = *count; i < hapd->iface->num_bss; i++) {
>   		struct hostapd_data *bss = hapd->iface->bss[i];
> -		u8 *bss_size_offset, *pos = eid;
> +		u8 *bss_size_offset, *index_size_offset, *pos = eid;
>   		u16 capab_info;
>   
>   		*eid++ = WLAN_EID_SUBELEMENT_NONTRANSMITTED_BSSID_PROFILE;
> @@ -5688,8 +5689,13 @@ static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
>   		eid += bss->conf->ssid.ssid_len;
>   
>   		*eid++ = WLAN_EID_MULTIPLE_BSSID_INDEX;
> -		*eid++ = 1;
> +		index_size_offset = eid++;
>   		*eid++ = i;
> +		if (is_beacon) {
> +			*eid++ = bss->conf->dtim_period;
> +			*eid++ = 0xFF;
> +		}
> +		*index_size_offset = (eid - index_size_offset) - 1;
>   
>   		eid = hostapd_get_rsne(bss, eid, end - eid);
>   		*bss_size_offset = (eid - bss_size_offset) - 1;
> @@ -5712,12 +5718,14 @@ multiple_bssid_too_big:
>   }
>   
>   
> -u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end)
> +u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
> +				u8 is_beacon)
>   {
>   	int count = 1;
>   
>   	while (count < hapd->iface->num_bss)
> -		eid = hostapd_eid_multiple_bssid_chunk(hapd, eid, end, &count);
> +		eid = hostapd_eid_multiple_bssid_chunk(hapd, eid, end, &count,
> +						       is_beacon);
>   
>   	return eid;
>   }
> diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
> index 466938f59ed4..d04adfef135d 100644
> --- a/src/ap/ieee802_11.h
> +++ b/src/ap/ieee802_11.h
> @@ -119,7 +119,8 @@ u8 * hostapd_eid_time_zone(struct hostapd_data *hapd, u8 *eid);
>   int hostapd_update_time_adv(struct hostapd_data *hapd);
>   void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
>   u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid);
> -u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end);
> +u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
> +				u8 is_beacon);
>   int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd);
>   
>   int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
>
> base-commit: 02f4946172dea335d1ed7fde7e8de3ebbdef859a
> prerequisite-patch-id: 6f0719fba383f1e0dc762be7da5788029f34cc3a
> prerequisite-patch-id: 22601d88ad72e4e9addec18b0c9257c484045832
> prerequisite-patch-id: 0705e4aacca8246468960bbc15f8286d666af505
> prerequisite-patch-id: 8d54a8fe0bca799e6bcc4a00dd85106a8237dd5d
> prerequisite-patch-id: ac87754ecaa990144d7fbf75ed2cebd2beab5de4
> prerequisite-patch-id: e7bb814f80cee4bfe863b990695fcc3ba5229248
> prerequisite-patch-id: 95cb792fddaafba73bb5e62dc6062b8e851b1421
diff mbox series

Patch

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 03cca305a93e..5beaa5448b04 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -529,7 +529,7 @@  static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 	pos = hostapd_get_mde(hapd, pos, epos - pos);
 
         if (hapd->iconf->multiple_bssid)
-		pos = hostapd_eid_multiple_bssid(hapd, pos, epos);
+		pos = hostapd_eid_multiple_bssid(hapd, pos, epos, 0);
 
 	/* eCSA IE */
 	csa_pos = hostapd_eid_ecsa(hapd, pos);
@@ -1255,7 +1255,7 @@  int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	tailpos = hostapd_get_mde(hapd, tailpos, tailend - tailpos);
 
 	if (hapd->iconf->multiple_bssid)
-		tailpos = hostapd_eid_multiple_bssid(hapd, tailpos, tailend);
+		tailpos = hostapd_eid_multiple_bssid(hapd, tailpos, tailend, 1);
 
 	/* eCSA IE */
 	csa_pos = hostapd_eid_ecsa(hapd, tailpos);
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index b0575337b2ee..dac144bb7cfa 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -5659,7 +5659,8 @@  int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd)
 
 
 static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
-					     u8 *eid, u8 *end, int *count)
+					     u8 *eid, u8 *end, int *count,
+					     u8 is_beacon)
 {
 	u8 *size_offset, *num_offset, num = 0;
 	int i;
@@ -5670,7 +5671,7 @@  static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
 
 	for (i = *count; i < hapd->iface->num_bss; i++) {
 		struct hostapd_data *bss = hapd->iface->bss[i];
-		u8 *bss_size_offset, *pos = eid;
+		u8 *bss_size_offset, *index_size_offset, *pos = eid;
 		u16 capab_info;
 
 		*eid++ = WLAN_EID_SUBELEMENT_NONTRANSMITTED_BSSID_PROFILE;
@@ -5688,8 +5689,13 @@  static u8 * hostapd_eid_multiple_bssid_chunk(struct hostapd_data *hapd,
 		eid += bss->conf->ssid.ssid_len;
 
 		*eid++ = WLAN_EID_MULTIPLE_BSSID_INDEX;
-		*eid++ = 1;
+		index_size_offset = eid++;
 		*eid++ = i;
+		if (is_beacon) {
+			*eid++ = bss->conf->dtim_period;
+			*eid++ = 0xFF;
+		}
+		*index_size_offset = (eid - index_size_offset) - 1;
 
 		eid = hostapd_get_rsne(bss, eid, end - eid);
 		*bss_size_offset = (eid - bss_size_offset) - 1;
@@ -5712,12 +5718,14 @@  multiple_bssid_too_big:
 }
 
 
-u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end)
+u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
+				u8 is_beacon)
 {
 	int count = 1;
 
 	while (count < hapd->iface->num_bss)
-		eid = hostapd_eid_multiple_bssid_chunk(hapd, eid, end, &count);
+		eid = hostapd_eid_multiple_bssid_chunk(hapd, eid, end, &count,
+						       is_beacon);
 
 	return eid;
 }
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index 466938f59ed4..d04adfef135d 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -119,7 +119,8 @@  u8 * hostapd_eid_time_zone(struct hostapd_data *hapd, u8 *eid);
 int hostapd_update_time_adv(struct hostapd_data *hapd);
 void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
 u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid);
-u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end);
+u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
+				u8 is_beacon);
 int hostapd_eid_multiple_bssid_len(struct hostapd_data *hapd);
 
 int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);