Blame SOURCES/rh1057024_ifa_flags_1.patch

4c8f2e
From b31f8203d943346f60a92bace16098debe53205b Mon Sep 17 00:00:00 2001
4c8f2e
From: Jiri Pirko <jiri@resnulli.us>
4c8f2e
Date: Sun, 8 Dec 2013 12:26:24 +0100
4c8f2e
Subject: [PATCH 1/3] add support for IFA_FLAGS nl attribute
4c8f2e
4c8f2e
(cherry picked from commit 42c41336000e1ff781a91c6ec397fd787aae3124)
4c8f2e
4c8f2e
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
4c8f2e
Signed-off-by: Thomas Haller <thaller@redhat.com>
4c8f2e
---
4c8f2e
 include/linux/if_addr.h         | 4 ++++
4c8f2e
 include/netlink-private/types.h | 2 +-
4c8f2e
 lib/route/addr.c                | 4 +++-
4c8f2e
 3 files changed, 8 insertions(+), 2 deletions(-)
4c8f2e
4c8f2e
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
4c8f2e
index c355522..63da1cd 100644
4c8f2e
--- a/include/linux/if_addr.h
4c8f2e
+++ b/include/linux/if_addr.h
4c8f2e
@@ -18,6 +18,9 @@ struct ifaddrmsg {
4c8f2e
  * It makes no difference for normally configured broadcast interfaces,
4c8f2e
  * but for point-to-point IFA_ADDRESS is DESTINATION address,
4c8f2e
  * local address is supplied in IFA_LOCAL attribute.
4c8f2e
+ *
4c8f2e
+ * IFA_FLAGS is a u32 attribute that extends the u8 field ifa_flags.
4c8f2e
+ * If present, the value from struct ifaddrmsg will be ignored.
4c8f2e
  */
4c8f2e
 enum {
4c8f2e
 	IFA_UNSPEC,
4c8f2e
@@ -28,6 +31,7 @@ enum {
4c8f2e
 	IFA_ANYCAST,
4c8f2e
 	IFA_CACHEINFO,
4c8f2e
 	IFA_MULTICAST,
4c8f2e
+	IFA_FLAGS,
4c8f2e
 	__IFA_MAX,
4c8f2e
 };
4c8f2e
 
4c8f2e
diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h
4c8f2e
index 60a3bce..72570c4 100644
4c8f2e
--- a/include/netlink-private/types.h
4c8f2e
+++ b/include/netlink-private/types.h
4c8f2e
@@ -233,8 +233,8 @@ struct rtnl_addr
4c8f2e
 
4c8f2e
 	uint8_t		a_family;
4c8f2e
 	uint8_t		a_prefixlen;
4c8f2e
-	uint8_t		a_flags;
4c8f2e
 	uint8_t		a_scope;
4c8f2e
+	uint32_t	a_flags;
4c8f2e
 	uint32_t	a_ifindex;
4c8f2e
 
4c8f2e
 	struct nl_addr *a_peer;	
4c8f2e
diff --git a/lib/route/addr.c b/lib/route/addr.c
4c8f2e
index 95a9447..bcdc319 100644
4c8f2e
--- a/lib/route/addr.c
4c8f2e
+++ b/lib/route/addr.c
4c8f2e
@@ -215,8 +215,9 @@ static int addr_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who,
4c8f2e
 	ifa = nlmsg_data(nlh);
4c8f2e
 	addr->a_family = family = ifa->ifa_family;
4c8f2e
 	addr->a_prefixlen = ifa->ifa_prefixlen;
4c8f2e
-	addr->a_flags = ifa->ifa_flags;
4c8f2e
 	addr->a_scope = ifa->ifa_scope;
4c8f2e
+	addr->a_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) :
4c8f2e
+					ifa->ifa_flags;
4c8f2e
 	addr->a_ifindex = ifa->ifa_index;
4c8f2e
 
4c8f2e
 	addr->ce_mask = (ADDR_ATTR_FAMILY | ADDR_ATTR_PREFIXLEN |
4c8f2e
@@ -593,6 +594,7 @@ static int build_addr_msg(struct rtnl_addr *tmpl, int cmd, int flags,
4c8f2e
 		NLA_PUT(msg, IFA_CACHEINFO, sizeof(ca), &ca);
4c8f2e
 	}
4c8f2e
 
4c8f2e
+	NLA_PUT_U32(msg, IFA_FLAGS, tmpl->a_flags);
4c8f2e
 
4c8f2e
 	*result = msg;
4c8f2e
 	return 0;
4c8f2e
-- 
4c8f2e
1.8.3.1
4c8f2e