Permalink
Browse files

add support for IFA_FLAGS nl attribute

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Thomas Haller <thaller@redhat.com>
  • Loading branch information...
jpirko authored and thom311 committed Dec 8, 2013
1 parent 2cf635b commit 42c41336000e1ff781a91c6ec397fd787aae3124
Showing with 8 additions and 2 deletions.
  1. +4 −0 include/linux/if_addr.h
  2. +1 −1 include/netlink-private/types.h
  3. +3 −1 lib/route/addr.c
View
@@ -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,
};
@@ -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;
View
@@ -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;

0 comments on commit 42c4133

Please sign in to comment.