From d7c52b8280ae0a0de08799d142567db92312a540 Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Mon, 30 Sep 2019 09:35:52 -0700 Subject: [PATCH] station: netconfig devices based on station state --- src/station.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/station.c b/src/station.c index 02c5260b..0666287b 100644 --- a/src/station.c +++ b/src/station.c @@ -1158,8 +1158,23 @@ static void station_enter_state(struct station *station, IWD_NETWORK_INTERFACE, "Connected"); /* fall through */ case STATION_STATE_DISCONNECTED: + periodic_scan_stop(station); + + break; case STATION_STATE_CONNECTED: periodic_scan_stop(station); + + if (station->state == STATION_STATE_ROAMING) { + netconfig_reconfigure(station->netconfig); + + break; + } + + netconfig_configure(station->netconfig, + network_get_settings( + station->connected_network), + netdev_get_address( + station->netdev)); break; case STATION_STATE_DISCONNECTING: case STATION_STATE_ROAMING: @@ -1247,6 +1262,8 @@ static void station_disassociated(struct station *station) { l_debug("%u", netdev_get_ifindex(station->netdev)); + netconfig_reset(station->netconfig); + station_reset_connection_state(station); station_enter_state(station, STATION_STATE_DISCONNECTED); @@ -2327,6 +2344,8 @@ static void station_disconnect_onconnect(struct station *station, return; } + netconfig_reset(station->netconfig); + station_reset_connection_state(station); station_enter_state(station, STATION_STATE_DISCONNECTING); @@ -2562,6 +2581,8 @@ int station_disconnect(struct station *station) station_disconnect_cb, station) < 0) return -EIO; + netconfig_reset(station->netconfig); + /* * If the disconnect somehow fails we won't know if we're still * connected so we may as well indicate now that we're no longer