Skip to contentSkip to conversation

station: transition to disconnected on DOWN/DEL events

PATCH New James Prestwood 1 participant 1 message Apr 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 station: transition to disconnected on DOWN/DEL events

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

---
 src/station.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/station.c +6 -0
index 9c2b4e64..f2a6a56e 100644
@@ -3695,6 +3695,8 @@ static void add_frame_watches(struct netdev *netdev)
 static void station_netdev_watch(struct netdev *netdev,
 				enum netdev_watch_event event, void *userdata)
 {
+	struct station *station = station_find(netdev_get_ifindex(netdev));
+
 	switch (event) {
 	case NETDEV_WATCH_EVENT_NEW:
 		if (netdev_get_iftype(netdev) == NETDEV_IFTYPE_STATION) {
@@ -3711,6 +3713,10 @@ static void station_netdev_watch(struct netdev *netdev,
 		break;
 	case NETDEV_WATCH_EVENT_DOWN:
 	case NETDEV_WATCH_EVENT_DEL:
+		if (netdev_get_iftype(netdev) == NETDEV_IFTYPE_STATION)
+			station_enter_state(station,
+						STATION_STATE_DISCONNECTED);
+
 		l_dbus_object_remove_interface(dbus_get_bus(),
 						netdev_get_path(netdev),
 						IWD_STATION_INTERFACE);
Signature · 1 line
2.26.2