mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 15:10:09 +01:00
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.
This commit is contained in:
parent
ce810d3660
commit
f815b0d31d
2 changed files with 16 additions and 7 deletions
|
|
@ -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++) {
|
||||
|
|
|
|||
|
|
@ -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++) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue