3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 04:32:37 +01:00

station: Handle NETCONFIG_EVENT_FAILED

If IPv4 setup fails and the netconfig logic gives up, continue as if the
connection had failed at earlier stages so that autoconnect can try the
next available network.
This commit is contained in:
Andrew Zaborowski 2022-09-30 16:48:00 +02:00 committed by Denis Kenzior
parent afa9a1261c
commit 72e7d3ceb8

View File

@ -2101,6 +2101,30 @@ delayed_retry:
station_roam_retry(station);
}
static void station_disconnect_on_error_cb(struct netdev *netdev, bool success,
void *user_data)
{
struct station *station = user_data;
bool continue_autoconnect;
station_enter_state(station, STATION_STATE_DISCONNECTED);
continue_autoconnect = station->state == STATION_STATE_CONNECTING_AUTO;
if (continue_autoconnect) {
if (station_autoconnect_next(station) < 0) {
l_debug("Nothing left on autoconnect list");
station_enter_state(station,
STATION_STATE_AUTOCONNECT_FULL);
}
return;
}
if (station->autoconnect)
station_enter_state(station, STATION_STATE_AUTOCONNECT_QUICK);
}
static void station_netconfig_event_handler(enum netconfig_event event,
void *user_data)
{
@ -2109,7 +2133,26 @@ static void station_netconfig_event_handler(enum netconfig_event event,
switch (event) {
case NETCONFIG_EVENT_CONNECTED:
station_enter_state(station, STATION_STATE_CONNECTED);
break;
case NETCONFIG_EVENT_FAILED:
if (station->connect_pending) {
struct l_dbus_message *reply = dbus_error_failed(
station->connect_pending);
dbus_pending_reply(&station->connect_pending, reply);
}
if (L_IN_SET(station->state, STATION_STATE_CONNECTING,
STATION_STATE_CONNECTING_AUTO))
network_connect_failed(station->connected_network,
false);
netdev_disconnect(station->netdev,
station_disconnect_on_error_cb,
station);
station_reset_connection_state(station);
station_enter_state(station, STATION_STATE_DISCONNECTING);
break;
default:
l_error("station: Unsupported netconfig event: %d.", event);