core: fix adding gateway routes within the own subnet

Before, when adding a gateway route to a destination within the
current subnets, it would be skipped because of the wrong assumption
that we already have a prefix route to that destination.

This assumption is wrong, because we want to reach the more specific
subnet via a gateway and not directly on the link.

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-03-04 14:32:46 +01:00
parent bd93117cad
commit 4f7b1cabc0
2 changed files with 4 additions and 2 deletions

View file

@ -269,7 +269,8 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex, int priority)
/* Don't add the route if it's more specific than one of the subnets
* the device already has an IP address on.
*/
if (nm_ip4_config_destination_is_direct (config, route.network, route.plen))
if ( route.gateway == 0
&& nm_ip4_config_destination_is_direct (config, route.network, route.plen))
continue;
/* Don't add the default route when and the connection

View file

@ -270,7 +270,8 @@ nm_ip6_config_commit (const NMIP6Config *config, int ifindex, int priority)
/* Don't add the route if it's more specific than one of the subnets
* the device already has an IP address on.
*/
if (nm_ip6_config_destination_is_direct (config, &route.network, route.plen))
if ( IN6_IS_ADDR_UNSPECIFIED (&route.gateway)
&& nm_ip6_config_destination_is_direct (config, &route.network, route.plen))
continue;
/* Don't add the default route when and the connection