NetworkManager/src/tests
Thomas Haller cce7884fe6 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 another gateway-route,
which then leads to a failure to add that route.

This also applies to IPv4 device routes that since recently are managed
by NMRouteManager.

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 user explicitly configured a conflict.
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. bump the metric by 1 until we can add it without
conflict.

Also note that NMRouteManager still ensures that for conflicting routes
the best route sticks to the interface that configured it first. That
means if you later add the conflicting route on another interface, it
will be added with higher metric and the data is still routed along the
first interface.

(cherry picked from commit f5c087c8e9)
2015-07-07 16:31:50 +02:00
..
config config: only handle 'option+' and 'option-' keys for known settings 2015-07-03 09:24:05 +02:00
Makefile.am route-manager/build: fix out-of-tree builds for route-manager tests 2015-06-22 13:15:05 +02:00
test-dcb.c all: consistently include config.h 2014-11-13 17:18:42 -05:00
test-general-with-expect.c util: add nm_utils_array_remove_at_indexes() function 2015-06-22 13:15:05 +02:00
test-general.c core: add nm_match_spec_join() function 2015-07-03 09:24:05 +02:00
test-ip4-config.c ipx-config: fix test 2015-06-28 21:37:09 +02:00
test-ip6-config.c all: consistently include config.h 2014-11-13 17:18:42 -05:00
test-resolvconf-capture.c all: consistently include config.h 2014-11-13 17:18:42 -05:00
test-route-manager.c route-manager: always add conflicting direct routes and bump the route-metric if necessary 2015-07-07 16:31:50 +02:00
test-secret-agent.py use /usr/bin/env instead of /bin/env 2011-03-29 01:00:47 +02:00
test-wired-defname.c test: initialize auto-destructed pointers 2015-03-13 11:50:50 +01:00