station: delay roam until fully connected
PATCH 1/1 station: delay roam until fully connected
If DHCP/netconfig takes a long time to finish IWD could end up trying to roam to another BSS. This could happen if the signal strength is below the set threshold while connecting. Once authenticated to the AP IWD would get a CQM event and start a roam timer. If DHCP did not finish before that timer IWD would start a roam. IWD would not handle this well since a roam doesn't trigger DHCP to start and likely the network infrustructure would be very confused.
To fix this continue to delay the roam attempt until IWD reaches the connected state.
--- src/station.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
src/station.c +16 -0
@@ -2786,6 +2786,22 @@ static void station_roam_trigger_cb(struct l_timeout *timeout, void *user_data)if (station_cannot_roam (station))return ; +/* +* This is unlikely, but can still happen when network configuration is +* enabled and DHCP is slow. If IWD connects to a BSS under the low RSSI +* threshold it will immediately get a CQM event once connected (as far +* as the kernel is concerned, NOT IWD's connected state). This starts +* a 5 second timer and if DHCP has not completed by then IWD will +* roam. Since this would likely confused the APs and IWD its best to +* let DHCP complete i.e. wait until we are in a connected state. +*/ +if (station->state !=STATION_STATE_CONNECTED ) { +l_debug ("Tried to roam in unconnected state, will try " +"again in 5 seconds" ); +station_roam_timeout_rearm (station,5 ); +return ; + } +station_start_roam (station); }
Signature · 1 line
2.25.1
Hi James,
Quoted 7 lines · James Prestwood
If DHCP/netconfig takes a long time to finish IWD could end up trying to roam to another BSS. This could happen if the signal strength is below the set threshold while connecting. Once authenticated to the AP IWD would get a CQM event and start a roam timer. If DHCP did not finish before that timer IWD would start a roam. IWD would not handle this well since a roam doesn't trigger DHCP to start and likely the network infrustructure would be very confused.
Typo here, 'infrustructure'.
Quoted 3 lines
To fix this continue to delay the roam attempt until IWD reaches the connected state.
I'm not convinced this is the right approach. If the signal is bad enough that DHCP is failing, then delaying the roam is probably the worst choice we can make, no?
I would think the better way to fix this would be to track netconfig state, and if it never reached a fully configured state prior to roaming, reset & reconfigure upon a successful "roam". Note that since we haven't signaled "connected" just yet, we're really still just in the "connecting" phase.
Quoted 4 lines
--- src/station.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Regards,
-Denis
Hi Denis,
Quoted 11 lines · Denis Kenzior
Hi James,
Quoted 7 lines · James Prestwood
If DHCP/netconfig takes a long time to finish IWD could end up trying to roam to another BSS. This could happen if the signal strength is below the set threshold while connecting. Once authenticated to the AP IWD would get a CQM event and start a roam timer. If DHCP did not finish before that timer IWD would start a roam. IWD would not handle this well since a roam doesn't trigger DHCP to start and likely the network infrustructure would be very confused.
Quoted 7 lines
Typo here, 'infrustructure'.
Quoted 3 lines
To fix this continue to delay the roam attempt until IWD reaches the connected state.
I'm not convinced this is the right approach. If the signal is bad enough that DHCP is failing, then delaying the roam is probably the worst choice we can make, no?
It may not be that the connection quality caused DHCP to take a while, could be the backend just was slow and not responding quickly.
Quoted 2 lines
I would think the better way to fix this would be to track netconfig state, and if it never reached a fully configured state prior to roaming, reset & reconfigure upon a successful "roam". Note that since we haven't signaled "connected" just yet, we're really still just in the "connecting" phase.
The question is if the AP infrastructure could handle this. For example the worst case being if DHCP started and we roamed right in the middle... That's why I thinking the safest option was to complete DHCP, then roam. I never actually saw this behavior happening, just noticed that IWD would get very confused if it did happen.
Thanks,
James
Quoted 8 lines
Quoted 5 lines
---
src/station.c| 16 ++++++++++++++++1 file changed, 16 insertions(+)Regards,
-Denis
Hi James,
Quoted 3 lines
Quoted 1 line
I'm not convinced this is the right approach. If the signal is bad enough that DHCP is failing, then delaying the roam is probably the worst choice we can make, no?
It may not be that the connection quality caused DHCP to take a while, could be the backend just was slow and not responding quickly.
Possible. But I don't think this is a good reason to remain on a bad AP. Besides, what if iwd is not running DHCP and it is being done by some external app? In that case iwd will happily roam off anyway and the external app will restart dhcp. So remaining on the bad AP is asymmetrical to the EnableNetworkConfiguration=False situation.
Quoted 5 lines
Quoted 3 lines
I would think the better way to fix this would be to track netconfig state, and if it never reached a fully configured state prior to roaming, reset & reconfigure upon a successful "roam". Note that since we haven't signaled "connected" just yet, we're really still just in the "connecting" phase.
The question is if the AP infrastructure could handle this. For example the worst case being if DHCP started and we roamed right in the middle... That's why I thinking the safest option was to complete DHCP, then roam. I never actually saw this behavior happening, just noticed that IWD would get very confused if it did happen.
Well, see above. Infrastructure has to handle this possibility anyway. But yes, this is certainly a corner case we are not handling right now.
Regards,
-Denis