]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: address: do not send tentative flag
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Jun 2021 10:36:39 +0000 (19:36 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 30 Jun 2021 15:49:02 +0000 (00:49 +0900)
Currently, networkd does not set tentative flag on create, and kernel
ignore the flag on remove. So, this commit does not change any current
behaviour. This is just a preparation for later commits.

src/network/networkd-address.c

index 2756ce74f84f789f52534bdde63a99665cd052ec..700475f27b0dac9cd73152ad762a4754283b31f8 100644 (file)
@@ -656,6 +656,7 @@ static void log_address_debug(const Address *address, const char *str, const Lin
 }
 
 static int address_set_netlink_message(const Address *address, sd_netlink_message *req, Link *link) {
+        uint32_t flags;
         int r;
 
         assert(address);
@@ -667,14 +668,16 @@ static int address_set_netlink_message(const Address *address, sd_netlink_messag
                 return log_link_error_errno(link, r, "Could not set prefixlen: %m");
 
         /* On remove, only IFA_F_MANAGETEMPADDR flag for IPv6 addresses are used. But anyway, set all
-         * flags here unconditionally. Without setting the flag, the template addresses generated by
-         * kernel will not be removed automatically when the main address is removed. */
-        r = sd_rtnl_message_addr_set_flags(req, address->flags & 0xff);
+         * flags except tentative flag here unconditionally. Without setting the flag, the template
+         * addresses generated by kernel will not be removed automatically when the main address is
+         * removed. */
+        flags = address->flags & ~IFA_F_TENTATIVE;
+        r = sd_rtnl_message_addr_set_flags(req, flags & 0xff);
         if (r < 0)
                 return log_link_error_errno(link, r, "Could not set flags: %m");
 
-        if ((address->flags & ~0xff) != 0) {
-                r = sd_netlink_message_append_u32(req, IFA_FLAGS, address->flags);
+        if ((flags & ~0xff) != 0) {
+                r = sd_netlink_message_append_u32(req, IFA_FLAGS, flags);
                 if (r < 0)
                         return log_link_error_errno(link, r, "Could not set extended flags: %m");
         }