if (s_wired) {
/* Set device MAC address if the connection wants to change it */
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
- if (cloned_mac)
- nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_ETHER);
+ nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_ETHER);
}
/* If we're re-activating a PPPoE connection a short while after
if (s_wired) {
/* Set device MAC address if the connection wants to change it */
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
- if (cloned_mac)
- nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_HW);
+ nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_HW);
}
return TRUE;
if (s_wired) {
/* Set device MAC address if the connection wants to change it */
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
- if (cloned_mac)
- nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_DEVICE);
+ nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_DEVICE);
}
return NM_ACT_STAGE_RETURN_SUCCESS;
if (s_wired) {
/* Set device MAC address if the connection wants to change it */
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
- if (cloned_mac)
- nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_VLAN);
+ nm_device_set_hw_addr (dev, cloned_mac, "set", LOGD_VLAN);
}
s_vlan = (NMSettingVlan *) nm_device_get_applied_setting (dev, NM_TYPE_SETTING_VLAN);
if (s_wired) {
/* Set device MAC address if the connection wants to change it */
cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired);
- if (cloned_mac)
- nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_DEVICE);
+ nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_DEVICE);
}
return NM_ACT_STAGE_RETURN_SUCCESS;
const char *cur_addr = nm_device_get_hw_address (self);
guint8 addr_bytes[NM_UTILS_HWADDR_LEN_MAX];
- g_return_val_if_fail (addr != NULL, FALSE);
+ /* Fall back to the permanent address */
+ if (!addr)
+ addr = priv->perm_hw_addr;
+ if (!addr)
+ return FALSE;
/* Do nothing if current MAC is same */
if (cur_addr && nm_utils_hwaddr_matches (cur_addr, -1, addr, -1)) {
/* Set spoof MAC to the interface */
cloned_mac = nm_setting_wireless_get_cloned_mac_address (s_wireless);
- if (cloned_mac)
- nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_WIFI);
+ nm_device_set_hw_addr (device, cloned_mac, "set", LOGD_WIFI);
/* AP mode never uses a specific object or existing scanned AP */
if (priv->mode != NM_802_11_MODE_AP) {