<p dir="ltr">Hi Jouni,</p>
<p dir="ltr">Did you get a chance to look into logs?<br>
Are these logs OK?</p>
<p dir="ltr">Thanks,<br>
-Avinash</p>
<div class="gmail_quote">On May 14, 2014 10:07 AM, &quot;Avinash Patil&quot; &lt;<a href="mailto:avinashapatil@gmail.com">avinashapatil@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Jouni,<br>
<br>
Please find attached logs for failure case without these changes.<br>
<br>
Also my comments inline.<br>
<br>
Thanks,<br>
Avinash<br>
On Tue, May 13, 2014 at 7:36 PM, Jouni Malinen &lt;<a href="mailto:j@w1.fi">j@w1.fi</a>&gt; wrote:<br>
&gt; On Tue, May 13, 2014 at 03:46:05PM +0530, Avinash Patil wrote:<br>
&gt;&gt; We add interface manually by &quot;iw dev interface wlan0 add uap0 type<br>
&gt;&gt; __ap&quot; and then we start AP operations using supplicant.<br>
&gt;&gt; Typical configuration file would be like this:<br>
&gt;&gt;<br>
&gt;&gt; network={<br>
&gt;&gt;          ssid=&quot;supplicant_ap&quot;<br>
&gt;&gt;          key_mgmt=NONE<br>
&gt;&gt;          mode=2<br>
&gt;&gt;          frequency=2432<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt; #wpa_supplicant -Dnl80211 -i uap0 -c ap.conf<br>
&gt;<br>
&gt; Does this fail for you without the change? If so, could you please share<br>
&gt; a wpa_supplicant debug log showing the failure?<br>
&gt;<br>
&gt;&gt; &gt;&gt; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c<br>
&gt;&gt; &gt;&gt; @@ -4698,7 +4698,7 @@ wpa_driver_nl80211_finish_drv_init(struct<br>
&gt;&gt; &gt;&gt; -       if (drv-&gt;hostapd)<br>
&gt;&gt; &gt;&gt; +       if (drv-&gt;hostapd || nl80211_get_ifmode(bss) == NL80211_IFTYPE_AP)<br>
&gt;&gt; &gt;&gt;                 nlmode = NL80211_IFTYPE_AP;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; This breaks the case of something first setting wlan0 to non-station<br>
&gt;&gt; &gt; mode (e.g., &quot;iw wlan0 set type __ap&quot;) followed by wpa_supplicant started<br>
&gt;&gt; &gt; on wlan0. The expectation there is that wpa_supplicant runs operations<br>
&gt;&gt; &gt; in station mode until requested to something else (e.g., start AP mode).<br>
&gt;&gt;<br>
&gt;&gt; I did not fully understand this scenario but I think you are referring<br>
&gt;&gt; to similar situation as I described earlier except while I am adding<br>
&gt;&gt; interface, in this case interface type is changed.<br>
&gt;<br>
&gt; I&#39;m talking about the exact same way of adding the vif, but different<br>
&gt; wpa_supplicant configuration, i.e., a configuration that does not enable<br>
&gt; AP mode operations.<br>
&gt;<br>
&gt;&gt; &gt; Why would this change be needed in the first place? Doesn&#39;t<br>
&gt;&gt; &gt; wpa_supplicant set the interface to AP mode when the AP mode network is<br>
&gt;&gt; &gt; being configured?<br>
&gt;&gt;<br>
&gt;&gt; This handles a case where AP&lt;=&gt;STA change_virtual_interface is not<br>
&gt;&gt; supported but we know that interface on which supplicant is started is<br>
&gt;&gt; AP interface.<br>
&gt;&gt; To ensure that this check applies only to statically created<br>
&gt;&gt; interface, we can add one more check:<br>
&gt;&gt;<br>
&gt;&gt;       if (drv-&gt;hostapd || (nl80211_get_ifmode(bss) ==<br>
&gt;&gt; NL80211_IFTYPE_AP &amp;&amp; !bss-&gt;if_dynamic))<br>
&gt;&gt;                  nlmode = NL80211_IFTYPE_AP;<br>
&gt;<br>
&gt; The problem here is that this function does not know what wpa_supplicant<br>
&gt; will do next. In the example I described, the new operation would not be<br>
&gt; AP mode and as such, changing to AP mode here would not be correct. In<br>
&gt; the example you are describing, the next operation is AP mode, but the<br>
&gt; code here has no way of knowing that and as such, I don&#39;t think it<br>
&gt; should use the current iftype of the interface to try to guess what<br>
&gt; might be happening next.<br>
<br>
Maybe we can have another config file parameter (e.g. static_ap=1) to<br>
indicate changing to default NL_IFTYPE type STATATION is not supported<br>
and supplicant should set iftype as AP during initialization.<br>
<br>
&gt; --<br>
&gt; Jouni Malinen                                            PGP id EFC895FA<br>
</blockquote></div>