[PATCH v2] hostapd: Return code-17 on max-station limitation.

Jouni Malinen j at w1.fi
Sun Apr 28 09:50:18 EDT 2013

On Wed, Apr 24, 2013 at 11:57:22AM -0700, greearb at candelatech.com wrote:
> I believe this is a more valid response code.

Status code 17 is actually "Association denied because AP is unable to
handle additional associated STAs" while this is used to deny
Authentication (not Association). Anyway, I'm fine with changing the
value since 17 is more descriptive even if this is not strictly speaking
allocated for Authentication frames.

> -struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
> +struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr,
> +			     u16* resp)

>  	sta = os_zalloc(sizeof(struct sta_info));
>  	if (sta == NULL) {
>  		wpa_printf(MSG_ERROR, "malloc failed");

However, this looks excessive. It is not like that memory allocation
would fail frequently and even if it did, returning AP unable to handle
new STA sounds fine.. No point in having to change all places that use
ap_sta_add() for this, i.e., the callers that care can just use
WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA. I applied this patch with such
change instead (i.e., just two one-liner changes to the status code

Jouni Malinen                                            PGP id EFC895FA

More information about the HostAP mailing list