From 34895adcc450fca238818db668b28981c0590d43 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 22 Aug 2019 09:59:53 +0200 Subject: [PATCH] device: set failure reason when settings hardware address fails --- src/devices/nm-device-tun.c | 6 +++++- src/devices/wifi/nm-device-wifi.c | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device-tun.c b/src/devices/nm-device-tun.c index 6d2a03036a..6087ff65e6 100644 --- a/src/devices/nm-device-tun.c +++ b/src/devices/nm-device-tun.c @@ -355,8 +355,12 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) if (priv->props.type == IFF_TUN) { /* Nothing to do for TUN devices */ } else { - if (!nm_device_hw_addr_set_cloned (device, nm_device_get_applied_connection (device), FALSE)) + if (!nm_device_hw_addr_set_cloned (device, + nm_device_get_applied_connection (device), + FALSE)) { + *out_failure_reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED; return NM_ACT_STAGE_RETURN_FAILURE; + } } return NM_ACT_STAGE_RETURN_SUCCESS; diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 901cb0a542..d9394ffdd5 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -2658,8 +2658,10 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) priv->hw_addr_scan_expire = 0; /* Set spoof MAC to the interface */ - if (!nm_device_hw_addr_set_cloned (device, connection, TRUE)) + if (!nm_device_hw_addr_set_cloned (device, connection, TRUE)) { + *out_failure_reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED; return NM_ACT_STAGE_RETURN_FAILURE; + } /* AP and Mesh modes never use a specific object or existing scanned AP */ if (!NM_IN_SET (priv->mode, NM_802_11_MODE_AP,