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.
This commit is contained in:
Jouni Malinen 2011-07-17 13:56:34 +03:00
parent 4283805972
commit 7d9c369827

View 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: