Skip to contentSkip to conversation

station: transition to disconnected on station_free

PATCH In review James Prestwood 2 participants 4 messages Apr 27, 2021 – Apr 28, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 station: transition to disconnected on station_free

This allows station to gracefully clean up things like the diagnostic interface which is directly tied to stations CONNECTED/DISCONNECTED states.

---
 src/station.c | 2 ++
 1 file changed, 2 insertions(+)
src/station.c +2 -0
index 9c2b4e64..325175e9 100644
@@ -3486,6 +3486,8 @@ static void station_free(struct station *station)
 	if (station->connected_bss)
 		netdev_disconnect(station->netdev, NULL, NULL);
 
+	station_enter_state(station, STATION_STATE_DISCONNECTED);
+
 	if (station->netconfig) {
 		netconfig_destroy(station->netconfig);
 		station->netconfig = NULL;
Signature · 1 line
2.26.2
#1 lore raw

PATCH v3 2/3 netdev: only call connect_ok in station/p2p_client mode

netdev_connect_ok is only for station/p2p_client modes but AP also ends up on the same code path. Check the iftype before calling netdev_connect_ok.

---
 src/netdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/netdev.c +3 -1
index 252ae78a..e9fa241f 100644
@@ -1337,7 +1337,9 @@ static void try_handshake_complete(struct netdev_handshake_state *nhs)
 		nhs->complete = true;
 		handshake_event(&nhs->super, HANDSHAKE_EVENT_COMPLETE);
 
-		netdev_connect_ok(nhs->netdev);
+		if (nhs->netdev->type == NL80211_IFTYPE_STATION ||
+				nhs->netdev->type == NL80211_IFTYPE_P2P_CLIENT)
+			netdev_connect_ok(nhs->netdev);
 	}
 }
 
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH v3 2/3] netdev: only call connect_ok in station/p2p_client mode

Hi James,

Quoted 7 lines · James Prestwood

netdev_connect_ok is only for station/p2p_client modes but AP also ends up on the same code path. Check the iftype before calling netdev_connect_ok.

---
  src/netdev.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

Patch 2 & 3 applied, thanks.

Regards,
-Denis

#3 lore raw

PATCH v3 3/3 ap: set link/operstate on AP start/stop

In reply to James Prestwood

Prior to this netdev_connect_ok set setting this which really only applies to station mode. In addition this happens for each new station that connects to the AP. Instead set the operstate / link mode when AP starts and stops.

---
 src/ap.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
src/ap.c +11 -0
index 46821c04..89a05b8c 100644
@@ -28,6 +28,7 @@
 #include <linux/if_ether.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <linux/if.h>
 
 #include <ell/ell.h>
 
@@ -3090,6 +3091,11 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data,
 		l_dbus_property_changed(dbus_get_bus(),
 					netdev_get_path(ap_if->netdev),
 					IWD_AP_INTERFACE, "Name");
+
+		l_rtnl_set_linkmode_and_operstate(rtnl,
+					netdev_get_ifindex(ap_if->netdev),
+					IF_LINK_MODE_DEFAULT, IF_OPER_UP,
+					NULL, NULL, NULL);
 		break;
 
 	case AP_EVENT_STOPPING:
@@ -3104,6 +3110,11 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data,
 					netdev_get_path(ap_if->netdev),
 					IWD_AP_INTERFACE, "Name");
 
+		l_rtnl_set_linkmode_and_operstate(rtnl,
+					netdev_get_ifindex(ap_if->netdev),
+					IF_LINK_MODE_DORMANT, IF_OPER_DOWN,
+					NULL, NULL, NULL);
+
 		if (!ap_if->pending)
 			ap_if->ap = NULL;
 
Signature · 1 line
2.26.2