mirror of
https://github.com/systemd/systemd.git
synced 2026-08-02 22:20:20 +00:00
network: use hw_addr_equal() or friends
This commit is contained in:
@@ -554,11 +554,11 @@ static int decode_link(sd_netlink_message *m, LinkInfo *info, char **patterns, b
|
||||
|
||||
info->has_mac_address =
|
||||
netlink_message_read_hw_addr(m, IFLA_ADDRESS, &info->hw_address) >= 0 &&
|
||||
memcmp(&info->hw_address, &HW_ADDR_NULL, sizeof(struct hw_addr_data)) != 0;
|
||||
!hw_addr_is_null(&info->hw_address);
|
||||
|
||||
info->has_permanent_mac_address =
|
||||
ethtool_get_permanent_macaddr(NULL, info->name, &info->permanent_mac_address) >= 0 &&
|
||||
memcmp(&info->permanent_mac_address, ÐER_ADDR_NULL, sizeof(struct ether_addr)) != 0 &&
|
||||
!ether_addr_is_null(&info->permanent_mac_address) &&
|
||||
(info->hw_address.length != sizeof(struct ether_addr) ||
|
||||
memcmp(&info->permanent_mac_address, info->hw_address.bytes, sizeof(struct ether_addr)) != 0);
|
||||
|
||||
|
||||
@@ -1984,8 +1984,7 @@ static int link_update_hardware_address(Link *link, sd_netlink_message *message)
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "rtnl: failed to read hardware address: %m");
|
||||
|
||||
if (link->hw_addr.length == hw_addr.length &&
|
||||
memcmp(link->hw_addr.bytes, hw_addr.bytes, hw_addr.length) == 0)
|
||||
if (hw_addr_equal(&link->hw_addr, &hw_addr))
|
||||
return 0;
|
||||
|
||||
link->hw_addr = hw_addr;
|
||||
|
||||
Reference in New Issue
Block a user