all: remove use of struct ether_addr / ether_aton()
Lots of old code used struct ether_addr to store hardware addresses, and ether_aton() to parse them, but more recent code generally uses guint8 arrays, and the nm_utils_hwaddr_* methods, to be able to share code between ETH_ALEN and INFINIBAND_ALEN cases. So update the old code to match the new. (In many places, this ends up getting rid of casts between struct ether_addr and guint8* anyway.) (Also, in some places, variables were switched from struct ether_addr to guint8[] a while back, but some code still used "&" when referring to them even though that's unnecessary now. Clean that up.)
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
*
|
||||
*/
|
||||
gboolean
|
||||
nm_ethernet_address_is_valid (const struct ether_addr *test_addr)
|
||||
nm_ethernet_address_is_valid (const guint8 *test_addr)
|
||||
{
|
||||
guint8 invalid_addr1[ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||
guint8 invalid_addr2[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
@@ -61,19 +61,19 @@ nm_ethernet_address_is_valid (const struct ether_addr *test_addr)
|
||||
g_return_val_if_fail (test_addr != NULL, FALSE);
|
||||
|
||||
/* Compare the AP address the card has with invalid ethernet MAC addresses. */
|
||||
if (!memcmp (test_addr->ether_addr_octet, &invalid_addr1, ETH_ALEN))
|
||||
if (!memcmp (test_addr, invalid_addr1, ETH_ALEN))
|
||||
return FALSE;
|
||||
|
||||
if (!memcmp (test_addr->ether_addr_octet, &invalid_addr2, ETH_ALEN))
|
||||
if (!memcmp (test_addr, invalid_addr2, ETH_ALEN))
|
||||
return FALSE;
|
||||
|
||||
if (!memcmp (test_addr->ether_addr_octet, &invalid_addr3, ETH_ALEN))
|
||||
if (!memcmp (test_addr, invalid_addr3, ETH_ALEN))
|
||||
return FALSE;
|
||||
|
||||
if (!memcmp (test_addr->ether_addr_octet, &invalid_addr4, ETH_ALEN))
|
||||
if (!memcmp (test_addr, invalid_addr4, ETH_ALEN))
|
||||
return FALSE;
|
||||
|
||||
if (test_addr->ether_addr_octet[0] & 1) /* Multicast addresses */
|
||||
if (test_addr[0] & 1) /* Multicast addresses */
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
Reference in New Issue
Block a user