[PATCH 1/2] MBO: add option to add MBO query list to ANQP query

Jouni Malinen j at w1.fi
Tue Mar 7 01:59:54 PST 2017


On Mon, Mar 06, 2017 at 02:59:54PM +0200, Andrei Otcheretianski wrote:
> MBO techspec v0.0_r27 change the MBO ANQP elements format.
> The MBO element in ANQP query should now include a MBO query list
> element that contains a list of MBO elements to query.
> 
> Add API to add the MBO query list to ANQP query. The MBO elements
> subtypes should be added as a colon delimited list.
> 
> format:
> ANQP_GET <bssid> <info_id>,mbo:<MBO element subtype>:...>

This format is not consistent with the existing ANQP_GET cases. Is there
a need for introducing this new syntax and the separate parsing loop for
it in get_anqp() instead of using the existing design and parsing loop?

The current parser uses the following encoding:

ANQP_GET <addr> <info id>[,<info id>]...[,hs20:<subtype>][...,hs20:<subtype>]

For example:
ANQP_GET 00:11:22:33:44:55:66 258,268,hs20:3,hs20:4


Adding MBO to it using the same style (,mbo:2,mbo:3,...) would seem more
consistent and simpler to implement as well and hopefully that would
avoid issues like this:

> diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
> @@ -6712,7 +6712,8 @@ static int get_anqp(struct wpa_supplicant *wpa_s, char *dst)

> +			while (mbo_pos &&
> +			       num_mbo_elems <= MAX_MBO_ANQP_SUBTYPE) {
> +				mbo_elems[num_mbo_elems] = atoi(mbo_pos);
> +				if (mbo_elems[num_mbo_elems] >
> +				    MAX_MBO_ANQP_SUBTYPE) {
> +					wpa_printf(MSG_DEBUG,
> +						   "Invalid MBO ANQP element subtype: %u",
> +						   mbo_elems[num_mbo_elems]);
> +					return -1;
> +				}
> +
> +				num_mbo_elems++;
> +				mbo_pos = os_strchr(mbo_pos, ':');
> +			}

This parser is broken since mbo_pos would be pointing at the separating
colon in the second iteration and atoi(":<int>") returns 0, not <int>..

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list