[PATCH 2/2] driver_nl80211: handle P2P scans correctly

Eliad Peller eliad
Tue Jul 19 04:57:09 PDT 2011


On Mon, Jul 18, 2011 at 8:07 PM, Johannes Berg
<johannes at sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg at intel.com>
>
> To handle P2P scans, remove 11b rates from the list
> of supported rates if present. To do that, we need
> to build a list of supported rates first.
>
> Signed-off-by: Johannes Berg <johannes.berg at intel.com>
> ---
> Note: depends on new kernel patches and nl80211 API update
[...]

> ?struct phy_info_arg {
> + ? ? ? struct wpa_driver_nl80211_data *drv;
> ? ? ? ?u16 *num_modes;
> ? ? ? ?struct hostapd_hw_modes *modes;
> ?};
> @@ -3270,6 +3305,8 @@ static int phy_info_handler(struct nl_ms
> ? ? ? ?int rem_band, rem_freq, rem_rate;
> ? ? ? ?struct hostapd_hw_modes *mode;
> ? ? ? ?int idx, mode_is_set;
> + ? ? ? int rates_known = phy_info->drv->rates != NULL;
> + ? ? ? int num_bands = 0, band_idx = 0;
>
> ? ? ? ?nla_parse(tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
> ? ? ? ? ? ? ? ? ?genlmsg_attrlen(gnlh, 0), NULL);
> @@ -3277,7 +3314,19 @@ static int phy_info_handler(struct nl_ms
> ? ? ? ?if (!tb_msg[NL80211_ATTR_WIPHY_BANDS])
> ? ? ? ? ? ? ? ?return NL_SKIP;
>
> + ? ? ? nla_for_each_nested(nl_band, tb_msg[NL80211_ATTR_WIPHY_BANDS], rem_band)
> + ? ? ? ? ? ? ? num_bands++;
> +
> + ? ? ? if (!rates_known) {
> + ? ? ? ? ? ? ? phy_info->drv->num_bands = num_bands;
> + ? ? ? ? ? ? ? phy_info->drv->rates = os_malloc(num_bands * sizeof(phy_info->drv->rates[0]));
> + ? ? ? ? ? ? ? if (!phy_info->drv->rates)
> + ? ? ? ? ? ? ? ? ? ? ? return NL_SKIP;
> + ? ? ? }
> +
there are missing cleanups for drv->rates (for both success and failure).



More information about the Hostap mailing list