Blob Blame History Raw
From a3e6d2c48a1535b56bc5f28094818f10f93bf352 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 16 Jul 2018 17:43:25 +0200
Subject: [PATCH 3/3] firewall.core.fw_nm: ignore generated connections

If a connection is generated by NetworkManager, changing it persists it and
makes the device managed by NetworkManager.

(cherry picked from commit a102dde5d9430d503767cbface3e3b610134bdb6)
---
 src/firewall/core/fw_nm.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/firewall/core/fw_nm.py b/src/firewall/core/fw_nm.py
index d21cc25feb8b..0ed19248a79f 100644
--- a/src/firewall/core/fw_nm.py
+++ b/src/firewall/core/fw_nm.py
@@ -148,6 +148,16 @@ def nm_get_connection_of_interface(interface):
     if active_con is None:
         return None
 
+    try:
+        con = active_con.get_connection()
+        if con.get_flags() & NM.SettingsConnectionFlags.NM_GENERATED:
+            return None
+    except AttributeError:
+        # Prior to NetworkManager 1.12, we can only guess
+        # that a connection was generated.
+        if con.get_unsaved():
+            return None
+
     return active_con.get_uuid()
 
 def nm_get_bus_name():
-- 
2.16.3