typedef struct ether_addr nw_address_t;
+enum {
+ NW_ADDRESS_MULTICAST = (1 << 0),
+ NW_ADDRESS_SOFTWAREASSIGNED = (1 << 1),
+};
+
static inline int nw_address_from_string(nw_address_t* addr, const char* s) {
struct ether_addr* p = ether_aton_r(s, addr);
if (!p)
}
// Clear the multicast bit
- addr->ether_addr_octet[0] &= 0xfe;
+ addr->ether_addr_octet[0] &= ~NW_ADDRESS_MULTICAST;
// Set the software-generated bit
- addr->ether_addr_octet[1] |= 0x02;
+ addr->ether_addr_octet[0] |= NW_ADDRESS_SOFTWAREASSIGNED;
return 0;
}