Subject: (IPng 7469) Re: name resolution and NO_ADDRESS

From: [email-masked] (Sam Manthorpe)
Date: Sat, 1 May 1999 19:29:47 -0700 (PDT)

Sam Manthorpe wrote:
> While updating out implementation of getipnodebyname() to 
> draft-ietf-ipngwg-bsd-api-new-06.txt, I found the document (maybe
> intentionally) unclear as to the return values of the function.  

Sorry, I do, of course, mean the value returned in the error_num
parameter of the function, not the `return value' true of the 
function.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sam Manthorpe, SGI.  tel: (650)933-2856 fax: (650)932-2856  [email-masked]
--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [email-masked]
--------------------------------------------------------------------

---

From: [email-masked] (Sam Manthorpe)
Date: Sat, 1 May 1999 19:21:51 -0700 (PDT)

Hello,

I have a specific question:

	If a lookup is done for name X using getipnodebyname()
	with an address family of A and flags=0, and no entry 
	exists for family A, but one does for family B, is 
	getipnodebyname() obliged to return NO_ADDRESS, or can 
	it just return HOST_NOT_FOUND?

Since IPv4 addresses and IPv6 addresses are stored in separate
tables, a `MUST return NO_ADDRESS' would require two table lookups
for many calls to getipnodebyname(). The extra information provided 
to the application by NO_ADDRESS does not warrant this extra work, IMO.

Thanks for any clarifying information, or just information on
how others have implemented this.

-- Sam

---

From: Jim Paugh <[email-masked]>
Date: Mon, 3 May 1999 13:24:50 -0700 (PDT)

-> I have a specific question:
-> 
-> 	If a lookup is done for name X using getipnodebyname()
-> 	with an address family of A and flags=0, and no entry 
-> 	exists for family A, but one does for family B, is 
-> 	getipnodebyname() obliged to return NO_ADDRESS, or can 
-> 	it just return HOST_NOT_FOUND?
->
-> Since IPv4 addresses and IPv6 addresses are stored in separate
-> tables, a `MUST return NO_ADDRESS' would require two table lookups
-> for many calls to getipnodebyname(). The extra information provided 
-> to the application by NO_ADDRESS does not warrant this extra work, 

We put both v4 and v6 addresses together in the "ipnodes" database, so
that one lookup retrieves both. In the case of AF_INET6 and flags=0, the
v4 addresses are filtered out. If there is nothing left after filtering
the v4s, then NO_ADDRESS is returned. Now we also maintain the "hosts"
database for the gethostby*() APIs, for backwards compatibility. The 
getipnodeby*() APIs know about the hosts db, so for lookups specifically
for v4 addresses, if none are found in the ipnodes db, the hosts db
is queried. But for the specific case of AF_INET6 and flags=0 (ie v6
only), if none are found in the ipnodes db, we don't check the hosts db for v4
entries, to distinguish between NO_ADDRESS and HOST_NOT_FOUND.

I would say that for the specific query that you have done, if addresses are
found, but none that match the request, then return NO_ADDRESS. But if your
specific query turns up empty, return HOST_NOT_FOUND.

~Jim

________________________________________________________________
James M. Paugh                          email: [email-masked]
Solaris Internet Engineering            phone: (650) 786-5087
Sun Microsystems Inc.                     fax: (650) 786-6137
________________________________________________________________

---

From: [email-masked] (Sam Manthorpe)
Date: Mon, 3 May 1999 13:57:47 -0700 (PDT)

Hi Jim,

Thanks for the reply.  Our implementation works in pretty much
the same way as yours.

> specific query turns up empty, return HOST_NOT_FOUND.

Okay good, that's what we have now.  The inet-draft is quite vague about
these error messages; is that intentional?

By the way, did you ever fix a policy in terms of transition of IPv4
addresses from hosts to ipnodes?  Does you gethostbyname() look in
the ipnodes tables?

Thanks,
Sam.

---

From: Jim Paugh <[email-masked]>
Date: Mon, 3 May 1999 18:00:07 -0700 (PDT)

-> Okay good, that's what we have now.  The inet-draft is quite vague about
-> these error messages; is that intentional?

I believe it was to allow some latitude in implementation.

-> By the way, did you ever fix a policy in terms of transition of IPv4
-> addresses from hosts to ipnodes?  Does you gethostbyname() look in
-> the ipnodes tables?

No, we left gethostbyname() alone, so it doesn't know about ipnodes. Not
wanting to impact legacy apps with IPv6, it was decided that adding a second
lookup to gethostbyname() would be undesireable. Also, since many apps and
scripts cheat and look directly at /etc/hosts or ypcat hosts.byname that it
could cause breakage if gethostbyname() where to get addresses from a new
location.

So getipnodesbyname() looks in ipnodes for v4 addresses. If not found there,
it then fails over to hosts. Note that if v4s are found in ipnodes, no search
of hosts is done.

~Jim