[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensolaris-networking-discuss
Subject:    Re: [networking-discuss] getaddrinfo API with Partial IP in node
From:       Nicolas Williams <Nicolas.Williams () oracle ! com>
Date:       2010-12-27 17:05:12
Message-ID: 20101227170511.GH1091 () oracle ! com
[Download RAW message or body]

On Mon, Dec 27, 2010 at 04:48:57AM -0800, kiranb wrote:
> <snip>
> struct addrinfo AddrHints, *res;
> memset(&AddrHints, 0, sizeof(AddrHints));
> AddrHints.ai_flags = AI_NUMERICHOST;
> service =NULL;
> Node = (IPV4 or IPV6 address)
> 
> getaddrinfo(Node, NULL , &AddrHints, &res);
> 
> if(res->ai_family == AF_INET6) { ... }
> 
> if(res->ai_family == AF_INET) { ... }
> </snip>
> 
> ----------------------------------------------------------------------------------------------
>  
> [...]
> CASE 2 :Partial IPV4
> When a partial IPV4 address is provided in node parameter of getaddrinfo(), it \
> returns correctly ai_family as INET (means its a IPV4) Partial IPV4 ip address \
> [node = "A.B.C"]

Where does the manpage say that "partial" IPv4 addresses are allowed?
Granted, the manpage doesn't say that partial addresses are NOT allowed,
but given the purpose of this function, only full addresses (or
hostnames) make sense here.  "A.B.C" syntax is deprecated, replaced with
CIDR notation (either "A.B.C.D" or "A[.B[.C[.D]]]/L").

The fact that partial IPv4 addresses work here should not be relied
upon.  I would consider behavior in the face of partial addresses to be
undefined.

Note that the OpenGroup manpage for getaddrinfo() says nothing about
partial addresses.  Also, there's no EAI_* code that corresponds to
"invalid input" -- the function would have to return EAI_SYSTEM and set
errno = EINVAL.

> CASE 3: Partial IPV6
> When a partial IPV6 address is provided in node parameter of getaddrinfo(), it \
> returns the res contents with INET6 as the ai_family. Partial IPV6 ip address [node \
> = "Aa:Bb:Cc"] This seems to contradict with the information provided in Solaris man \
> pages. 
> As per man pages reference :http://www.manpages.info/sunos/inet.7.html
> <snip>

You can find all Solaris manpages at http://docs.sun.com/ .

By the form of the URL you give I'd expect a section 7 manpage, but we
only have section 7p manpages for inet and inet6.  Instead I get the
section 3SOCKET manpage for inet.  Strange.  But then manpages.info is
not an official source of Solaris manpages :)  Also, it does say "SunOS
5.8" -- what version of Solaris are you using?

Now, the inet(3SOCKET) manpage in Solaris 11 Express does still say what
you quote.  However, "partial" IPv4 address syntax really should be
considered deprecated -- I believe there's a manpage bug here in that
the manpage ought to point that out, and that CIDR notation is preferred
(though I'm not sure that these particular functions support CIDR
notation).

Nico
-- 
_______________________________________________
networking-discuss mailing list
networking-discuss@opensolaris.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic