From 4f7b1cabc063bfda96cb5c129d6a233e5d5cff68 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 4 Mar 2014 14:32:46 +0100 Subject: [PATCH] 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 --- src/nm-ip4-config.c | 3 ++- src/nm-ip6-config.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 1a6f3d33cd..38227b082a 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -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 diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index c6f213a7ae..7de01ece42 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -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