]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Ignore ifdown event if mode change triggered it
authorJouni Malinen <j@w1.fi>
Sun, 17 Jul 2011 10:56:34 +0000 (13:56 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 17 Jul 2011 10:56:34 +0000 (13:56 +0300)
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.

src/drivers/driver_nl80211.c

index d0f256c575a713af3adfba38684f34df4e2798f3..1a5b6288dd897e8c9073ee341ba83d50c72b8923 100644 (file)
@@ -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: