Search Linux Wireless

Re: [PATCH] cfg80211: merge in beacon ies of hidden bss.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi Dmitry,

On Wed, Nov 2, 2011 at 8:19 PM, Dmitry Tarnyagin <abi.dmitryt@xxxxxxxxx> wrote:
> The problem with PSM when a hidden SSID was used was originally
> reported by Juuso Oikarinen.
>
>  - When generally scanning, the AP is getting a bss entry with
>   a zero SSID.
>  - When associationg, a probe-req is sent to the AP with the SSID,
>   and as a result a probe-responseis received with the hidden
>   SSID in place. As a consequence, a second bss entry is created
>   for the AP, now with the real SSID.
>  - After association, mac80211 executes ieee80211_recalc_ps(),
>   but does not switch to powersave becuse the beacon-ies are missing.
>
> As result, the STA does not ever enter PSM.
>
> The patch merges in beacon ies of hidden bss from beacon to the probe
> response, creating a consistant set of ies in place.
>
> Signed-off-by: Dmitry Tarnyagin <dmitry.tarnyagin@xxxxxxxxxxxxxx>
> ---
[...]
> +static int cmp_hidden_bss(struct cfg80211_bss *a,
> +                  struct cfg80211_bss *b)
> +{
> +       const u8 *ie1;
> +       const u8 *ie2;
> +       size_t ielen;
> +       int i;
> +       int r;
> +
> +       r = cmp_bss_core(a, b);
> +       if (r)
> +               return r;
> +
> +       ie1 = cfg80211_find_ie(WLAN_EID_SSID,
> +                       a->information_elements,
> +                       a->len_information_elements);
> +       ie2 = cfg80211_find_ie(WLAN_EID_SSID,
> +                       b->information_elements,
> +                       b->len_information_elements);
> +       if (!ie1 && !ie2)
> +               return 0;
> +       if (!ie1 || !ie2)
> +               return -1;
> +
> +       ielen = min(ie1[1], ie2[1]);
> +       for (i = 0; i < ielen; ++i)
> +               if (ie2[i + 2])
> +                       return -1;
> +
> +       return ie2[1] - ie1[1];

you don't account for the ssid = "" case.


> +static int
> +merge_hidden_ies(struct cfg80211_internal_bss *res,
> +                struct cfg80211_internal_bss *hidden)
> +{
> +       if (unlikely(res->pub.beacon_ies))
> +               return -EALREADY;
> +       if (WARN_ON(!hidden->pub.beacon_ies))
> +               return -EINVAL;
> +
> +       res->pub.beacon_ies = kmalloc(hidden->pub.len_beacon_ies, GFP_ATOMIC);
> +       if (unlikely(!res->pub.beacon_ies))
> +               return -ENOMEM;
> +
> +       res->beacon_ies_allocated = true;
> +       res->pub.len_beacon_ies = hidden->pub.len_beacon_ies;
> +       memcpy(res->pub.beacon_ies, hidden->pub.beacon_ies,
> +                       res->pub.len_beacon_ies);
> +
> +       return 0;
> +}
> +
i think the "merge" here is a bit misleading - there is no actual merge.
you copy the beacon_ies from the beacon, but we still end up with 2 bss nodes.
your solution does workaround the specific psm problem, but we still
end up with a duplicate bss conf node that will never get updated
(because the beacons will update the "original" bss node).

i guess this problem already exists with the current code.
not sure what is the correct way solve it, though.
maybe check for both the hidden name and the actual name?

Eliad.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux