diff options
author | Dan Williams <dcbw@redhat.com> | 2016-01-26 11:33:49 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2016-01-29 17:41:16 -0600 |
commit | cb54c14cd54cc8f6b33dcafcc8a7b983177cb6df (patch) | |
tree | ced6eda03bf825aa4251c5b8ca7ae96c08862815 | |
parent | 38ad5c9f3ace1e5578727c9de74b45346ea0a00e (diff) | |
download | NetworkManager-cb54c14cd54cc8f6b33dcafcc8a7b983177cb6df.tar.gz |
platform: ignore permanent MAC addresses of all ones (FF:FF:FF:FF:FF:FF)
Drivers are stupid, and just like the platform ignores an all zeros
permanent address, so should it ignore all ones.
NetworkManager[509]: <debug> [1453743778.854919] [devices/nm-device.c:8885] nm_device_update_hw_address(): [0x190370] (eth0): hardware address now 86:18:52:xx:xx:xx
NetworkManager[509]: <debug> [1453743778.855438] [devices/nm-device.c:9138] constructed(): [0x190370] (eth0): read initial MAC address 86:18:52:xx:xx:xx
NetworkManager[509]: <debug> [1453743778.861602] [devices/nm-device.c:9148] constructed(): [0x190370] (eth0): read permanent MAC address FF:FF:FF:FF:FF:FF
(cherry picked from commit d442dcd1747ea33d2322472faa744256a77a8fea)
-rw-r--r-- | src/platform/nm-platform-utils.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c index e9b8d4be87..555fe9e5df 100644 --- a/src/platform/nm-platform-utils.c +++ b/src/platform/nm-platform-utils.c @@ -143,7 +143,8 @@ 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 }; + static const guint8 zeros[NM_UTILS_HWADDR_LEN_MAX] = { 0 }; + static guint8 ones[NM_UTILS_HWADDR_LEN_MAX] = { 0 }; if (!ifname) return FALSE; @@ -162,6 +163,12 @@ nmp_utils_ethtool_get_permanent_address (const char *ifname, if (memcmp (edata.e.data, zeros, edata.e.size) == 0) return FALSE; + /* Some drivers return a permanent address of all ones. Reject that too */ + if (G_UNLIKELY (ones[0] != 0xFF)) + memset (ones, 0xFF, sizeof (ones)); + if (memcmp (edata.e.data, ones, edata.e.size) == 0) + return FALSE; + memcpy (buf, edata.e.data, edata.e.size); *length = edata.e.size; return TRUE; |