[PATCH 3/3] route/link: add support for IFLA_LINK_NETNSID

Nicolas Dichtel nicolas.dichtel at 6wind.com
Mon Aug 17 01:03:59 PDT 2015


Le 14/08/2015 17:32, Thomas Haller a écrit :
> ---
>   include/netlink-private/types.h |  3 ++-
>   include/netlink/route/link.h    |  3 +++
>   lib/route/link.c                | 33 +++++++++++++++++++++++++++++++--
>   libnl-route-3.sym               |  2 ++
>   4 files changed, 38 insertions(+), 3 deletions(-)
>
[snip]
> @@ -677,13 +683,17 @@ static void link_dump_line(struct nl_object *obj, struct nl_dump_params *p)
>   		nl_dump(p, "<%s> ", buf);
>
>   	if (link->ce_mask & LINK_ATTR_LINK) {
> -		if (cache) {
> +		if (   cache
> +		    && !(link->ce_mask & LINK_ATTR_LINK_NETNSID)) {
>   			struct rtnl_link *ll = rtnl_link_get(cache, link->l_link);
>   			nl_dump(p, "slave-of %s ", ll ? ll->l_name : "NONE");
>   			if (ll)
>   				rtnl_link_put(ll);
> -		} else
> +		} else {
>   			nl_dump(p, "slave-of %d ", link->l_link);
> +			if (link->ce_mask & LINK_ATTR_LINK_NETNSID)
> +				nl_dump(p, "(netns %d) ", link->l_link_netnsid);
> +		}
>   	}

Note that IFLA_LINK_NETNSID can be set by the kernel without IFLA_LINK
(LINK_ATTR_LINK). For example for an ipip tunnel with its link part into
another netns but no specific output interface.



More information about the libnl mailing list