mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
Merge pull request #20083 from yuwata/network-ipv4acd-follow-ups
network: ipv4acd follow-ups
This commit is contained in:
commit
fac6511e49
@ -36,12 +36,12 @@ static int static_address_on_conflict(Link *link, Address *address) {
|
||||
assert(address);
|
||||
|
||||
if (address_get(link, address, NULL) < 0) {
|
||||
log_link_warning(link, "Cannot configure requested address "IPV4_ADDRESS_FMT_STR", as an address conflict is detected.",
|
||||
log_link_warning(link, "Cannot configure requested address "IPV4_ADDRESS_FMT_STR", as an address conflict was detected.",
|
||||
IPV4_ADDRESS_FMT_VAL(address->in_addr.in));
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_link_warning(link, "Dropping address "IPV4_ADDRESS_FMT_STR", as an address conflict is detected.",
|
||||
log_link_warning(link, "Dropping address "IPV4_ADDRESS_FMT_STR", as an address conflict was detected.",
|
||||
IPV4_ADDRESS_FMT_VAL(address->in_addr.in));
|
||||
|
||||
r = address_remove(address, link);
|
||||
@ -66,7 +66,7 @@ static int dhcp4_address_on_conflict(Link *link) {
|
||||
/* Unlikely, but during probing the address, the lease may be lost. */
|
||||
return 0;
|
||||
|
||||
log_link_warning(link, "Dropping DHCPv4 lease, as an address conflict is detected.");
|
||||
log_link_warning(link, "Dropping DHCPv4 lease, as an address conflict was detected.");
|
||||
r = dhcp4_lease_lost(link);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Failed to drop DHCPv4 lease: %m");
|
||||
|
@ -1998,7 +1998,7 @@ static int link_update_master(Link *link, sd_netlink_message *message) {
|
||||
}
|
||||
|
||||
static int link_update_hardware_address(Link *link, sd_netlink_message *message) {
|
||||
struct hw_addr_data old;
|
||||
struct hw_addr_data addr;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
@ -2008,26 +2008,27 @@ static int link_update_hardware_address(Link *link, sd_netlink_message *message)
|
||||
if (r < 0 && r != -ENODATA)
|
||||
return log_link_debug_errno(link, r, "rtnl: failed to read broadcast address: %m");
|
||||
|
||||
old = link->hw_addr;
|
||||
r = netlink_message_read_hw_addr(message, IFLA_ADDRESS, &link->hw_addr);
|
||||
r = netlink_message_read_hw_addr(message, IFLA_ADDRESS, &addr);
|
||||
if (r == -ENODATA)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return log_link_debug_errno(link, r, "rtnl: failed to read hardware address: %m");
|
||||
|
||||
if (hw_addr_equal(&link->hw_addr, &old))
|
||||
if (hw_addr_equal(&link->hw_addr, &addr))
|
||||
return 0;
|
||||
|
||||
if (hw_addr_is_null(&old))
|
||||
log_link_debug(link, "Saved hardware address: %s", HW_ADDR_TO_STR(&link->hw_addr));
|
||||
if (hw_addr_is_null(&link->hw_addr))
|
||||
log_link_debug(link, "Saved hardware address: %s", HW_ADDR_TO_STR(&addr));
|
||||
else {
|
||||
log_link_debug(link, "Hardware address is changed: %s → %s",
|
||||
HW_ADDR_TO_STR(&old), HW_ADDR_TO_STR(&link->hw_addr));
|
||||
HW_ADDR_TO_STR(&link->hw_addr), HW_ADDR_TO_STR(&addr));
|
||||
|
||||
if (hashmap_get(link->manager->links_by_hw_addr, &old) == link)
|
||||
hashmap_remove(link->manager->links_by_hw_addr, &old);
|
||||
if (hashmap_get(link->manager->links_by_hw_addr, &link->hw_addr) == link)
|
||||
hashmap_remove(link->manager->links_by_hw_addr, &link->hw_addr);
|
||||
}
|
||||
|
||||
link->hw_addr = addr;
|
||||
|
||||
if (!hw_addr_is_null(&link->hw_addr)) {
|
||||
r = hashmap_ensure_put(&link->manager->links_by_hw_addr, &hw_addr_hash_ops, &link->hw_addr, link);
|
||||
if (r == -EEXIST && streq_ptr(link->kind, "bond"))
|
||||
|
Loading…
Reference in New Issue
Block a user