tree-wide: IFA_FLAGS is supported since kernel v3.14

Now our baseline on the kernel is v5.4.
Let's unconditionally use the IFA_FLAGS attribute, and drop the getter
and setter for the deprecated header element.

Continuation of 29c2d4e158.
This commit is contained in:
Yu Watanabe
2025-04-15 03:41:16 +09:00
parent 6dbf2c1beb
commit d50cfa98aa
7 changed files with 12 additions and 18 deletions
+3 -8
View File
@@ -79,11 +79,11 @@ static int add_ipv4_address(sd_netlink *rtnl, struct state *s) {
if (r < 0)
return r;
r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT);
r = sd_rtnl_message_addr_set_scope(req, RT_SCOPE_HOST);
if (r < 0)
return r;
r = sd_rtnl_message_addr_set_scope(req, RT_SCOPE_HOST);
r = sd_netlink_message_append_u32(req, IFA_FLAGS, IFA_F_PERMANENT);
if (r < 0)
return r;
@@ -115,14 +115,9 @@ static int add_ipv6_address(sd_netlink *rtnl, struct state *s) {
return r;
uint32_t flags = IFA_F_PERMANENT|IFA_F_NOPREFIXROUTE;
r = sd_rtnl_message_addr_set_flags(req, flags & 0xffu); /* rtnetlink wants low 8 bit of flags via regular flags field… */
r = sd_netlink_message_append_u32(req, IFA_FLAGS, flags);
if (r < 0)
return r;
if ((flags & ~0xffu) != 0) {
r = sd_netlink_message_append_u32(req, IFA_FLAGS, flags); /* …and the rest of the flags via IFA_FLAGS */
if (r < 0)
return r;
}
r = sd_rtnl_message_addr_set_scope(req, RT_SCOPE_HOST);
if (r < 0)