assert(IN_SET(family, AF_INET, AF_INET6));
assert(ret);
- for (size_t i = 0; i < ELEMENTSOF(map); i++) {
- if (!FLAGS_SET(flags, map[i].flag))
- continue;
- if (map[i].flag == IFA_F_SECONDARY && family == AF_INET6) {
- if (!strextend_with_separator(&str, ",", "temporary"))
- return -ENOMEM;
- } else {
- if (!strextend_with_separator(&str, ",", map[i].name))
- return -ENOMEM;
- }
- }
+ for (size_t i = 0; i < ELEMENTSOF(map); i++)
+ if (flags & map[i].flag &&
+ !strextend_with_separator(
+ &str, ",",
+ map[i].flag == IFA_F_SECONDARY && family == AF_INET6 ? "temporary" : map[i].name))
+ return -ENOMEM;
*ret = TAKE_PTR(str);
return 0;
return r;
/* Consider address tentative until we get the real flags from the kernel */
- address->flags = IFA_F_TENTATIVE;
+ address->flags |= IFA_F_TENTATIVE;
r = set_ensure_put(addresses, &address_hash_ops, address);
if (r < 0)
_cleanup_(address_freep) Address *tmp = NULL;
Link *link = NULL;
uint16_t type;
- unsigned char flags;
Address *address = NULL;
int ifindex, r;
return 0;
}
- r = sd_rtnl_message_addr_get_flags(message, &flags);
+ r = sd_netlink_message_read_u32(message, IFA_FLAGS, &tmp->flags);
if (r < 0) {
log_link_warning_errno(link, r, "rtnl: received address message without flags, ignoring: %m");
return 0;
}
- tmp->flags = flags;
switch (tmp->family) {
case AF_INET: