summary refs log tree commit diff
path: root/src/core/devices/nm-device-tun.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2022-01-13 22:30:39 +0100
committerMichael Biebl <biebl@debian.org>2022-01-13 22:30:39 +0100
commit88c227d90a6b7b388c5c85d72802a0ca8f05ed5c (patch)
tree71f32df6617802270e8a78574bd8e1637dc532f4 /src/core/devices/nm-device-tun.c
parente74c568b07b50b97873fb4ee1d776dedefbd54d6 (diff)
New upstream version 1.34.0 upstream/1.34.0
Diffstat (limited to 'src/core/devices/nm-device-tun.c')
-rw-r--r--src/core/devices/nm-device-tun.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/core/devices/nm-device-tun.c b/src/core/devices/nm-device-tun.c
index ebccddfc..0ab08f65 100644
--- a/src/core/devices/nm-device-tun.c
+++ b/src/core/devices/nm-device-tun.c
@@ -17,6 +17,7 @@
 #include "libnm-platform/nm-platform.h"
 #include "nm-device-factory.h"
 #include "nm-setting-tun.h"
+#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
 #include "libnm-core-intern/nm-core-internal.h"
 
 #define _NMLOG_DEVICE_TYPE NMDeviceTun
@@ -186,11 +187,7 @@ update_connection(NMDevice *device, NMConnection *connection)
         return;
     }
 
-    s_tun = nm_connection_get_setting_tun(connection);
-    if (!s_tun) {
-        s_tun = (NMSettingTun *) nm_setting_tun_new();
-        nm_connection_add_setting(connection, (NMSetting *) s_tun);
-    }
+    s_tun = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_TUN);
 
     if (mode != nm_setting_tun_get_mode(s_tun))
         g_object_set(G_OBJECT(s_tun), NM_SETTING_TUN_MODE, (guint) mode, NULL);