connection: Check for active flag when updating default gateway
Set default gateway if it has been updated or if it has not been set as active yet. The check for active interface is required in cases that are induced by a race condition caused by a change of interfaces that are either too fast or too slow to go down, or to get up. In such case the interface that should be used as default gateway may end up with no default route set in routing table. This is because the change happens in a situation where the old default service A going down is still online, when the new service B that is becoming the new default, is still in ready state. The new default service B is not detected as default gateway because of the service list order. The new service B has been added to gateway_hash and the routes other than the default route have been set into routing table. After this the routes of the old default service A are removed but because of the old default service A still being the default service according to service list, the removal of routes of the old default service A does not get the new default gateway B to be selected as the default gateway. After this the old default service A is properly disconnected and set to idle setting the new default service B as the default service. The next call to this update gateway function results in a situation where updated flag is not set, hence new default service B is the only one in the gateway_hash. By checking also the active flag of the gateway the new default gateway B in the scenario above will have a default route set also in routing table. [connman] Check active flag when updating gateway. Contributes to JB#42017
Showing
Please register or sign in to comment