mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 22:20:27 +01:00
core: don't crash checking unmanaged specs if device has no hardware address
Not all devices have a hardware address, like WWAN or ADSL. So don't unconditionally expect one.
This commit is contained in:
parent
b31ac326dd
commit
f515df39b5
1 changed files with 6 additions and 4 deletions
|
|
@ -5567,12 +5567,14 @@ spec_match_list (NMDevice *device, const GSList *specs)
|
|||
const guint8 *hwaddr;
|
||||
guint hwaddr_len = 0;
|
||||
char *hwaddr_str;
|
||||
gboolean matched;
|
||||
gboolean matched = FALSE;
|
||||
|
||||
hwaddr = nm_device_get_hw_address (device, &hwaddr_len);
|
||||
hwaddr_str = nm_utils_hwaddr_ntoa (hwaddr, nm_utils_hwaddr_type (hwaddr_len));
|
||||
matched = nm_match_spec_hwaddr (specs, hwaddr_str);
|
||||
g_free (hwaddr_str);
|
||||
if (hwaddr && hwaddr_len) {
|
||||
hwaddr_str = nm_utils_hwaddr_ntoa (hwaddr, nm_utils_hwaddr_type (hwaddr_len));
|
||||
matched = nm_match_spec_hwaddr (specs, hwaddr_str);
|
||||
g_free (hwaddr_str);
|
||||
}
|
||||
|
||||
if (!matched)
|
||||
matched = nm_match_spec_interface_name (specs, nm_device_get_iface (device));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue