[PATCH 1/1] rtnl-addr: set ifa_flags when creating/updating address

Thomas Haller thaller at redhat.com
Tue Oct 22 04:38:14 EDT 2013


Set the address flags when creating/updating an address with
rtnl_addr_add/rtnl_addr_build_add_request. Before, the flags
were not passed on.

As of now, the flags except IFA_F_NODAD|IFA_F_HOMEADDRESS are ignored by
the kernel. Still pass them on without filtering.

Signed-off-by: Thomas Haller <thaller at redhat.com>
---
 lib/route/addr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/route/addr.c b/lib/route/addr.c
index 71fca94..1ec298c 100644
--- a/lib/route/addr.c
+++ b/lib/route/addr.c
@@ -545,20 +545,21 @@ struct rtnl_addr *rtnl_addr_get(struct nl_cache *cache, int ifindex,
 /** @} */
 
 static int build_addr_msg(struct rtnl_addr *tmpl, int cmd, int flags,
 			  struct nl_msg **result)
 {
 	struct nl_msg *msg;
 	struct ifaddrmsg am = {
 		.ifa_family = tmpl->a_family,
 		.ifa_index = tmpl->a_ifindex,
 		.ifa_prefixlen = tmpl->a_prefixlen,
+		.ifa_flags = tmpl->a_flags,
 	};
 
 	if (tmpl->ce_mask & ADDR_ATTR_SCOPE)
 		am.ifa_scope = tmpl->a_scope;
 	else {
 		/* compatibility hack */
 		if (tmpl->a_family == AF_INET &&
 		    tmpl->ce_mask & ADDR_ATTR_LOCAL &&
 		    *((char *) nl_addr_get_binary_addr(tmpl->a_local)) == 127)
 			am.ifa_scope = RT_SCOPE_HOST;
-- 
1.8.4.1.559.gdb9bdfb




More information about the libnl mailing list