Re: /proc/net/{udp,tcp}{,6} : ip address format : RFC : need for /proc/net/{udp,tcp}{,6}{{n,h},{le,be}} ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



RE: On 20 July 2021 at 23:41, Stephen Hemminger wrote:
>> So, yes what you say makes sense but that was not how the early
>> prehistoric (2.4 or earlier) versions of Linux decided to output addresses
>> and it can never change.

I don't like those words: "it can never change" !:-)

How about either or both Options B & C under sysfs then?

ie. something like /sys/class/net/{udp,tcp}{,6,n,h,ip,bin}
    6: ipv6
 [optionally:
  [ n: hex, network byte order
    h: hex, host byte order
   ip: ipv4 ascii dotted quad decimal IPv4 address with ':' <port>
       suffix, and decimal numbers         
   ip6:ipv6 ascii 32-bit hex words of IPv6 address separated by ':' (or
       '::') with '#' <port> suffix, with decimal numbers
  ] [and / or:
   bin:memory mapped read-only binary table
  ]]

I know ip route and netlink can be used. But since Linux is mandated to
print the IP socket and routing tables in ASCII, which I think is a
great idea for shell / perl / python / java / nodejs / lisp / "script language X" scripts,
in the /proc/net/{udp,tcp}* files, it should net be precluded from providing
a better attempt in new files / filesystems - that is all I am
suggesting.

It is a much more attractive proposition for scripts to parse some ASCII
text rather than having to make a call into a native code library or run an
executable like 'ip' (iproute2) to use netlink sockets for this ;
since Linux has to do this job for the /proc filesystem anyway,
why not at least consider then idea of improving & extending this
excellent support for scripts , and make their task simpler and more
efficient ? ie. they could use one number conversion routine for
all numbers in each new file.

I'd personally find such tables most useful, and might actually develop
a module for them. Especially if they included the netlink IP stats
like 64-bit total counts of rx & tx bytes for each socket as well
as rx & tx queue lengths.

Best Regards,
Jason












[Index of Archives]     [Kernel]     [Linux ia64]     [DCCP]     [Linux for ARM]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux