]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
add support for IFA_FLAGS nl attribute
authorJiri Pirko <jiri@resnulli.us>
Sun, 8 Dec 2013 11:26:24 +0000 (12:26 +0100)
committerThomas Haller <thaller@redhat.com>
Fri, 3 Jan 2014 12:37:56 +0000 (13:37 +0100)
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Thomas Haller <thaller@redhat.com>
include/linux/if_addr.h
include/netlink-private/types.h
lib/route/addr.c

index c355522d3b2c9774079d26cdde5697f0b4a91fcb..63da1cdfed410dd5987502fa5b02e82dab8d9270 100644 (file)
@@ -18,6 +18,9 @@ struct ifaddrmsg {
  * It makes no difference for normally configured broadcast interfaces,
  * but for point-to-point IFA_ADDRESS is DESTINATION address,
  * local address is supplied in IFA_LOCAL attribute.
+ *
+ * IFA_FLAGS is a u32 attribute that extends the u8 field ifa_flags.
+ * If present, the value from struct ifaddrmsg will be ignored.
  */
 enum {
        IFA_UNSPEC,
@@ -28,6 +31,7 @@ enum {
        IFA_ANYCAST,
        IFA_CACHEINFO,
        IFA_MULTICAST,
+       IFA_FLAGS,
        __IFA_MAX,
 };
 
index 59e8402dc25c78c0fbf64339db2306b13191ff7f..6750be726e9cf0920ce0646974a92d1be273418f 100644 (file)
@@ -244,8 +244,8 @@ struct rtnl_addr
 
        uint8_t         a_family;
        uint8_t         a_prefixlen;
-       uint8_t         a_flags;
        uint8_t         a_scope;
+       uint32_t        a_flags;
        uint32_t        a_ifindex;
 
        struct nl_addr *a_peer;
index 1ec298cde80e6f764cd8a19aaa4b914923f885a7..21f415d105f6ff265433818ea0a64e8a0ae62f46 100644 (file)
@@ -216,8 +216,9 @@ static int addr_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,
        ifa = nlmsg_data(nlh);
        addr->a_family = family = ifa->ifa_family;
        addr->a_prefixlen = ifa->ifa_prefixlen;
-       addr->a_flags = ifa->ifa_flags;
        addr->a_scope = ifa->ifa_scope;
+       addr->a_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) :
+                                       ifa->ifa_flags;
        addr->a_ifindex = ifa->ifa_index;
 
        addr->ce_mask = (ADDR_ATTR_FAMILY | ADDR_ATTR_PREFIXLEN |
@@ -597,6 +598,7 @@ static int build_addr_msg(struct rtnl_addr *tmpl, int cmd, int flags,
                NLA_PUT(msg, IFA_CACHEINFO, sizeof(ca), &ca);
        }
 
+       NLA_PUT_U32(msg, IFA_FLAGS, tmpl->a_flags);
 
        *result = msg;
        return 0;