GNOME Bugzilla – Bug 752062
[review] let NMRouteManager configure conflicting direct routes [th/direct-route-conflict-bgo752062]
Last modified: 2015-07-07 14:38:02 UTC
Please review. Commit message: route-manager: always add conflicting direct routes and bump the route- metric if necessary Kernel does not allow to add the same route (as determined by network/plen,metric) on two different interfaces (ifindex). In case of conflict, NMRouteManager used to ignore any but the firstly added route. On the other hand, we cannot add a gateway-route, if there is no direct route to the gateway. Hence, skipping duplicate routes can mean that we skip a direct route what was necessary to add other gateway-route, which then leads to errors adding that route. This is an even more serious issue since NMRouteManager manages the device routes for IPv4 addresses. For example, say you connect two interfaces to the same IP subnet. The route-metric can conflict if the interfaces are of the same type or if the users configured a conflict explicitly. In case of conflicts, NMRouteManager would only configure the first appearing route and skip the shadowed route on the second interface. Now we cannot configure gateway-routes on the second interface because the gateway is unreachable. There are many scenarios where this issue can happen, especially with default-routes and user-configured-routes. For example with default-routes, ip4_config_merge_and_apply() would check if the default-gateway requires an explict route and possibly add it. But then NMRouteManager might not add the route because it is shadowed by a route on an other interface. This patch solves the issue by having NMRouteManager configure shadowed routes too, similar to what NMDefaultRouteManager does. It does that by searching for an unused, non-conflicting, higher metric for the route, i.e. we bump the metric by 1 until we can add it without conflict. Also note that NMRouteManager preserves the order of activating routes. That means, if you configure a conflicting route, the metric of that route will be bumped. The effect is that the best route to a destination stays on the first interface until it gets disconnected.
Works fine here.
merged. master: http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=ad2809cf6abef2781111debcf2dbecbf789b8442 nm-1-0: http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=3562e600fb85f41f93f59e0df773eff057bdf0bd