[RFC] nl80211: set NLMODE correctly for AP interface
Avinash Patil
avinashapatil
Tue May 13 03:16:05 PDT 2014
Hi Jouni,
On Mon, May 12, 2014 at 9:07 PM, Jouni Malinen <j at w1.fi> wrote:
> On Fri, May 02, 2014 at 06:48:36PM +0530, Avinash Patil wrote:
>> During supplicant/hostapd initialization, current implementation
>> sets NLMODE as AP only when hostapd has been started or for dynamically
>> created interfaces.
>> If supplicant is used for AP operations on statically created AP
>> interfaces, this also should also set NLMODE as AP.
>
> Could you please clarify how exactly this configuration is done
> (configuration file details and how the interface is added and
> configured)?
We add interface manually by "iw dev interface wlan0 add uap0 type
__ap" and then we start AP operations using supplicant.
Typical configuration file would be like this:
network={
ssid="supplicant_ap"
key_mgmt=NONE
mode=2
frequency=2432
}
#wpa_supplicant -Dnl80211 -i uap0 -c ap.conf
>> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
>> @@ -4698,7 +4698,7 @@ wpa_driver_nl80211_finish_drv_init(struct
>> - if (drv->hostapd)
>> + if (drv->hostapd || nl80211_get_ifmode(bss) == NL80211_IFTYPE_AP)
>> nlmode = NL80211_IFTYPE_AP;
>
> This breaks the case of something first setting wlan0 to non-station
> mode (e.g., "iw wlan0 set type __ap") followed by wpa_supplicant started
> on wlan0. The expectation there is that wpa_supplicant runs operations
> in station mode until requested to something else (e.g., start AP mode).
I did not fully understand this scenario but I think you are referring
to similar situation as I described earlier except while I am adding
interface, in this case interface type is changed.
> Why would this change be needed in the first place? Doesn't
> wpa_supplicant set the interface to AP mode when the AP mode network is
> being configured?
This handles a case where AP<=>STA change_virtual_interface is not
supported but we know that interface on which supplicant is started is
AP interface.
To ensure that this check applies only to statically created
interface, we can add one more check:
if (drv->hostapd || (nl80211_get_ifmode(bss) ==
NL80211_IFTYPE_AP && !bss->if_dynamic))
nlmode = NL80211_IFTYPE_AP;
Please let me know your comments.
Thanks,
Avinash.
> --
> Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list