From a6c264cbd6fc8c10c905ee2c1cd22717247c3c25 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 8 Dec 2021 05:35:37 +0900
Subject: [PATCH] network: address: read flags from message header when
 IFA_FLAGS is not supported by kernel

Follow-up for 0828a38605975b68c14c9194a1ee2c5c2ff7038f.

Fixes #21670.

(cherry picked from commit 8ed68422e1bafc84afe524bc5020d343bc6163ca)

Conflict:NA
Reference:https://github.com/systemd/systemd/commit/a6c264cbd6fc8c10c905ee2c1cd22717247c3c25
---
 src/network/networkd-address.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 7b221516d7..bfc2e19bee 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -1368,6 +1368,14 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
         }
 
         r = sd_netlink_message_read_u32(message, IFA_FLAGS, &tmp->flags);
+        if (r == -ENODATA) {
+                unsigned char flags;
+
+                /* For old kernels. */
+                r = sd_rtnl_message_addr_get_flags(message, &flags);
+                if (r >= 0)
+                        tmp->flags = flags;
+        }
         if (r < 0) {
                 log_link_warning_errno(link, r, "rtnl: received address message without flags, ignoring: %m");
                 return 0;
-- 
2.33.0

