On 1/31/18 10:21 AM, Serhey Popovych wrote: > Eric Dumazet wrote: >> ip tuntap enumerates devices using /sys/class/net which is unusual. >> >> Should we replace this enumeration using /proc/net/dev like "ip tunnel" ? >> >> After "unshare -n" maybe mounting /sys should not be required for >> proper iproute2 behavior. >> >> At least ip command should adopt a common enumeration method. >> >> 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. >
pid_name function needs help too. comm is allocated via sprintf, freed, and used again and then returned to caller.