about summary refs log tree commit diff
path: root/src/core/devices/nm-device-macvlan.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2022-01-13 22:34:27 +0100
committerMichael Biebl <biebl@debian.org>2022-01-13 22:34:27 +0100
commitdd97d276b5d70c3397a4e59c978ca5228f06ba44 (patch)
tree5fb3f5e0f5da28e39d3261d50561349a512ba297 /src/core/devices/nm-device-macvlan.c
parent3e2f6719468f8d957ae3cb112f3cb75b9c82d6a7 (diff)
parent88c227d90a6b7b388c5c85d72802a0ca8f05ed5c (diff)
Update upstream source from tag 'upstream/1.34.0'
Update to upstream version '1.34.0'
with Debian dir b598c27ee9cef517760bc745aa6a3bb7d9fb2ecb
Diffstat (limited to 'src/core/devices/nm-device-macvlan.c')
-rw-r--r--src/core/devices/nm-device-macvlan.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/core/devices/nm-device-macvlan.c b/src/core/devices/nm-device-macvlan.c
index 7302ecdf..937ba9e4 100644
--- a/src/core/devices/nm-device-macvlan.c
+++ b/src/core/devices/nm-device-macvlan.c
@@ -13,6 +13,7 @@
 #include "settings/nm-settings.h"
 #include "nm-act-request.h"
 #include "nm-manager.h"
+#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
 #include "libnm-platform/nm-platform.h"
 #include "nm-device-factory.h"
 #include "nm-setting-macvlan.h"
@@ -419,14 +420,10 @@ complete_connection(NMDevice *           device,
 static void
 update_connection(NMDevice *device, NMConnection *connection)
 {
-    NMDeviceMacvlanPrivate *priv      = NM_DEVICE_MACVLAN_GET_PRIVATE(device);
-    NMSettingMacvlan *      s_macvlan = nm_connection_get_setting_macvlan(connection);
-    int                     new_mode;
-
-    if (!s_macvlan) {
-        s_macvlan = (NMSettingMacvlan *) nm_setting_macvlan_new();
-        nm_connection_add_setting(connection, (NMSetting *) s_macvlan);
-    }
+    NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE(device);
+    NMSettingMacvlan *      s_macvlan =
+        _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_MACVLAN);
+    int new_mode;
 
     new_mode = platform_mode_to_setting(priv->props.mode);
     if (new_mode != nm_setting_macvlan_get_mode(s_macvlan))