Subject: [PATCH] hostapd: Add testing option for association_response_status_code

Raga, Gopi gopiraga at amazon.com
Wed Jan 28 02:52:46 PST 2026


Hi Jouni,

Thanks for the review and the detailed feedback.

The motivation for this testing feature is to study client behavior for specific Association Response status codes that are otherwise difficult to trigger naturally, since hostapd sends many of these codes only when the corresponding protocol condition is met. This makes it hard to validate client behavior or collect expected metrics for all possible status codes.

I agree with your concern that a static configuration option in hostapd.conf is not appropriate, since it would affect all association responses. To address this, I am planning to redesign this as a dynamic, runtime-only testing feature using the control interface.

The updated approach would be:

1. Introduce a new control interface command, for example:
hostapd_cli test_assoc_status_code <status_code> <enable|disable> [mac]

2. When enabled, hostapd would override the Association Response status code for subsequent associations. If a MAC address is specified, the override would apply only to that specific STA; otherwise, it would apply to all STAs.

3. The functionality would be implemented entirely under CONFIG_TESTING_OPTIONS, with no persistent configuration.

This keeps the feature scoped, dynamic, and suitable for testing without impacting normal operation.

Please let me know if this design direction looks reasonable, and I will proceed with an updated patch.

Regards,
Gopi Raga


On 25/01/2026, 11:59 PM, "Jouni Malinen" <j at w1.fi <mailto:j at w1.fi>> wrote:


CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.






On Mon, Oct 27, 2025 at 12:47:17PM +0000, Raga, Gopi wrote:
> From 654e923d8322da21fb1f925766711ff2ee1c0a6c Mon Sep 17 00:00:00 2001
> From: gopiraga <mailto:gopiraga at amazon.com <mailto:gopiraga at amazon.com>>


That From: entry (i.e., source of author information for the commit)
does not look correct..


> This adds a new testing option to allow controlling the association
> response status code returned by hostapd for testing purposes.
>
> Signed-off-by: Gopi Raga <mailto:gopiraga at amazon.com <mailto:gopiraga at amazon.com>>


Nor that email address..


> diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
> @@ -3402,6 +3402,11 @@ own_ip_addr=127.0.0.1
> +# Send Custom Status Code in Association Response
> +# Example association_response_status_code=15
> +#association_response_status_code=0


This feels quite strange item to configure as a fixed value for all
association frames. What kind of testing is this for? I would have
expected something more dynamic like specifying status code for the
following single (Re)Association Response frame using the control
interface would be more useful.


> diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
> @@ -6179,6 +6179,15 @@ static void handle_assoc(struct hostapd_data *hapd,
>
> +#ifdef CONFIG_TESTING_OPTIONS
> + if (hapd->conf->association_response_status_code >= 0) {
> + wpa_printf(MSG_INFO,
> + "TESTING: Overriding association response status code from %d to %d for STA " MACSTR,
> + resp, hapd->conf->association_response_status_code, MAC2STR(mgmt->sa));
> + resp = hapd->conf->association_response_status_code;
> + }
> +#endif /* CONFIG_TESTING_OPTIONS */


This was under CONFIG_TESTING_OPTIONS, but the other parts were not..
Those other ones should have been as well to be consistent.


--
Jouni Malinen PGP id EFC895FA





More information about the Hostap mailing list