diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2015-11-26 09:08:46 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2015-11-26 10:13:10 +0100 |
commit | d1be467d38d5c0867813481b72fffa6d8901f48c (patch) | |
tree | f2379c654c332338c89c08f3b04f6fbb5fee49ea | |
parent | b776301662668e1b5884e0ac6f8512e4a227cf97 (diff) | |
download | NetworkManager-d1be467d38d5c0867813481b72fffa6d8901f48c.tar.gz |
ip4-config: properly handle gateway in nm_ip4_config_replace()
When @src didn't have a gateway and @dst did, the function left @dst's
gateway set to 0.0.0.0; fix this and unset the gateway in such case.
Fixes: 063677101ab7d43a9aa94c70eb1ca3a201269043
(cherry picked from commit d1a776bff9783ff2a526a57ee65c178f5915eb48)
-rw-r--r-- | src/nm-ip4-config.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 5918f3dcb2..55d308a3fb 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -876,8 +876,8 @@ nm_ip4_config_intersect (NMIP4Config *dst, const NMIP4Config *src) /** * nm_ip4_config_replace: - * @dst: config from which to remove everything in @src - * @src: config to remove from @dst + * @dst: config to replace with @src content + * @src: source config to copy * @relevant_changes: return whether there are changes to the * destination object that are relevant. This is equal to * nm_ip4_config_equal() showing any difference. @@ -922,7 +922,10 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev /* default gateway */ if ( src_priv->gateway != dst_priv->gateway || src_priv->has_gateway != dst_priv->has_gateway) { - nm_ip4_config_set_gateway (dst, src_priv->gateway); + if (src_priv->has_gateway) + nm_ip4_config_set_gateway (dst, src_priv->gateway); + else + nm_ip4_config_unset_gateway (dst); has_relevant_changes = TRUE; } |