From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serhey Popovych 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 Message-ID: <4d7c84f9-efd0-b5e6-e2fd-d8d2fc38b992@gmail.com> References: <1517577055-23788-1-git-send-email-serhe.popovych@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cgFoUuhVQiVSRLYpl4428Nv4NNpt25ABZ" To: netdev@vger.kernel.org Return-path: Received: from mail-wm0-f41.google.com ([74.125.82.41]:37815 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751567AbeBBNVx (ORCPT ); Fri, 2 Feb 2018 08:21:53 -0500 Received: by mail-wm0-f41.google.com with SMTP id v71so12356419wmv.2 for ; Fri, 02 Feb 2018 05:21:52 -0800 (PST) Received: from tuxracer.as41781.net ([194.44.35.131]) by smtp.gmail.com with ESMTPSA id w17sm1737865eda.96.2018.02.02.05.21.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Feb 2018 05:21:50 -0800 (PST) In-Reply-To: <1517577055-23788-1-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cgFoUuhVQiVSRLYpl4428Nv4NNpt25ABZ Content-Type: multipart/mixed; boundary="B0ubxrYNvNSEYooWRkPLmyiGMgBiq6CNm"; protected-headers="v1" From: Serhey Popovych To: netdev@vger.kernel.org Message-ID: <4d7c84f9-efd0-b5e6-e2fd-d8d2fc38b992@gmail.com> Subject: Re: [PATCH iproute2-next 0/6] ip: Use netlink to walk through network device list References: <1517577055-23788-1-git-send-email-serhe.popovych@gmail.com> In-Reply-To: <1517577055-23788-1-git-send-email-serhe.popovych@gmail.com> --B0ubxrYNvNSEYooWRkPLmyiGMgBiq6CNm Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Following changed since RFC was sent: >=20 > 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. >=20 > 2) Remove @name and @size parameters from @struct tnl_print_nlmsg_inf= o > since we can get them easily from other data. >=20 > Testing. > =3D=3D=3D=3D=3D=3D=3D=3D >=20 > Following script is used to ensure I didn't broke things too much: >=20 > \#!/bin/bash >=20 > iproute2_dir=3D"$1" > iface=3D'gre1' >=20 > pushd "$iproute2_dir" &>/dev/null >=20 > for i in new old; do > DIR=3D"/tmp/$i" > mkdir -p "$DIR" >=20 > ln -snf ip.$i ip/ip >=20 > 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 >=20 > diff -urN /tmp/{old,new} |sed -n -Ee'/^(-{3}|\+{3})[[:space:]]+/!p' > rc=3D$? >=20 > popd &>/dev/null > exit $rc >=20 > Results: > =3D=3D=3D=3D=3D=3D=3D=3D >=20 > ... > 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 >=20 > So basically only print order for ip tuntap get changes. Rest is intact= =2E >=20 > Thanks, > Serhii >=20 > 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 >=20 > 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(-) >=20 --B0ubxrYNvNSEYooWRkPLmyiGMgBiq6CNm-- --cgFoUuhVQiVSRLYpl4428Nv4NNpt25ABZ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJadGXtAAoJEBTawMmQ61bBROkIAI5lECzkzuq4Pc1OW5YHuuLC cCqtzd7npy2apj/sjBD1vQwbEoykDmgyh0U6EYacpqTUV3omLHjSx8sUmSUqgxzf BczzVzTtoCUnP9/azahgXaUwibWIN7az0H4qqRZzD42NrHJaexrge1XE81e8jXHd uKV+qgpuQDxEldVNzdUti41QoA4g970sT2RclVEsaIsXxff8iMRj+iSUy0nca4eS lakRJF4wuGCkh+QSiGViMr6fkUYSe5zeGhHis/M7mCuJAtQW/ZVHVDoVc5mWqaB6 l9z7T3P5tBYwc0GrcLAr1HgBGtJ4V10QUs6L5XaMuXDDCsxmlaI5i4IaqP3AzHk= =h6YB -----END PGP SIGNATURE----- --cgFoUuhVQiVSRLYpl4428Nv4NNpt25ABZ--