wpa_supplicant AP: Disable AP mode on disassoc paths - problems

Jouni Malinen j at w1.fi
Sun Jul 17 07:01:06 EDT 2011


On Fri, Jul 15, 2011 at 09:17:39AM +0200, Janusz Dziedzic wrote:
> commit ca62e114aa7b716fc5edc5e8da5e20b74d942201
> Author: Jouni Malinen <j at w1.fi>
> Date:   Tue Jul 5 16:38:30 2011 +0300
> 
>     wpa_supplicant AP: Disable AP mode on disassoc paths

> Generate problems in case of wpa_supplicant AP mode.
> Operstate is always 0 (RTM_NEWLINK: operstate=0) for drivers that
> can't change interface mode when UP.

I see even worse issues in the AP mode never coming up properly at all
when testing with hwsim hacked to not allow dynamic iftype changes. The
key problem here seems to be in the undesired EVENT_INTERFACE_DISABLED
event generated in the case where wpa_supplicant set the interface down
itself. Before this commit, that was mostly ignored. The following
change fixes this in my tests:
 
commit 7d9c369827e9413da985a26946bd52fbbe5d5acb
Author: Jouni Malinen <j at w1.fi>
Date:   Sun Jul 17 13:56:34 2011 +0300

    nl80211: Ignore ifdown event if mode change triggered it
    
    When driver_nl80211.c has to set the netdev down to change iftype, an
    RTM_NEWLINK event is generated. Do not generate
    EVENT_INTERFACE_DISABLED event based on that.

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index d0f256c..1a5b628 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -129,6 +129,7 @@ struct wpa_driver_nl80211_data {
 	int ifindex;
 	int if_removed;
 	int if_disabled;
+	int ignore_if_down_event;
 	struct rfkill_data *rfkill;
 	struct wpa_driver_capa capa;
 	int has_capability;
@@ -486,8 +487,15 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
 
 	if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) {
 		wpa_printf(MSG_DEBUG, "nl80211: Interface down");
-		drv->if_disabled = 1;
-		wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED, NULL);
+		if (drv->ignore_if_down_event) {
+			wpa_printf(MSG_DEBUG, "nl80211: Ignore interface down "
+				   "event generated by mode change");
+			drv->ignore_if_down_event = 0;
+		} else {
+			drv->if_disabled = 1;
+			wpa_supplicant_event(drv->ctx,
+					     EVENT_INTERFACE_DISABLED, NULL);
+		}
 	}
 
 	if (drv->if_disabled && (ifi->ifi_flags & IFF_UP)) {
@@ -5051,6 +5059,7 @@ static int wpa_driver_nl80211_set_mode(void *priv, int mode)
 		wpa_printf(MSG_DEBUG, "nl80211: Mode change succeeded while "
 			   "interface is down");
 		drv->nlmode = nlmode;
+		drv->ignore_if_down_event = 1;
 	}
 
 done:

-- 
Jouni Malinen                                            PGP id EFC895FA


More information about the HostAP mailing list