Subject: Re: sockaddr_snprintf
To: None <christos@zoulas.com>
From: Jun-ichiro itojun Hagino <itojun@itojun.org>
List: tech-userlevel
Date: 11/16/2004 13:34:46
> On Nov 16,  1:10pm, itojun@itojun.org (Jun-ichiro itojun Hagino) wrote:
> -- Subject: Re: sockaddr_snprintf
> 
> | > Hi,
> | > 
> | > I was missing a sockaddr pretty printer, and it was some amount of work
> | > on each program to write one... So I came up with this. Is this useful?
> | > Any suggestions on the interface? I was thinking of putting it in libutil.
> | 
> | 	please use getnameinfo(3) to get string representation of
> | 	AF_INET and AF_INET6 sockaddr.  (for AF_INET6, it is a hard requirement)
> 
> This is like using a machine gun to kill flies. I specifically
> don't want to do DNS, so I will have to put NI_NUMERICHOST, and I
> don't want to prefix the address with the scope, so I'll have to
> strip it later. And getnameinfo() uses inet_ntop() internally to
> do exactly what I am doing.

	scoped address without sccope (fe80::1) is ambiguous and useless.
	consider the following example:

	fe80::1
	  |
	==+==========
	  |fxp0
	your host
	  |fxp1
	==+==========
	  |
	fe80::1

	if you are told that your peer is "fe80::1", you don't know which one
	you are talking to.

itojun