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:
parent
f98eb880eb
commit
aef85ba204
1 changed files with 13 additions and 5 deletions
|
@ -584,6 +584,7 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
|
||||||
int attrlen, rta_len;
|
int attrlen, rta_len;
|
||||||
struct rtattr *attr;
|
struct rtattr *attr;
|
||||||
u32 brid = 0;
|
u32 brid = 0;
|
||||||
|
char namebuf[IFNAMSIZ];
|
||||||
|
|
||||||
drv = nl80211_find_drv(global, ifi->ifi_index, buf, len);
|
drv = nl80211_find_drv(global, ifi->ifi_index, buf, len);
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
|
@ -601,7 +602,6 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
|
||||||
(ifi->ifi_flags & IFF_DORMANT) ? "[DORMANT]" : "");
|
(ifi->ifi_flags & IFF_DORMANT) ? "[DORMANT]" : "");
|
||||||
|
|
||||||
if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) {
|
if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) {
|
||||||
char namebuf[IFNAMSIZ];
|
|
||||||
if (if_indextoname(ifi->ifi_index, namebuf) &&
|
if (if_indextoname(ifi->ifi_index, namebuf) &&
|
||||||
linux_iface_up(drv->global->ioctl_sock,
|
linux_iface_up(drv->global->ioctl_sock,
|
||||||
drv->first_bss.ifname) > 0) {
|
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 (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");
|
wpa_printf(MSG_DEBUG, "nl80211: Interface up");
|
||||||
drv->if_disabled = 0;
|
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) {
|
if (ifi->ifi_family == AF_BRIDGE && brid) {
|
||||||
/* device has been added to bridge */
|
/* device has been added to bridge */
|
||||||
char namebuf[IFNAMSIZ];
|
|
||||||
if_indextoname(brid, namebuf);
|
if_indextoname(brid, namebuf);
|
||||||
wpa_printf(MSG_DEBUG, "nl80211: Add ifindex %u for bridge %s",
|
wpa_printf(MSG_DEBUG, "nl80211: Add ifindex %u for bridge %s",
|
||||||
brid, namebuf);
|
brid, namebuf);
|
||||||
|
|
Loading…
Reference in a new issue