diff options
author | Jouni Malinen <j@w1.fi> | 2012-02-18 13:13:23 +0200 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2012-02-18 13:13:23 +0200 |
commit | d1f4942ba18a303d275bbd955161674939d1d902 (patch) | |
tree | 3b18c9f3af1df4102d1726479b06a6c94f7b27ef | |
parent | 8a6a1e1b14749a953814cf7e90da59649fa1ce59 (diff) | |
download | external_wpa_supplicant_8_ti-d1f4942ba18a303d275bbd955161674939d1d902.zip external_wpa_supplicant_8_ti-d1f4942ba18a303d275bbd955161674939d1d902.tar.gz external_wpa_supplicant_8_ti-d1f4942ba18a303d275bbd955161674939d1d902.tar.bz2 |
nl80211: Filter unexpected interface added/up events
It looks like a RTM_NEWLINK event claiming the interface to be UP is
delivered just before removing an interface after having first indicated
that the interface was going down/removed. Ignore this event if the
interface is not present anymore at the moment the event is processed.
This fixes issues where an interface that was re-added after being
removed did not get reconfigured properly.
Signed-hostap: Jouni Malinen <j@w1.fi>
intended-for: hostap-1
-rw-r--r-- | src/drivers/driver_nl80211.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 389080d..184b26f 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -783,10 +783,28 @@ static void wpa_driver_nl80211_event_link(struct wpa_driver_nl80211_data *drv, del ? "removed" : "added"); if (os_strcmp(drv->first_bss.ifname, event.interface_status.ifname) == 0) { - if (del) + if (del) { + if (drv->if_removed) { + wpa_printf(MSG_DEBUG, "nl80211: if_removed " + "already set - ignore event"); + return; + } drv->if_removed = 1; - else + } else { + if (if_nametoindex(drv->first_bss.ifname) == 0) { + wpa_printf(MSG_DEBUG, "nl80211: Interface %s " + "does not exist - ignore " + "RTM_NEWLINK", + drv->first_bss.ifname); + return; + } + if (!drv->if_removed) { + wpa_printf(MSG_DEBUG, "nl80211: if_removed " + "already cleared - ignore event"); + return; + } drv->if_removed = 0; + } } wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS, &event); @@ -903,6 +921,14 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx, wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up " "event since interface %s is down", namebuf); + } else if (if_nametoindex(drv->first_bss.ifname) == 0) { + wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up " + "event since interface %s does not exist", + drv->first_bss.ifname); + } else if (drv->if_removed) { + wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up " + "event since interface %s is marked " + "removed", drv->first_bss.ifname); } else { wpa_printf(MSG_DEBUG, "nl80211: Interface up"); drv->if_disabled = 0; |