station: netconfig devices based on station state

This commit is contained in:
Tim Kourt 2019-09-30 09:35:52 -07:00 committed by Denis Kenzior
parent fb65b5f92c
commit d7c52b8280
1 changed files with 21 additions and 0 deletions

View File

@ -1158,8 +1158,23 @@ static void station_enter_state(struct station *station,
IWD_NETWORK_INTERFACE, "Connected"); IWD_NETWORK_INTERFACE, "Connected");
/* fall through */ /* fall through */
case STATION_STATE_DISCONNECTED: case STATION_STATE_DISCONNECTED:
periodic_scan_stop(station);
break;
case STATION_STATE_CONNECTED: case STATION_STATE_CONNECTED:
periodic_scan_stop(station); 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; break;
case STATION_STATE_DISCONNECTING: case STATION_STATE_DISCONNECTING:
case STATION_STATE_ROAMING: case STATION_STATE_ROAMING:
@ -1247,6 +1262,8 @@ static void station_disassociated(struct station *station)
{ {
l_debug("%u", netdev_get_ifindex(station->netdev)); l_debug("%u", netdev_get_ifindex(station->netdev));
netconfig_reset(station->netconfig);
station_reset_connection_state(station); station_reset_connection_state(station);
station_enter_state(station, STATION_STATE_DISCONNECTED); station_enter_state(station, STATION_STATE_DISCONNECTED);
@ -2327,6 +2344,8 @@ static void station_disconnect_onconnect(struct station *station,
return; return;
} }
netconfig_reset(station->netconfig);
station_reset_connection_state(station); station_reset_connection_state(station);
station_enter_state(station, STATION_STATE_DISCONNECTING); station_enter_state(station, STATION_STATE_DISCONNECTING);
@ -2562,6 +2581,8 @@ int station_disconnect(struct station *station)
station_disconnect_cb, station) < 0) station_disconnect_cb, station) < 0)
return -EIO; return -EIO;
netconfig_reset(station->netconfig);
/* /*
* If the disconnect somehow fails we won't know if we're still * 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 * connected so we may as well indicate now that we're no longer