mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 00:00:30 +01:00
core: detect automatic addresses when assuming connections
This commit is contained in:
parent
afc3c2617a
commit
5216cd4eb3
2 changed files with 16 additions and 0 deletions
|
|
@ -234,6 +234,8 @@ nm_ip4_config_merge_setting (NMIP4Config *config, NMSettingIP4Config *setting)
|
|||
memset (&address, 0, sizeof (address));
|
||||
address.address = nm_ip4_address_get_address (s_addr);
|
||||
address.plen = nm_ip4_address_get_prefix (s_addr);
|
||||
address.lifetime = NM_PLATFORM_LIFETIME_PERMANENT;
|
||||
address.preferred = NM_PLATFORM_LIFETIME_PERMANENT;
|
||||
|
||||
nm_ip4_config_add_address (config, &address);
|
||||
}
|
||||
|
|
@ -278,6 +280,12 @@ nm_ip4_config_update_setting (NMIP4Config *config, NMSettingIP4Config *setting)
|
|||
const NMPlatformIP4Address *address = nm_ip4_config_get_address (config, i);
|
||||
gs_unref_object NMIP4Address *s_addr = nm_ip4_address_new ();
|
||||
|
||||
/* Detect dynamic address */
|
||||
if (address->lifetime != NM_PLATFORM_LIFETIME_PERMANENT) {
|
||||
method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Static address found. */
|
||||
if (!method)
|
||||
method = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
|
||||
|
|
|
|||
|
|
@ -237,6 +237,8 @@ nm_ip6_config_merge_setting (NMIP6Config *config, NMSettingIP6Config *setting)
|
|||
memset (&address, 0, sizeof (address));
|
||||
address.address = *nm_ip6_address_get_address (s_addr);
|
||||
address.plen = nm_ip6_address_get_prefix (s_addr);
|
||||
address.lifetime = G_MAXUINT32;
|
||||
address.preferred = G_MAXUINT32;
|
||||
|
||||
nm_ip6_config_add_address (config, &address);
|
||||
}
|
||||
|
|
@ -285,6 +287,12 @@ nm_ip6_config_update_setting (NMIP6Config *config, NMSettingIP6Config *setting)
|
|||
if (IN6_IS_ADDR_LINKLOCAL (&address->address))
|
||||
continue;
|
||||
|
||||
/* Detect dynamic address */
|
||||
if (address->lifetime != G_MAXUINT32) {
|
||||
method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Static address found. */
|
||||
if (!method)
|
||||
method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue