diff options
author | Dan Williams <dcbw@redhat.com> | 2013-11-08 00:29:38 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2013-11-08 16:46:45 -0600 |
commit | f815b0d31d24bcd1879e49b76ca9e73da7c00aa0 (patch) | |
tree | df12b937c486f3f6bd8d55b200789c060514c72a | |
parent | ce810d3660c32aa547bc5ea4d60aaa882d2bb7f0 (diff) | |
download | NetworkManager-f815b0d31d24bcd1879e49b76ca9e73da7c00aa0.tar.gz |
core: use ignore/disabled IP methods for assumed connections without IP config
Follow the IP configuration the device currently has. For IPv6, this means
not using LINK_LOCAL if the interface doesn't have a LINK_LOCAL address.
Otherwise, NM assumes too much and may begin to activate an interface that
has no IP configuration, then time out and deactivate that device.
-rw-r--r-- | src/nm-ip4-config.c | 7 | ||||
-rw-r--r-- | src/nm-ip6-config.c | 16 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 2ea7012abd..5229ef9822 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -340,9 +340,12 @@ nm_ip4_config_update_setting (const NMIP4Config *config, NMSettingIP4Config *set nm_setting_ip4_config_add_address (setting, s_addr); nm_ip4_address_unref (s_addr); } - if (!method) + + /* Only use 'disabled' if the method wasn't previously set */ + if (!method && !nm_setting_ip4_config_get_method (setting)) method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED; - g_object_set (setting, NM_SETTING_IP4_CONFIG_METHOD, method, NULL); + if (method) + g_object_set (setting, NM_SETTING_IP4_CONFIG_METHOD, method, NULL); /* Routes */ for (i = 0; i < nroutes; i++) { diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index 84956c922b..7522164b37 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -311,8 +311,11 @@ nm_ip6_config_update_setting (const NMIP6Config *config, NMSettingIP6Config *set NMIP6Address *s_addr; /* Ignore link-local address. */ - if (IN6_IS_ADDR_LINKLOCAL (&address->address)) + if (IN6_IS_ADDR_LINKLOCAL (&address->address)) { + if (!method) + method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL; continue; + } /* Detect dynamic address */ if (address->lifetime != NM_PLATFORM_LIFETIME_PERMANENT) { @@ -321,7 +324,7 @@ nm_ip6_config_update_setting (const NMIP6Config *config, NMSettingIP6Config *set } /* Static address found. */ - if (!method) + if (!method || strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0) method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL; s_addr = nm_ip6_address_new (); @@ -334,9 +337,12 @@ nm_ip6_config_update_setting (const NMIP6Config *config, NMSettingIP6Config *set nm_setting_ip6_config_add_address (setting, s_addr); nm_ip6_address_unref (s_addr); } - if (!method) - method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL; - g_object_set (setting, NM_SETTING_IP6_CONFIG_METHOD, method, NULL); + + /* Only use 'ignore' if the method wasn't previously set */ + if (!method && !nm_setting_ip6_config_get_method (setting)) + method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE; + if (method) + g_object_set (setting, NM_SETTING_IP6_CONFIG_METHOD, method, NULL); /* Routes */ for (i = 0; i < nroutes; i++) { |