add support for IFA_FLAGS nl attribute

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Jiri Pirko 2013-12-08 12:26:24 +01:00 committed by Thomas Haller
parent 2cf635b06a
commit 42c4133600
3 changed files with 8 additions and 2 deletions

View 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,
};

View 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;

View 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;