]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Indicate interface up only for the main netdev
authorHu Wang <huw@codeaurora.org>
Tue, 26 Jun 2018 02:56:29 +0000 (10:56 +0800)
committerJouni Malinen <j@w1.fi>
Thu, 5 Jul 2018 10:41:46 +0000 (13:41 +0300)
ifname is checked for interface down event in commit
106fa1e97e29e7514ae324020802c280f993ee48 ("nl80211: Indicate
interface-down event only for the main netdev"). Do the same for
interface up event to avoid unexpected notifications when the master
interface (e.g., a bridge interface) is set up while then WLAN interface
remains down.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/drivers/driver_nl80211.c

index 9d8137e009b6db0919e59cf7b697e3b98af83c84..16bae490707002c6e7e199430c20b4198b642445 100644 (file)
@@ -1079,11 +1079,20 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
        }
 
        if (drv->if_disabled && (ifi->ifi_flags & IFF_UP)) {
+               namebuf[0] = '\0';
                if (if_indextoname(ifi->ifi_index, namebuf) &&
                    linux_iface_up(drv->global->ioctl_sock, namebuf) == 0) {
                        wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up "
                                   "event since interface %s is down",
                                   namebuf);
+                       return;
+               }
+               wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)",
+                          namebuf, ifname);
+               if (os_strcmp(drv->first_bss->ifname, ifname) != 0) {
+                       wpa_printf(MSG_DEBUG,
+                                  "nl80211: Not the main interface (%s) - do not indicate interface up",
+                                  drv->first_bss->ifname);
                } else if (if_nametoindex(drv->first_bss->ifname) == 0) {
                        wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up "
                                   "event since interface %s does not exist",
@@ -1096,7 +1105,6 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
                        /* Re-read MAC address as it may have changed */
                        nl80211_refresh_mac(drv, ifi->ifi_index, 0);
 
-                       wpa_printf(MSG_DEBUG, "nl80211: Interface up");
                        drv->if_disabled = 0;
                        wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,
                                             NULL);