summaryrefslogtreecommitdiff
path: root/src/nm-ip4-config.c
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-10-17 11:36:38 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-10-23 21:46:26 +0200
commitea1679aac03f709667d2f89574b2ee1b5af0a361 (patch)
treec34bd4bc05ae9a1a447d347bbf82c5fda567ea14 /src/nm-ip4-config.c
parent3eb2f435ae4763ca1b8c9afc46642e2d6a4b31e1 (diff)
core: don't add prefix route for external addresses
If the user adds an address manually, kernel automatically adds a prefix route for it unless the address has the NOPREFIXROUTE flag. When ip_config_merge_and_apply() gets called, NM also adds its prefix route and so we end up with two routes that differ only for the metric. This is a problem because the route added by NM is not removed if the user removes the previously added address. Also, it seems confusing to have multiple instances of the same routes. This commit skips the addition of a prefix route for addresses added manually outside of NetworkManager.
Diffstat (limited to 'src/nm-ip4-config.c')
-rw-r--r--src/nm-ip4-config.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index 1096fb0a23..f132e50754 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -704,6 +704,9 @@ nm_ip4_config_add_dependent_routes (NMIP4Config *self,
/* The destination network depends on the peer-address. */
network = nm_utils_ip4_address_clear_host_address (my_addr->peer_address, my_addr->plen);
+ if (my_addr->external)
+ continue;
+
if (_ipv4_is_zeronet (network)) {
/* Kernel doesn't add device-routes for destinations that
* start with 0.x.y.z. Skip them. */