From 4a9ae9d14ed98ba47a2c7fbd6f4cb63ef405ab53 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 9 Dec 2015 11:37:06 +0100 Subject: [PATCH] device/tun: set tun mode when the device is created Otherwise after 72c36bd6db96 ("device/tun: fix reloading tun properties") the mode would remain always set to the default value "tun". Fixes: 9110ad39c55bee0b338350d645374fb99fb6e47d --- src/devices/nm-device-tun.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/devices/nm-device-tun.c b/src/devices/nm-device-tun.c index a170fe6533..36d87e250b 100644 --- a/src/devices/nm-device-tun.c +++ b/src/devices/nm-device-tun.c @@ -451,6 +451,7 @@ create_device (NMDeviceFactory *factory, { NMSettingTun *s_tun; NMLinkType link_type = NM_LINK_TYPE_UNKNOWN; + const char *mode; if (plink) { link_type = plink->type; @@ -471,12 +472,14 @@ create_device (NMDeviceFactory *factory, } g_return_val_if_fail (link_type != NM_LINK_TYPE_UNKNOWN, NULL); + mode = link_type == NM_LINK_TYPE_TUN ? "tun" : "tap"; return (NMDevice *) g_object_new (NM_TYPE_DEVICE_TUN, NM_DEVICE_IFACE, iface, NM_DEVICE_TYPE_DESC, "Tun", NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_TUN, NM_DEVICE_LINK_TYPE, link_type, + NM_DEVICE_TUN_MODE, mode, NULL); }