87 lines
3.2 KiB
Diff
87 lines
3.2 KiB
Diff
|
From af8199135907d300014b5052571ca3e445455af7 Mon Sep 17 00:00:00 2001
|
||
|
From: Gris Ge <fge@redhat.com>
|
||
|
Date: Tue, 25 May 2021 16:50:06 +0800
|
||
|
Subject: [PATCH 2/2] nm ipv4: Deactivate profile when route removed.
|
||
|
|
||
|
The bug https://bugzilla.redhat.com/show_bug.cgi?id=1962551 has shown
|
||
|
IPv4 route also share the same problem.
|
||
|
|
||
|
Whenever we got a route removal, we deactivate that profile via
|
||
|
NetworkManager.
|
||
|
|
||
|
Integration test case included.
|
||
|
|
||
|
Signed-off-by: Gris Ge <fge@redhat.com>
|
||
|
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
|
||
|
---
|
||
|
libnmstate/nm/profile.py | 5 +++--
|
||
|
libnmstate/route.py | 19 +++++++----------
|
||
|
tests/integration/route_test.py | 37 ++++++++++++++++++++++++++++++---
|
||
|
3 files changed, 45 insertions(+), 16 deletions(-)
|
||
|
|
||
|
diff --git a/libnmstate/nm/profile.py b/libnmstate/nm/profile.py
|
||
|
index b655885..6b20b21 100644
|
||
|
--- a/libnmstate/nm/profile.py
|
||
|
+++ b/libnmstate/nm/profile.py
|
||
|
@@ -49,7 +49,7 @@ from .translator import Api2Nm
|
||
|
IMPORT_NM_DEV_TIMEOUT = 5
|
||
|
IMPORT_NM_DEV_RETRY_INTERNAL = 0.5
|
||
|
FALLBACK_CHECKER_INTERNAL = 15
|
||
|
-IPV6_ROUTE_REMOVED = "_ipv6_route_removed"
|
||
|
+ROUTE_REMOVED = "_route_removed"
|
||
|
|
||
|
|
||
|
class NmProfile:
|
||
|
@@ -193,9 +193,10 @@ class NmProfile:
|
||
|
elif self._iface.is_virtual and self._nm_dev:
|
||
|
self._add_action(NmProfile.ACTION_DELETE_DEVICE)
|
||
|
|
||
|
- if self._iface.raw.get(IPV6_ROUTE_REMOVED):
|
||
|
+ if self._iface.raw.get(ROUTE_REMOVED):
|
||
|
# This is a workaround for NM bug:
|
||
|
# https://bugzilla.redhat.com/1837254
|
||
|
+ # https://bugzilla.redhat.com/1962551
|
||
|
self._add_action(NmProfile.ACTION_DEACTIVATE_FIRST)
|
||
|
|
||
|
if self._iface.is_controller and self._iface.is_up:
|
||
|
diff --git a/libnmstate/route.py b/libnmstate/route.py
|
||
|
index cdea198..d373427 100644
|
||
|
--- a/libnmstate/route.py
|
||
|
+++ b/libnmstate/route.py
|
||
|
@@ -36,7 +36,7 @@ from .state import StateEntry
|
||
|
DEFAULT_ROUTE_TABLE = 254
|
||
|
|
||
|
|
||
|
-IPV6_ROUTE_REMOVED = "_ipv6_route_removed"
|
||
|
+ROUTE_REMOVED = "_route_removed"
|
||
|
|
||
|
|
||
|
class RouteEntry(StateEntry):
|
||
|
@@ -235,16 +235,13 @@ class RouteState:
|
||
|
for route in route_set:
|
||
|
if not rt.match(route):
|
||
|
new_routes.add(route)
|
||
|
- if route.is_ipv6:
|
||
|
- # The routes match and therefore it is being removed.
|
||
|
- # Nmstate will check if it is an IPv6 route and if so,
|
||
|
- # marking the interface as deactivate first.
|
||
|
- #
|
||
|
- # This is a workaround for NM bug:
|
||
|
- # https://bugzilla.redhat.com/1837254
|
||
|
- ifaces.all_kernel_ifaces[iface_name].raw[
|
||
|
- IPV6_ROUTE_REMOVED
|
||
|
- ] = True
|
||
|
+ # The routes match and therefore it is being removed.
|
||
|
+ # marking the interface as deactivate first.
|
||
|
+ #
|
||
|
+ # This is a workaround for NM bug:
|
||
|
+ # https://bugzilla.redhat.com/1837254
|
||
|
+ # https://bugzilla.redhat.com/1962551
|
||
|
+ ifaces.all_kernel_ifaces[iface_name].raw[ROUTE_REMOVED] = True
|
||
|
if new_routes != route_set:
|
||
|
self._routes[iface_name] = new_routes
|
||
|
|
||
|
--
|
||
|
2.31.1
|
||
|
|