core: don't suppress routes inside the subnet of the interface

It's not clear why a route should be suppressed if it is contained
in the subnet of one of the interface's addresses.

I think it is wrong to do this. For example, imagine an ethernet
and a Wi-Fi device both connected to the same subnet 10.0.0.0/8. By
default, ethernet gets higher priority and a better metric of 100.
If the user wants to configure a route "10.0.0.1/32 metric 99"
to reach a certain host explicitly via Wi-Fi, this check will
forbid that.

This condition was added a long time ago (38dbdae266),
but it's unclear what the original intent was.

See also commit 4f7b1cabc0, which
already relaxed this suppression of routes for non-direct routes.

(cherry picked from commit ac5dc1a951)
This commit is contained in:
Thomas Haller 2016-08-17 21:55:23 +02:00
parent 3d9a0fda33
commit cf50806689
2 changed files with 0 additions and 16 deletions

View file

@ -420,14 +420,6 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex, gboolean routes_fu
const NMPlatformIP4Route *route;
route = nm_ip4_config_get_route (config, i);
/* Don't add the route if it's more specific than one of the subnets
* the device already has an IP address on.
*/
if ( route->gateway == 0
&& nm_ip4_config_destination_is_direct (config, route->network, route->plen))
continue;
/* duplicates in @routes are no problem as route-manager handles them
* gracefully (by ignoring them). */
g_array_append_vals (routes, route, 1);

View file

@ -412,14 +412,6 @@ nm_ip6_config_commit (const NMIP6Config *config, int ifindex, gboolean routes_fu
for (i = 0; i < count; i++) {
route = nm_ip6_config_get_route (config, i);
/* Don't add the route if it's more specific than one of the subnets
* the device already has an IP address on.
*/
if ( IN6_IS_ADDR_UNSPECIFIED (&route->gateway)
&& nm_ip6_config_destination_is_direct (config, &route->network, route->plen))
continue;
g_array_append_vals (routes, route, 1);
}