diff mbox series

[v1,3/6] nl80211: Restored usage of the resolved ifname

Message ID 20220714165306.2938319-4-oleksandr.savchenko@celeno.com
State Superseded
Headers show
Series nl80211: Process RTM event per bss | expand

Commit Message

Alexander Savchenko July 14, 2022, 4:53 p.m. UTC
From: Alexander Savchenko <oleksandr.savchenko@celeno.com>

Due to reverted commits 8a9950f7b, 106fa1e97
included merged functionality (UP/DOWN RTM events processing and namebuf)
namebuf is restored in this commit.

Signed-off-by: Alexander Savchenko <oleksandr.savchenko@celeno.com>
---
 src/drivers/driver_nl80211.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index a9fe3e36d..a14642695 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1237,9 +1237,9 @@  static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
 		return; /* do not update interface state */
 
 	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,
-				   drv->first_bss->ifname) > 0) {
+		    linux_iface_up(drv->global->ioctl_sock, namebuf) > 0) {
 			wpa_printf(MSG_DEBUG, "nl80211: Ignore interface down "
 				   "event since interface %s is up", namebuf);
 			drv->ignore_if_down_event = 0;
@@ -1247,7 +1247,8 @@  static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
 			nl80211_refresh_mac(drv, ifi->ifi_index, 1);
 			return;
 		}
-		wpa_printf(MSG_DEBUG, "nl80211: Interface down");
+		wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)",
+			   namebuf, ifname);
 		if (drv->ignore_if_down_event) {
 			wpa_printf(MSG_DEBUG, "nl80211: Ignore interface down "
 				   "event generated by mode change");
@@ -1270,13 +1271,18 @@  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,
-				   drv->first_bss->ifname) == 0) {
+		    linux_iface_up(drv->global->ioctl_sock, namebuf) == 0) {
 			wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up "
 				   "event since interface %s is down",
 				   namebuf);
-		} else if (if_nametoindex(drv->first_bss->ifname) == 0) {
+			return;
+		}
+		wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)",
+				namebuf, ifname);
+
+		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);
@@ -1288,7 +1294,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);