]> git.proxmox.com Git - mirror_iproute2.git/commit - ip/tunnel.c
iptunnel/ip6tunnel: Use netlink to walk through tunnels list
authorSerhey Popovych <serhe.popovych@gmail.com>
Wed, 7 Feb 2018 06:30:55 +0000 (08:30 +0200)
committerDavid Ahern <dsahern@gmail.com>
Thu, 8 Feb 2018 00:15:42 +0000 (16:15 -0800)
commit3e953938717fd5dd186a74ca61a048a84a91f836
tree817b7be0cab0ed1792b0944eb8f8e2fc444b8426
parentec89594080e16078abd36e8fd9aa3a8badca091e
iptunnel/ip6tunnel: Use netlink to walk through tunnels list

Both tunnels use legacy /proc/net/dev interface to get tunnel device and
it's statistics. This may cause problems for cases when procfs either
not mounted or not unshare(2)d for given network namespace.

Use netlink to walk through list of tunnel devices which is network
namespace aware and provides additional information such as statistics
in the dump message.

Since both address family specific variants of do_tunnels_list() nearly
the same, except for tunnel parameters structure initialization,
matching and printing we can introduce common one in tunnel.c.

To implement address family specific parts introduce new data structure
@struct tnl_print_nlmsg_info what contains all necessary information as
well as pointers to ->init(), ->match() and ->print() callbacks.

Annotate data structures by const where appropriate.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
ip/ip6tunnel.c
ip/iptunnel.c
ip/tunnel.c
ip/tunnel.h