diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-01-08 04:22:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-08 04:22:21 +0100 |
commit | c2268009965fcd38ddb2f72330cbd643fff40c87 (patch) | |
tree | 877e55204872854342732f5101af6ba8c85950cb /src/network | |
parent | udev: rework how we handle the return value from spawned programs (diff) | |
parent | test: add a testcase for Address.Peer= in .network unit (diff) | |
download | systemd-c2268009965fcd38ddb2f72330cbd643fff40c87.tar.xz systemd-c2268009965fcd38ddb2f72330cbd643fff40c87.zip |
Merge pull request #11232 from yuwata/fix-9130-alternative
network: always check link is ready when address is updated
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-address.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 9f0a22b827..d1ef451004 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -351,18 +351,17 @@ int address_update( address->cinfo = *cinfo; link_update_operstate(address->link); + link_check_ready(address->link); - if (!ready && address_is_ready(address)) { - link_check_ready(address->link); + if (!ready && + address_is_ready(address) && + address->family == AF_INET6 && + in_addr_is_link_local(AF_INET6, &address->in_addr) > 0 && + in_addr_is_null(AF_INET6, (const union in_addr_union*) &address->link->ipv6ll_address) > 0) { - if (address->family == AF_INET6 && - in_addr_is_link_local(AF_INET6, &address->in_addr) > 0 && - in_addr_is_null(AF_INET6, (const union in_addr_union*) &address->link->ipv6ll_address) > 0) { - - r = link_ipv6ll_gained(address->link, &address->in_addr.in6); - if (r < 0) - return r; - } + r = link_ipv6ll_gained(address->link, &address->in_addr.in6); + if (r < 0) + return r; } return 0; @@ -632,14 +631,10 @@ int address_configure( r = sd_netlink_message_append_in6_addr(req, IFA_ADDRESS, &address->in_addr_peer.in6); if (r < 0) return log_error_errno(r, "Could not append IFA_ADDRESS attribute: %m"); - } else { - if (address->family == AF_INET) { - if (address->prefixlen <= 30) { - r = sd_netlink_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast); - if (r < 0) - return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m"); - } - } + } else if (address->family == AF_INET && address->prefixlen <= 30) { + r = sd_netlink_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast); + if (r < 0) + return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m"); } if (address->label) { @@ -648,8 +643,7 @@ int address_configure( return log_error_errno(r, "Could not append IFA_LABEL attribute: %m"); } - r = sd_netlink_message_append_cache_info(req, IFA_CACHEINFO, - &address->cinfo); + r = sd_netlink_message_append_cache_info(req, IFA_CACHEINFO, &address->cinfo); if (r < 0) return log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m"); |