All of lore.kernel.org
 help / color / mirror / Atom feed
From: Serhey Popovych <serhe.popovych@gmail.com>
To: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next 0/6] ip: Use netlink to walk through network device list
Date: Fri, 2 Feb 2018 15:21:44 +0200	[thread overview]
Message-ID: <4d7c84f9-efd0-b5e6-e2fd-d8d2fc38b992@gmail.com> (raw)
In-Reply-To: <1517577055-23788-1-git-send-email-serhe.popovych@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3307 bytes --]

Serhey Popovych wrote:
> In this seris I replace /proc/net/dev and /sys/class/net usage for walk
> through network device list in iptunnel/ip6tunnel and iptuntap with
> netlink dump.
> 
> Following changed since RFC was sent:
> 
>   1) Treat @struct rtnl_link_stats and @struct rtnl_link_stats64 as
>      array with __u32 and __u64 elements respectively in
>      copy_rtnl_link_stats64() as suggested by Stephen Hemminger.
> 
>   2) Remove @name and @size parameters from @struct tnl_print_nlmsg_info
>      since we can get them easily from other data.
> 
> Testing.
> ========
> 
> Following script is used to ensure I didn't broke things too much:
> 
> \#!/bin/bash
> 
> iproute2_dir="$1"
> iface='gre1'
> 
> pushd "$iproute2_dir" &>/dev/null
> 
> for i in new old; do
> 	DIR="/tmp/$i"
> 	mkdir -p "$DIR"
> 
> 	ln -snf ip.$i ip/ip
> 
> 	for o in '' -s -d; do
> 		ip/ip $o tunnel show           >"$DIR/ip${o}-tunnel-show"
> 		ip/ip -4 $o tunnel show        >"$DIR/ip-4${o}-tunnel-show"
> 		ip/ip -6 $o tunnel show        >"$DIR/ip-6${o}-tunnel-show"
> 		ip/ip $o tunnel show dev "$iface" \
> 			>"$DIR/ip${o}-tunnel-show-$iface"
> 		ip/ip $o tuntap show           >"$DIR/ip${o}-tuntap-show"
> 	done
> done
> rm -f ip/ip
> 
> diff -urN /tmp/{old,new} |sed -n -Ee'/^(-{3}|\+{3})[[:space:]]+/!p'
> rc=$?
> 
> popd &>/dev/null
> exit $rc
> 
> Results:
> ========
> 
> ...
> fopen /sys/class/net/ipip1/tun_flags: No such file or directory
> fopen /sys/class/net/ipip2/tun_flags: No such file or directory
> fopen /sys/class/net/gre10/tun_flags: No such file or directory
> ...
Note that this comes from ip.old (before series applied) on 3.2 kernel.

> diff -urN /tmp/old/ip-d-tuntap-show /tmp/new/ip-d-tuntap-show
> @@ -1,4 +1,4 @@
> -tun1: tap user 1004 group 27
> -	Attached to processes:
>  tun0: tun user 1000 group 27
>  	Attached to processes:
> +tun1: tap user 1004 group 27
> +	Attached to processes:
> diff -urN /tmp/old/ip-s-tuntap-show /tmp/new/ip-s-tuntap-show
> @@ -1,2 +1,2 @@
> -tun1: tap user 1004 group 27
>  tun0: tun user 1000 group 27
> +tun1: tap user 1004 group 27
> diff -urN /tmp/old/ip-tuntap-show /tmp/new/ip-tuntap-show
> @@ -1,2 +1,2 @@
> -tun1: tap user 1004 group 27
>  tun0: tun user 1000 group 27
> +tun1: tap user 1004 group 27
> 
> So basically only print order for ip tuntap get changes. Rest is intact.
> 
> Thanks,
> Serhii
> 
> Serhey Popovych (6):
>   ipaddress: Unify print_link_stats() and print_link_stats64()
>   ip: Introduce get_rtnl_link_stats_rta() to get link statistics
>   tunnel: Split statistic getting and printing
>   iptunnel/ip6tunnel: Code cleanups
>   iptunnel/ip6tunnel: Use netlink to walk through tunnels list
>   tuntap: Use netlink to walk through tuntap list
> 
>  include/utils.h |    3 +
>  ip/ip6tunnel.c  |  115 +++++++++++----------------------
>  ip/ipaddress.c  |  189 ++++---------------------------------------------------
>  ip/iptunnel.c   |   93 +++++++++------------------
>  ip/iptuntap.c   |  121 ++++++++++++++++++++++++++---------
>  ip/tunnel.c     |  114 ++++++++++++++++++++++++++-------
>  ip/tunnel.h     |   17 ++++-
>  lib/utils.c     |   45 +++++++++++++
>  8 files changed, 324 insertions(+), 373 deletions(-)
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

      parent reply	other threads:[~2018-02-02 13:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 13:10 [PATCH iproute2-next 0/6] ip: Use netlink to walk through network device list Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 1/6] ipaddress: Unify print_link_stats() and print_link_stats64() Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 2/6] ip: Introduce get_rtnl_link_stats_rta() to get link statistics Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 3/6] tunnel: Split statistic getting and printing Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 4/6] iptunnel/ip6tunnel: Code cleanups Serhey Popovych
2018-02-07  2:16   ` David Ahern
2018-02-07  2:19     ` David Ahern
2018-02-07  6:20       ` Serhey Popovych
2018-02-07  6:15     ` Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 5/6] iptunnel/ip6tunnel: Use netlink to walk through tunnels list Serhey Popovych
2018-02-02 13:10 ` [PATCH iproute2-next 6/6] tuntap: Use netlink to walk through tuntap list Serhey Popovych
2018-02-02 13:21 ` Serhey Popovych [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d7c84f9-efd0-b5e6-e2fd-d8d2fc38b992@gmail.com \
    --to=serhe.popovych@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.