nl80211: Ignore interface up event if interface is down

The RTM_NEWLINK even can have IFF_UP flag even if the interface is
down. Do not generate EVENT_INTERFACE_ENABLED event based on such a
message.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2011-12-03 13:18:57 +02:00
parent f98eb880eb
commit aef85ba204

View file

@ -584,6 +584,7 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
int attrlen, rta_len;
struct rtattr *attr;
u32 brid = 0;
char namebuf[IFNAMSIZ];
drv = nl80211_find_drv(global, ifi->ifi_index, buf, len);
if (!drv) {
@ -601,7 +602,6 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
(ifi->ifi_flags & IFF_DORMANT) ? "[DORMANT]" : "");
if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) {
char namebuf[IFNAMSIZ];
if (if_indextoname(ifi->ifi_index, namebuf) &&
linux_iface_up(drv->global->ioctl_sock,
drv->first_bss.ifname) > 0) {
@ -622,9 +622,18 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
}
if (drv->if_disabled && (ifi->ifi_flags & IFF_UP)) {
if (if_indextoname(ifi->ifi_index, namebuf) &&
linux_iface_up(drv->global->ioctl_sock,
drv->first_bss.ifname) == 0) {
wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up "
"event since interface %s is down",
namebuf);
} else {
wpa_printf(MSG_DEBUG, "nl80211: Interface up");
drv->if_disabled = 0;
wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED, NULL);
wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
NULL);
}
}
/*
@ -655,7 +664,6 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
if (ifi->ifi_family == AF_BRIDGE && brid) {
/* device has been added to bridge */
char namebuf[IFNAMSIZ];
if_indextoname(brid, namebuf);
wpa_printf(MSG_DEBUG, "nl80211: Add ifindex %u for bridge %s",
brid, namebuf);