mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 07:38:20 +02:00
device: merge branch 'bg/dhcp-assumed-generated-route-rh1265239'
https://bugzilla.redhat.com/show_bug.cgi?id=1265239
(cherry picked from commit adb534518b)
This commit is contained in:
commit
1d4a9e64fb
1 changed files with 21 additions and 20 deletions
|
|
@ -4344,6 +4344,7 @@ ip4_config_merge_and_apply (NMDevice *self,
|
|||
gboolean routes_full_sync;
|
||||
gboolean ignore_auto_routes = FALSE;
|
||||
gboolean ignore_auto_dns = FALSE;
|
||||
gboolean auto_method = FALSE;
|
||||
|
||||
/* Merge all the configs into the composite config */
|
||||
if (config) {
|
||||
|
|
@ -4359,6 +4360,10 @@ ip4_config_merge_and_apply (NMDevice *self,
|
|||
if (s_ip4) {
|
||||
ignore_auto_routes = nm_setting_ip_config_get_ignore_auto_routes (s_ip4);
|
||||
ignore_auto_dns = nm_setting_ip_config_get_ignore_auto_dns (s_ip4);
|
||||
|
||||
if (nm_streq0 (nm_setting_ip_config_get_method (s_ip4),
|
||||
NM_SETTING_IP4_CONFIG_METHOD_AUTO))
|
||||
auto_method = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4414,10 +4419,12 @@ ip4_config_merge_and_apply (NMDevice *self,
|
|||
goto END_ADD_DEFAULT_ROUTE;
|
||||
}
|
||||
|
||||
if (nm_device_uses_generated_assumed_connection (self)) {
|
||||
/* a generate-assumed-connection always detects the default route from platform */
|
||||
/* a generated-assumed connection detects the default route from the platform,
|
||||
* but if the IP method is automatic we need to update the default route to
|
||||
* maintain connectivity.
|
||||
*/
|
||||
if (nm_device_uses_generated_assumed_connection (self) && !auto_method)
|
||||
goto END_ADD_DEFAULT_ROUTE;
|
||||
}
|
||||
|
||||
/* At this point, we treat assumed and non-assumed connections alike.
|
||||
* For assumed connections we do that because we still manage RA and DHCP
|
||||
|
|
@ -5067,6 +5074,7 @@ ip6_config_merge_and_apply (NMDevice *self,
|
|||
gboolean routes_full_sync;
|
||||
gboolean ignore_auto_routes = FALSE;
|
||||
gboolean ignore_auto_dns = FALSE;
|
||||
gboolean auto_method = FALSE;
|
||||
|
||||
/* Apply ignore-auto-routes and ignore-auto-dns settings */
|
||||
connection = nm_device_get_applied_connection (self);
|
||||
|
|
@ -5076,6 +5084,11 @@ ip6_config_merge_and_apply (NMDevice *self,
|
|||
if (s_ip6) {
|
||||
ignore_auto_routes = nm_setting_ip_config_get_ignore_auto_routes (s_ip6);
|
||||
ignore_auto_dns = nm_setting_ip_config_get_ignore_auto_dns (s_ip6);
|
||||
|
||||
if (NM_IN_STRSET (nm_setting_ip_config_get_method (s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||
NM_SETTING_IP6_CONFIG_METHOD_DHCP))
|
||||
auto_method = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5139,10 +5152,12 @@ ip6_config_merge_and_apply (NMDevice *self,
|
|||
goto END_ADD_DEFAULT_ROUTE;
|
||||
}
|
||||
|
||||
if (nm_device_uses_generated_assumed_connection (self)) {
|
||||
/* a generate-assumed-connection always detects the default route from platform */
|
||||
/* a generated-assumed connection detects the default route from the platform,
|
||||
* but if the IP method is automatic we need to update the default route to
|
||||
* maintain connectivity.
|
||||
*/
|
||||
if (nm_device_uses_generated_assumed_connection (self) && !auto_method)
|
||||
goto END_ADD_DEFAULT_ROUTE;
|
||||
}
|
||||
|
||||
/* At this point, we treat assumed and non-assumed connections alike.
|
||||
* For assumed connections we do that because we still manage RA and DHCP
|
||||
|
|
@ -8024,23 +8039,16 @@ nm_device_set_ip4_config (NMDevice *self,
|
|||
nm_exported_object_clear_and_unexport (&old_config);
|
||||
|
||||
if (nm_device_uses_generated_assumed_connection (self)) {
|
||||
NMConnection *connection = nm_device_get_applied_connection (self);
|
||||
NMConnection *settings_connection = NM_CONNECTION (nm_device_get_settings_connection (self));
|
||||
NMSetting *s_ip4;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (connection));
|
||||
g_object_freeze_notify (G_OBJECT (settings_connection));
|
||||
|
||||
nm_connection_remove_setting (settings_connection, NM_TYPE_SETTING_IP4_CONFIG);
|
||||
s_ip4 = nm_ip4_config_create_setting (priv->ip4_config);
|
||||
nm_connection_add_setting (settings_connection, s_ip4);
|
||||
|
||||
nm_connection_remove_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
|
||||
s_ip4 = nm_ip4_config_create_setting (priv->ip4_config);
|
||||
nm_connection_add_setting (connection, s_ip4);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (settings_connection));
|
||||
g_object_thaw_notify (G_OBJECT (connection));
|
||||
}
|
||||
|
||||
nm_device_queue_recheck_assume (self);
|
||||
|
|
@ -8192,23 +8200,16 @@ nm_device_set_ip6_config (NMDevice *self,
|
|||
nm_exported_object_clear_and_unexport (&old_config);
|
||||
|
||||
if (nm_device_uses_generated_assumed_connection (self)) {
|
||||
NMConnection *connection = nm_device_get_applied_connection (self);
|
||||
NMConnection *settings_connection = NM_CONNECTION (nm_device_get_settings_connection (self));
|
||||
NMSetting *s_ip6;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (connection));
|
||||
g_object_freeze_notify (G_OBJECT (settings_connection));
|
||||
|
||||
nm_connection_remove_setting (settings_connection, NM_TYPE_SETTING_IP6_CONFIG);
|
||||
s_ip6 = nm_ip6_config_create_setting (priv->ip6_config);
|
||||
nm_connection_add_setting (settings_connection, s_ip6);
|
||||
|
||||
nm_connection_remove_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
|
||||
s_ip6 = nm_ip6_config_create_setting (priv->ip6_config);
|
||||
nm_connection_add_setting (connection, s_ip6);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (settings_connection));
|
||||
g_object_thaw_notify (G_OBJECT (connection));
|
||||
}
|
||||
|
||||
nm_device_queue_recheck_assume (self);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue