From: Serhey Popovych Subject: Re: [BUG iproute2] ip tuntap show Date: Wed, 31 Jan 2018 19:21:57 +0200 Message-ID: <84e6cb8a-f140-4ced-4f6a-c508eaf06f6c@gmail.com> References: <1517417908.3715.102.camel@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LzPBwqWZhMKUDUfIw1K0uhsfmosq16cJH" Cc: netdev , =?UTF-8?Q?Maciej_=c5=bbenczykowski?= To: Eric Dumazet , Stephen Hemminger , David Ahern Return-path: Received: from mail-wr0-f174.google.com ([209.85.128.174]:41703 "EHLO mail-wr0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752061AbeAaRWN (ORCPT ); Wed, 31 Jan 2018 12:22:13 -0500 Received: by mail-wr0-f174.google.com with SMTP id v15so15861091wrb.8 for ; Wed, 31 Jan 2018 09:22:13 -0800 (PST) In-Reply-To: <1517417908.3715.102.camel@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LzPBwqWZhMKUDUfIw1K0uhsfmosq16cJH Content-Type: multipart/mixed; boundary="ut5gkGyMHzXIaL0DNkHv5ZuCrSSTSr5Sa"; protected-headers="v1" From: Serhey Popovych To: Eric Dumazet , Stephen Hemminger , David Ahern Cc: netdev , =?UTF-8?Q?Maciej_=c5=bbenczykowski?= Message-ID: <84e6cb8a-f140-4ced-4f6a-c508eaf06f6c@gmail.com> Subject: Re: [BUG iproute2] ip tuntap show References: <1517417908.3715.102.camel@gmail.com> In-Reply-To: <1517417908.3715.102.camel@gmail.com> --ut5gkGyMHzXIaL0DNkHv5ZuCrSSTSr5Sa Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Eric Dumazet wrote: > ip tuntap enumerates devices using /sys/class/net which is unusual. >=20 > Should we replace this enumeration using /proc/net/dev like "ip tunnel"= ? >=20 > After "unshare -n" maybe mounting /sys should not be required for > proper iproute2 behavior. >=20 > At least ip command should adopt a common enumeration method. >=20 > What do you think ? It seems main reason for using /sys/class/net is to get additional information for netdev like "owner", "group" and "tun_flags". On the other hand at least iptunnel and ip6tunnel uses nearly identical code to parse /proc/net/dev. Having single routine that reads /proc/net/dev and calls implementation specific callback function with given network device name is good idea. I can try to prepare v1 for this, if no one objects this. >=20 > Thanks. >=20 > lpaa5:~# cat /proc/net/dev > Inter-| Receive | Tra= nsmit > face |bytes packets errs drop fifo frame compressed multicast|bytes= packets errs drop fifo colls carrier compressed > adp0: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > uinput4: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > dynencap4: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > sixtofour0: 696886 6733 0 0 0 0 0 0 = 480743 4445 0 0 0 0 0 0 > uinput6: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > gretap0: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > ip6gre0: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > tunl0: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > ip6tnl0: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > gre0: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > sit0: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > sixdecap0: 0 0 0 0 0 0 0 0 = 559849 2371 0 0 0 0 0 0 > lo: 80924524 222675 0 0 0 0 0 0 8092= 4524 222675 0 0 0 0 0 0 > eth2: 8898473491 131730002 0 0 0 0 0 89 = 8606929352 128406009 0 0 0 0 0 0 > dynencap6: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 > eth1: 9219322658 137558705 0 0 0 0 0 1592 = 9438658576 140822798 0 0 0 0 0 0 > eth0: 18117796393 269288710 0 0 0 0 0 1682= 18045588486 269228813 0 3 0 0 0 0 >=20 > lpaa5:~# unshare -n >=20 > lpaa5:~# cat /proc/net/dev > Inter-| Receive | Tra= nsmit > face |bytes packets errs drop fifo frame compressed multicast|bytes= packets errs drop fifo colls carrier compressed > lo: 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 >=20 > lpaa5:~# ip tuntap > adp0: tap vnet_hdr UNKNOWN_FLAGS:940 >=20 > lpaa5:~# mount -t sysfs sysfs /sys >=20 > lpaa5:~# ip tuntap >=20 > lpaa5:~# ls -l /sys/class/net > total 0 > -rw-r--r-- 1 root root 4096 Jan 31 08:51 bonding_masters > lrwxrwxrwx 1 root root 0 Jan 31 08:51 lo -> ../../devices/virtual/ne= t/lo > lpaa5:~#=20 >=20 --ut5gkGyMHzXIaL0DNkHv5ZuCrSSTSr5Sa-- --LzPBwqWZhMKUDUfIw1K0uhsfmosq16cJH 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) iQEcBAEBAgAGBQJacftCAAoJEBTawMmQ61bBL4MH/j9i3qhoaplB4puP84K7Cnko BwhMHFjmZbb1TpyGmZEOlsOhRpfTAVPwDp5d2ui4xkakwj/wlwZq5CdxDF74DvEI dI0R+5Q97F2CrLFDECPZuGfEP5Yry2yGNh1QYTglcTM5liAYOx40PixH6CMo+73G h5TkiRkZ0VfTFzTAikREKPEPz01/X3Oz6Re52QL7Bl5AWsc4nkZAyhR35dWOh0Na zzgHudzkkcpuICPX4nSi+g4vvnkCJMmHQW0kAimASGomZ2BUjx0Qe3lnTlNLRgol sUdTNPW5bcOC8DURzNbhOQoLH1CkGvpw8i4t0Ybzl3XlWamDchRfXoeXIQgXytM= =Xu1x -----END PGP SIGNATURE----- --LzPBwqWZhMKUDUfIw1K0uhsfmosq16cJH--