]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/address: always set IFA_ADDRESS attribute for IPv6 address on configure
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 31 Jul 2023 09:07:46 +0000 (18:07 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 31 Jul 2023 09:15:26 +0000 (18:15 +0900)
IPv6 address can update the peer address without removing the address.
If an address have a peer, but now we want to drop the peer, we need to
specify a null address in IFA_ADDRESS attribute.

IPv4 address cannot update the peer address, so let's specify peer
address only when necessary.

src/network/networkd-address.c

index a7772a589557914e27bd8ed23f0af802fba19ff0..2a46f051e03c4ba6dd3c00a1176875656181cd73 100644 (file)
@@ -1256,7 +1256,7 @@ static int address_configure(const Address *address, const struct ifa_cacheinfo
         if (r < 0)
                 return r;
 
-        if (in_addr_is_set(address->family, &address->in_addr_peer)) {
+        if (address->family == AF_INET6 || in_addr_is_set(address->family, &address->in_addr_peer)) {
                 r = netlink_message_append_in_addr_union(m, IFA_ADDRESS, address->family, &address->in_addr_peer);
                 if (r < 0)
                         return r;