NetworkManager/0005-device-always-assume-d...

105 lines
4.3 KiB
Diff

From 0ab389e15cde106e0e66f25f5f3a74a8c0607f39 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 22 Jul 2015 10:56:53 +0200
Subject: [PATCH 05/11] device: always assume default-route for
generate-assumed-connections
Commit d51975e changed, that we treat assumed and non-assumed
connections the same with respect to the default route. This is
certainly wrong, if we have an nm-generated-assumed connection
at hand. In this case, NM just generated a connection based on what
was configured on the system. Looking at that result and re-enforcing
the default-route is wrong.
We want to manage the default-route for assumed, persistent connections.
If the connection was assumed and generated, we do not.
This commit reverts d51975ed for nm-generated-assumed connection and
restores the previous behavior.
https://bugzilla.redhat.com/show_bug.cgi?id=1244483
Fixes: d51975ed921a5876b76e081b8f3df4e2ca1f1ca9
(cherry picked from commit bebeff69e89de04fdd53e21a0edb5d1fbfbfcf0b)
---
src/devices/nm-device.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 5eeccbe..a0aaf03 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3307,12 +3307,21 @@ 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 */
+ 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
+ * leases for them, so we must extend/update the default route on commits.
+ */
+
connection_has_default_route
= nm_default_route_manager_ip4_connection_has_default_route (nm_default_route_manager_get (),
connection, &connection_is_never_default);
if ( !priv->v4_commit_first_time
- && !nm_device_uses_assumed_connection (self)
&& connection_is_never_default) {
/* If the connection is explicitly configured as never-default, we enforce the (absense of the)
* default-route only once. That allows the user to configure a connection as never-default,
@@ -3320,11 +3329,6 @@ ip4_config_merge_and_apply (NMDevice *self,
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
- * leases for them, so we must extend/update the default route on commits.
- */
-
/* we are about to commit (for a non-assumed connection). Enforce whatever we have
* configured. */
priv->default_route.v4_is_assumed = FALSE;
@@ -3927,12 +3931,21 @@ 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 */
+ 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
+ * leases for them, so we must extend/update the default route on commits.
+ */
+
connection_has_default_route
= nm_default_route_manager_ip6_connection_has_default_route (nm_default_route_manager_get (),
connection, &connection_is_never_default);
if ( !priv->v6_commit_first_time
- && !nm_device_uses_assumed_connection (self)
&& connection_is_never_default) {
/* If the connection is explicitly configured as never-default, we enforce the (absence of the)
* default-route only once. That allows the user to configure a connection as never-default,
@@ -3940,11 +3953,6 @@ ip6_config_merge_and_apply (NMDevice *self,
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
- * leases for them, so we must extend/update the default route on commits.
- */
-
/* we are about to commit (for a non-assumed connection). Enforce whatever we have
* configured. */
priv->default_route.v6_is_assumed = FALSE;
--
2.4.3