mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-07 00:30:32 +01:00
platform: don't accept 00:00:00:00:00:00 as valid permanent address
In nmp_utils_ethtool_get_permanent_address(), don' accept a permanent address of all zeros. https://bugzilla.redhat.com/show_bug.cgi?id=1264024
This commit is contained in:
parent
2e66aea123
commit
2733aacd64
1 changed files with 7 additions and 0 deletions
|
|
@ -142,6 +142,7 @@ nmp_utils_ethtool_get_permanent_address (const char *ifname,
|
|||
struct ethtool_perm_addr e;
|
||||
guint8 _extra_data[NM_UTILS_HWADDR_LEN_MAX + 1];
|
||||
} edata;
|
||||
guint zeros[NM_UTILS_HWADDR_LEN_MAX] = { 0 };
|
||||
|
||||
if (!ifname)
|
||||
return FALSE;
|
||||
|
|
@ -154,6 +155,12 @@ nmp_utils_ethtool_get_permanent_address (const char *ifname,
|
|||
return FALSE;
|
||||
|
||||
g_assert (edata.e.size <= NM_UTILS_HWADDR_LEN_MAX);
|
||||
|
||||
/* Some drivers might return a permanent address of all zeros.
|
||||
* Reject that (rh#1264024) */
|
||||
if (memcmp (edata.e.data, zeros, edata.e.size) == 0)
|
||||
return FALSE;
|
||||
|
||||
memcpy (buf, edata.e.data, edata.e.size);
|
||||
*length = edata.e.size;
|
||||
return TRUE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue