lkml.org 
[lkml]   [1998]   [Oct]   [30]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] /proc/fs/nfsd/exports
DateFri, 30 Oct 1998 14:13:20 +0200 (EET)
FromMatti Aarnio <>
(Linus does not like my opinnion, and voices it loudly..)
...
> What?
> 
> The values are IPv4 addresses. There is _one_ standard way of printing
> them, and that standard way is as four decimal numbers. EVERYBODY prints
> them that way. It's the only sane way to show them. 

(speaking in scope where IPv4 and IPv6 addresses are likely to appear
 in the same position of the /proc 'file')

If you want to print addresses as the classical IPv4 presentation says,
and then use colon to separate port number from address, the IPv6 will
give you a "nasty" surprise:

eth0  Link encap:Ethernet  HWaddr 00:00:F8:75:7B:3B
      inet addr:194.252.70.2  Bcast:194.252.70.255  Mask:255.255.255.0
      inet6 addr: 3ffe:2610:2:fe00:200:f8ff:fe75:7b3b/64 Scope:Global
      inet6 addr: fe80::200:f8ff:fe75:7b3b/10 Scope:Link


So be damn carefull where you present them with 'standard' encodings.

$ cat /proc/net/tcp
  sl  local_address rem_address   st tx_queue rx_queue tr tm->when
   0: 0246FCC2:03FB 44FFFBC2:0016 01 00000000:00000000 00:00000000
   1: 0246FCC2:0016 F347FCC2:03FE 01 00000000:00000000 00:00000000
...
$ cat /proc/net/tcp6
sl  local_address remote_address ...
 0: 0000000000000000FFFF00000246FCC2:0019 0000000000000000FFFF0000197B59C0:C799
...
$ netstat -n
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address           Foreign Address
tcp        0      0 194.252.70.2:1019       194.251.255.68:22
tcp        0      0 194.252.70.2:22         194.252.71.243:1022
tcp        0      0 ::ffff:194.252.70.2:25  ::ffff:128.214.248:1325
> There is no question in my mind - printing out IPv4 addresses as hex
> "integers" is wrong. It has always been wrong, and it's wrong now. It
> happens to be very simple, which is the excuse for doing it, but it's
> still wrong.

	Standard (although deprecated) mode to present IPv4 addresses
	in email is also:  (unsigned 32-bit integer)
		[#3271312898]

	I still hold an opinion that cleanest form is to present them
	as arrays of hex-encoded bytes.  They may look like hex-encoded
	integers to the uninformed, but that is not the intention.

	I don't mind the different encodings when there is no change
	of mistakes, but with NFS running over IPv6 we will definitely
	get into these issues sooner or latter.  There I want it to
	be as unambiguous as possible!

> 		Linus

/Matti Aarnio <matti.aarnio@sonera.fi>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [from the cache]
©2003-2008