diff mbox series

[v2,1/6] Revert "nl80211: Indicate interface up only for the main netdev"

Message ID 20220906161410.2106782-2-oleksandr.savchenko@celeno.com
State Changes Requested
Headers show
Series nl80211: Process RTM event per bss | expand

Commit Message

Alexander Savchenko Sept. 6, 2022, 4:14 p.m. UTC
This reverts commit 8a9950f7b6ebd4f555575f60d7ae7a98cdb73383.

Commit 8a9950f7b breaks the virtual AP mode due to non-main interfaces
can't receive UP state.

Signed-off-by: Alexander Savchenko <oleksandr.savchenko@celeno.com>
---
 src/drivers/driver_nl80211.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Jouni Malinen Nov. 26, 2022, 5:10 p.m. UTC | #1
On Tue, Sep 06, 2022 at 07:14:05PM +0300, Alexander Savchenko wrote:
> This reverts commit 8a9950f7b6ebd4f555575f60d7ae7a98cdb73383.
> 
> Commit 8a9950f7b breaks the virtual AP mode due to non-main interfaces
> can't receive UP state.

Could you please provide more detail on what exactly is broken and how
that could be reproduced in a test? I don't like the idea of just
reverting earlier commits (patches 1 and 2) without clear description of
how the items fixed in those earlier commits are addressed. Patch 2 is
reverting a commit from seven years ago which seems to imply that there
has not really been that significant an issue if this comes up only
now..
Oleksandr Savchenko Dec. 1, 2022, 2:48 p.m. UTC | #2
Hi,

Shortly, broken processing RTM netlink events in setup with several bss.

Test steps:
for example we have 2 bss for on one band: wlan2_0, wlan1_0.
1.1) initial state
 iw dev
phy#0
        Interface wlan2_1
                ifindex 13
                wdev 0x2
                addr 02:1c:51:7d:98:c0
                ssid D5G2
                type AP
                channel 36 (5180 MHz), width: 160 MHz, center1: 5250 MHz
                txpower 19.00 dBm
        Interface wlan2_0
                ifindex 11
                wdev 0x1
                addr 00:1c:51:7d:98:c2
                ssid D5G
                type AP
                channel 36 (5180 MHz), width: 160 MHz, center1: 5250 MHz
                txpower 19.00 dBm
1.2) ip link
11: wlan2_0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP qlen 1000
    link/ether 00:1c:51:7d:98:c2 brd ff:ff:ff:ff:ff:ff
13: wlan2_1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 02:1c:51:7d:98:c0 brd ff:ff:ff:ff:ff:ff

2) ifconfig wlan2_1 down
   ifconfig wlan2_1 up
2.1) iw dev
   phy#0
        Interface wlan2_1
                ifindex 13
                wdev 0x2
                addr 02:1c:51:7d:98:c0
                type AP
                txpower 19.00 dBm
        Interface wlan2_0
                ifindex 11
                wdev 0x1
                addr 00:1c:51:7d:98:c2
                ssid D5G
                type AP
                channel 36 (5180 MHz), width: 160 MHz, center1: 5250 MHz
                txpower 19.00 dBm
2.2) ip link
11: wlan2_0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP qlen 1000
    link/ether 00:1c:51:7d:98:c2 brd ff:ff:ff:ff:ff:ff
13: wlan2_1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 02:1c:51:7d:98:c0 brd ff:ff:ff:ff:ff:ff

You could see that wlan2_1 fell to broken state NO-CARRIER and absent LOWER_UP.
hwsim test for such scenario implemented in patch
`[v2,6/6] tests: hwsim: ap_dynamic: Added test case for VAP restart`

Regards,
Alexander
diff mbox series

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index a4b2d5219..89e9cd112 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1283,20 +1283,11 @@  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",
@@ -1309,6 +1300,7 @@  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);