2000-08-09 23:16:23 +00:00
|
|
|
.\" $KAME: getipnodebyname.3,v 1.6 2000/08/09 21:16:17 itojun Exp $
|
|
|
|
.\"
|
1999-12-28 02:37:14 +00:00
|
|
|
.\" Copyright (c) 1983, 1987, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
|
2002-12-18 12:45:11 +00:00
|
|
|
.\" $FreeBSD$
|
1999-12-28 02:37:14 +00:00
|
|
|
.\"
|
|
|
|
.Dd May 25, 1995
|
|
|
|
.Dt GETIPNODEBYNAME 3
|
2000-08-09 23:16:23 +00:00
|
|
|
.Os
|
1999-12-28 02:37:14 +00:00
|
|
|
.\"
|
|
|
|
.Sh NAME
|
|
|
|
.Nm getipnodebyname ,
|
|
|
|
.Nm getipnodebyaddr ,
|
|
|
|
.Nm freehostent
|
|
|
|
.Nd nodename-to-address and address-to-nodename translation
|
|
|
|
.\"
|
2000-04-21 09:42:15 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
1999-12-28 02:37:14 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/types.h
|
|
|
|
.In sys/socket.h
|
|
|
|
.In netdb.h
|
1999-12-28 02:37:14 +00:00
|
|
|
.Ft "struct hostent *"
|
|
|
|
.Fn getipnodebyname "const char *name" "int af" "int flags" "int *error_num"
|
|
|
|
.Ft "struct hostent *"
|
|
|
|
.Fn getipnodebyaddr "const void *src" "size_t len" "int af" "int *error_num"
|
|
|
|
.Ft void
|
|
|
|
.Fn freehostent "struct hostent *ptr"
|
|
|
|
.\"
|
|
|
|
.Sh DESCRIPTION
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
1999-12-28 02:37:14 +00:00
|
|
|
.Fn getipnodebyname
|
|
|
|
and
|
|
|
|
.Fn getipnodebyaddr
|
|
|
|
functions are very similar to
|
|
|
|
.Xr gethostbyname 3 ,
|
|
|
|
.Xr gethostbyname2 3
|
|
|
|
and
|
|
|
|
.Xr gethostbyaddr 3 .
|
|
|
|
The functions cover all the functionalities provided by the older ones,
|
|
|
|
and provide better interface to programmers.
|
|
|
|
The functions require additional arguments,
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af ,
|
1999-12-28 02:37:14 +00:00
|
|
|
and
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa flags ,
|
1999-12-28 02:37:14 +00:00
|
|
|
for specifying address family and operation mode.
|
|
|
|
The additional arguments allow programmer to get address for a nodename,
|
|
|
|
for specific address family
|
2001-08-07 15:48:51 +00:00
|
|
|
(such as
|
1999-12-28 02:37:14 +00:00
|
|
|
.Dv AF_INET
|
|
|
|
or
|
2001-08-07 15:48:51 +00:00
|
|
|
.Dv AF_INET6 ) .
|
1999-12-28 02:37:14 +00:00
|
|
|
The functions also require an additional pointer argument,
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa error_num
|
1999-12-28 02:37:14 +00:00
|
|
|
to return the appropriate error code,
|
|
|
|
to support thread safe error code returns.
|
|
|
|
.Pp
|
|
|
|
The type and usage of the return value,
|
|
|
|
.Li "struct hostent"
|
|
|
|
is described in
|
|
|
|
.Xr gethostbyname 3 .
|
|
|
|
.Pp
|
|
|
|
For
|
|
|
|
.Fn getipnodebyname ,
|
|
|
|
the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa name
|
2000-08-09 23:16:23 +00:00
|
|
|
argument can be either a node name or a numeric address
|
1999-12-28 02:37:14 +00:00
|
|
|
string
|
2001-08-07 15:48:51 +00:00
|
|
|
(i.e., a dotted-decimal IPv4 address or an IPv6 hex address).
|
1999-12-28 02:37:14 +00:00
|
|
|
The
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
argument specifies the address family, either
|
|
|
|
.Dv AF_INET
|
|
|
|
or
|
|
|
|
.Dv AF_INET6 .
|
|
|
|
The
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa flags
|
1999-12-28 02:37:14 +00:00
|
|
|
argument specifies the types of addresses that are searched for,
|
|
|
|
and the types of addresses that are returned.
|
|
|
|
We note that a special flags value of
|
|
|
|
.Dv AI_DEFAULT
|
2001-08-07 15:48:51 +00:00
|
|
|
(defined below)
|
1999-12-28 02:37:14 +00:00
|
|
|
should handle most applications.
|
|
|
|
That is, porting simple applications to use IPv6 replaces the call
|
|
|
|
.Bd -literal -offset
|
|
|
|
hptr = gethostbyname(name);
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
with
|
|
|
|
.Bd -literal -offset
|
|
|
|
hptr = getipnodebyname(name, AF_INET6, AI_DEFAULT, &error_num);
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Applications desiring finer control over the types of addresses
|
|
|
|
searched for and returned, can specify other combinations of the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa flags
|
1999-12-28 02:37:14 +00:00
|
|
|
argument.
|
|
|
|
.Pp
|
|
|
|
A
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa flags
|
1999-12-28 02:37:14 +00:00
|
|
|
of
|
|
|
|
.Li 0
|
|
|
|
implies a strict interpretation of the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
argument:
|
|
|
|
.Bl -bullet
|
|
|
|
.It
|
|
|
|
If
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa flags
|
1999-12-28 02:37:14 +00:00
|
|
|
is 0 and
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
is
|
|
|
|
.Dv AF_INET ,
|
|
|
|
then the caller wants only IPv4 addresses.
|
|
|
|
A query is made for
|
|
|
|
.Li A
|
|
|
|
records.
|
|
|
|
If successful, the IPv4 addresses are returned and the
|
|
|
|
.Li h_length
|
|
|
|
member of the
|
|
|
|
.Li hostent
|
|
|
|
structure will be 4, else the function returns a
|
|
|
|
.Dv NULL
|
|
|
|
pointer.
|
|
|
|
.It
|
|
|
|
If
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa flags
|
1999-12-28 02:37:14 +00:00
|
|
|
is 0 and if
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
is
|
|
|
|
.Li AF_INET6 ,
|
|
|
|
then the caller wants only IPv6 addresses.
|
|
|
|
A query is made for
|
|
|
|
.Li AAAA
|
|
|
|
records.
|
|
|
|
If successful, the IPv6 addresses are returned and the
|
|
|
|
.Li h_length
|
|
|
|
member of the
|
|
|
|
.Li hostent
|
|
|
|
structure will be 16, else the function returns a
|
|
|
|
.Dv NULL
|
|
|
|
pointer.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Other constants can be logically-ORed into the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa flags
|
1999-12-28 02:37:14 +00:00
|
|
|
argument, to modify the behavior of the function.
|
|
|
|
.Bl -bullet
|
|
|
|
.It
|
|
|
|
If the
|
|
|
|
.Dv AI_V4MAPPED
|
|
|
|
flag is specified along with an
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
of
|
|
|
|
.Dv AF_INET6 ,
|
|
|
|
then the caller will accept IPv4-mapped IPv6 addresses.
|
|
|
|
That is, if no
|
|
|
|
.Li AAAA
|
|
|
|
records are found then a query is made for
|
|
|
|
.Li A
|
|
|
|
records and any found are returned as IPv4-mapped IPv6 addresses
|
2001-08-07 15:48:51 +00:00
|
|
|
.Li ( h_length
|
|
|
|
will be 16).
|
1999-12-28 02:37:14 +00:00
|
|
|
The
|
|
|
|
.Dv AI_V4MAPPED
|
|
|
|
flag is ignored unless
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
equals
|
|
|
|
.Dv AF_INET6 .
|
|
|
|
.It
|
|
|
|
The
|
|
|
|
.Dv AI_V4MAPPED_CFG
|
|
|
|
flag is exact same as the
|
|
|
|
.Dv AI_V4MAPPED
|
|
|
|
flag only if the kernel supports IPv4-mapped IPv6 address.
|
|
|
|
.It
|
|
|
|
If the
|
|
|
|
.Dv AI_ALL
|
|
|
|
flag is used in conjunction with the
|
|
|
|
.Dv AI_V4MAPPED
|
|
|
|
flag, and only used with the IPv6 address family.
|
|
|
|
When
|
|
|
|
.Dv AI_ALL
|
|
|
|
is logically or'd with
|
|
|
|
.Dv AI_V4MAPPED
|
|
|
|
flag then the caller wants all addresses: IPv6 and IPv4-mapped IPv6.
|
|
|
|
A query is first made for
|
|
|
|
.Li AAAA
|
|
|
|
records and if successful, the
|
2004-07-02 23:52:20 +00:00
|
|
|
IPv6 addresses are returned.
|
|
|
|
Another query is then made for
|
1999-12-28 02:37:14 +00:00
|
|
|
.Li A
|
|
|
|
records and any found are returned as IPv4-mapped IPv6 addresses.
|
|
|
|
.Li h_length
|
2004-07-02 23:52:20 +00:00
|
|
|
will be 16.
|
|
|
|
Only if both queries fail does the function
|
1999-12-28 02:37:14 +00:00
|
|
|
return a
|
|
|
|
.Dv NULL
|
2004-07-02 23:52:20 +00:00
|
|
|
pointer.
|
|
|
|
This flag is ignored unless af equals
|
|
|
|
AF_INET6.
|
|
|
|
If both
|
1999-12-28 02:37:14 +00:00
|
|
|
.Dv AI_ALL
|
|
|
|
and
|
|
|
|
.Dv AI_V4MAPPED
|
|
|
|
are specified,
|
|
|
|
.Dv AI_ALL
|
|
|
|
takes precedence.
|
|
|
|
.It
|
|
|
|
The
|
|
|
|
.Dv AI_ADDRCONFIG
|
|
|
|
flag specifies that a query for
|
|
|
|
.Li AAAA
|
|
|
|
records
|
|
|
|
should occur only if the node has at least one IPv6 source
|
|
|
|
address configured and a query for
|
|
|
|
.Li A
|
|
|
|
records should occur only if the node has at least one IPv4 source address
|
|
|
|
configured.
|
|
|
|
.Pp
|
|
|
|
For example, if the node has no IPv6 source addresses configured,
|
|
|
|
and
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
equals AF_INET6, and the node name being looked up has both
|
|
|
|
.Li AAAA
|
|
|
|
and
|
|
|
|
.Li A
|
|
|
|
records, then:
|
|
|
|
(a) if only
|
|
|
|
.Dv AI_ADDRCONFIG
|
|
|
|
is
|
|
|
|
specified, the function returns a
|
|
|
|
.Dv NULL
|
|
|
|
pointer;
|
|
|
|
(b) if
|
|
|
|
.Dv AI_ADDRCONFIG
|
|
|
|
|
|
|
|
|
.Dv AI_V4MAPPED
|
|
|
|
is specified, the
|
|
|
|
.Li A
|
|
|
|
records are returned as IPv4-mapped IPv6 addresses;
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The special flags value of
|
|
|
|
.Dv AI_DEFAULT
|
|
|
|
is defined as
|
|
|
|
.Bd -literal -offset
|
|
|
|
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
We noted that the
|
|
|
|
.Fn getipnodebyname
|
|
|
|
function must allow the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa name
|
1999-12-28 02:37:14 +00:00
|
|
|
argument to be either a node name or a literal address string
|
2001-08-07 15:48:51 +00:00
|
|
|
(i.e., a dotted-decimal IPv4 address or an IPv6 hex address).
|
1999-12-28 02:37:14 +00:00
|
|
|
This saves applications from having to call
|
|
|
|
.Xr inet_pton 3
|
|
|
|
to handle literal address strings.
|
|
|
|
When the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa name
|
1999-12-28 02:37:14 +00:00
|
|
|
argument is a literal address string,
|
|
|
|
the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa flags
|
1999-12-28 02:37:14 +00:00
|
|
|
argument is always ignored.
|
|
|
|
.Pp
|
|
|
|
There are four scenarios based on the type of literal address string
|
|
|
|
and the value of the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
argument.
|
|
|
|
The two simple cases are when
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa name
|
1999-12-28 02:37:14 +00:00
|
|
|
is a dotted-decimal IPv4 address and
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
equals
|
|
|
|
.Dv AF_INET ,
|
|
|
|
or when
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa name
|
1999-12-28 02:37:14 +00:00
|
|
|
is an IPv6 hex address and
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
equals
|
|
|
|
.Dv AF_INET6 .
|
|
|
|
The members of the
|
|
|
|
returned hostent structure are:
|
|
|
|
.Li h_name
|
|
|
|
points to a copy of the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa name
|
1999-12-28 02:37:14 +00:00
|
|
|
argument,
|
|
|
|
.Li h_aliases
|
|
|
|
is a
|
|
|
|
.Dv NULL
|
|
|
|
pointer,
|
|
|
|
.Li h_addrtype
|
|
|
|
is a copy of the
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
argument,
|
|
|
|
.Li h_length
|
|
|
|
is either 4
|
2001-08-07 15:48:51 +00:00
|
|
|
(for
|
|
|
|
.Dv AF_INET )
|
1999-12-28 02:37:14 +00:00
|
|
|
or 16
|
2001-08-07 15:48:51 +00:00
|
|
|
(for
|
|
|
|
.Dv AF_INET6 ) ,
|
1999-12-28 02:37:14 +00:00
|
|
|
.Li h_addr_list[0]
|
|
|
|
is a pointer to the 4-byte or 16-byte binary address,
|
|
|
|
and
|
|
|
|
.Li h_addr_list[1]
|
|
|
|
is a
|
|
|
|
.Dv NULL
|
|
|
|
pointer.
|
|
|
|
.Pp
|
|
|
|
When
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa name
|
1999-12-28 02:37:14 +00:00
|
|
|
is a dotted-decimal IPv4 address and
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
equals
|
|
|
|
.Dv AF_INET6 ,
|
|
|
|
and
|
|
|
|
.Dv AI_V4MAPPED
|
|
|
|
is specified,
|
|
|
|
an IPv4-mapped IPv6 address is returned:
|
|
|
|
.Li h_name
|
|
|
|
points to an IPv6 hex address containing the IPv4-mapped IPv6 address,
|
|
|
|
.Li h_aliases
|
|
|
|
is a
|
|
|
|
.Dv NULL
|
|
|
|
pointer,
|
|
|
|
.Li h_addrtype
|
|
|
|
is
|
|
|
|
.Dv AF_INET6 ,
|
|
|
|
.Li h_length
|
|
|
|
is 16,
|
|
|
|
.Li h_addr_list[0]
|
|
|
|
is a pointer to the 16-byte binary address, and
|
|
|
|
.Li h_addr_list[1]
|
|
|
|
is a
|
|
|
|
.Dv NULL
|
|
|
|
pointer.
|
|
|
|
.Pp
|
|
|
|
It is an error when
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa name
|
1999-12-28 02:37:14 +00:00
|
|
|
is an IPv6 hex address and
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa af
|
1999-12-28 02:37:14 +00:00
|
|
|
equals
|
|
|
|
.Dv AF_INET .
|
|
|
|
The function's return value is a
|
|
|
|
.Dv NULL
|
|
|
|
pointer and the value pointed to by
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa error_num
|
1999-12-28 02:37:14 +00:00
|
|
|
equals
|
|
|
|
.Dv HOST_NOT_FOUND .
|
|
|
|
.Pp
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
1999-12-28 02:37:14 +00:00
|
|
|
.Fn getipnodebyaddr
|
2002-12-18 12:45:11 +00:00
|
|
|
function
|
1999-12-28 02:37:14 +00:00
|
|
|
takes almost the same argument as
|
|
|
|
.Xr gethostbyaddr 3 ,
|
|
|
|
but adds a pointer to return an error number.
|
|
|
|
Additionally it takes care of IPv4-mapped IPv6 addresses,
|
|
|
|
and IPv4-compatible IPv6 addresses.
|
|
|
|
.Pp
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
1999-12-28 02:37:14 +00:00
|
|
|
.Fn getipnodebyname
|
|
|
|
and
|
|
|
|
.Fn getipnodebyaddr
|
2002-12-18 12:45:11 +00:00
|
|
|
functions
|
1999-12-28 02:37:14 +00:00
|
|
|
dynamically allocate the structure to be returned to the caller.
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
1999-12-28 02:37:14 +00:00
|
|
|
.Fn freehostent
|
2002-12-18 12:45:11 +00:00
|
|
|
function
|
1999-12-28 02:37:14 +00:00
|
|
|
reclaims memory region allocated and returned by
|
|
|
|
.Fn getipnodebyname
|
|
|
|
or
|
|
|
|
.Fn getipnodebyaddr .
|
|
|
|
.\"
|
|
|
|
.Sh FILES
|
Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.
= Hesiod has been added to libc (see hesiod(3)).
= A library routine for parsing nsswitch.conf and invoking callback
functions as specified has been added to libc (see nsdispatch(3)).
= The following C library functions have been modified to use nsdispatch:
. getgrent, getgrnam, getgrgid
. getpwent, getpwnam, getpwuid
. getusershell
. getaddrinfo
. gethostbyname, gethostbyname2, gethostbyaddr
. getnetbyname, getnetbyaddr
. getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr
= host.conf has been removed from src/etc. rc.network has been modified
to warn that host.conf is no longer used at boot time. In addition, if
there is a host.conf but no nsswitch.conf, the latter is created at boot
time from the former.
Obtained from: NetBSD
2000-09-06 18:16:48 +00:00
|
|
|
.Bl -tag -width /etc/nsswitch.conf -compact
|
1999-12-28 02:37:14 +00:00
|
|
|
.It Pa /etc/hosts
|
Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.
= Hesiod has been added to libc (see hesiod(3)).
= A library routine for parsing nsswitch.conf and invoking callback
functions as specified has been added to libc (see nsdispatch(3)).
= The following C library functions have been modified to use nsdispatch:
. getgrent, getgrnam, getgrgid
. getpwent, getpwnam, getpwuid
. getusershell
. getaddrinfo
. gethostbyname, gethostbyname2, gethostbyaddr
. getnetbyname, getnetbyaddr
. getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr
= host.conf has been removed from src/etc. rc.network has been modified
to warn that host.conf is no longer used at boot time. In addition, if
there is a host.conf but no nsswitch.conf, the latter is created at boot
time from the former.
Obtained from: NetBSD
2000-09-06 18:16:48 +00:00
|
|
|
.It Pa /etc/nsswitch.conf
|
1999-12-28 02:37:14 +00:00
|
|
|
.It Pa /etc/resolv.conf
|
|
|
|
.El
|
|
|
|
.\"
|
|
|
|
.Sh DIAGNOSTICS
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
2000-08-09 23:16:23 +00:00
|
|
|
.Fn getipnodebyname
|
1999-12-28 02:37:14 +00:00
|
|
|
and
|
2000-08-09 23:16:23 +00:00
|
|
|
.Fn getipnodebyaddr
|
2002-12-18 12:45:11 +00:00
|
|
|
functions
|
1999-12-28 02:37:14 +00:00
|
|
|
returns
|
|
|
|
.Dv NULL
|
|
|
|
on errors.
|
|
|
|
The integer values pointed to by
|
2002-12-18 13:33:04 +00:00
|
|
|
.Fa error_num
|
1999-12-28 02:37:14 +00:00
|
|
|
may then be checked to see whether this is a temporary failure
|
|
|
|
or an invalid or unknown host.
|
|
|
|
The meanings of each error code are described in
|
|
|
|
.Xr gethostbyname 3 .
|
|
|
|
.\"
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr gethostbyaddr 3 ,
|
2001-07-06 16:46:48 +00:00
|
|
|
.Xr gethostbyname 3 ,
|
1999-12-28 02:37:14 +00:00
|
|
|
.Xr hosts 5 ,
|
Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.
= Hesiod has been added to libc (see hesiod(3)).
= A library routine for parsing nsswitch.conf and invoking callback
functions as specified has been added to libc (see nsdispatch(3)).
= The following C library functions have been modified to use nsdispatch:
. getgrent, getgrnam, getgrgid
. getpwent, getpwnam, getpwuid
. getusershell
. getaddrinfo
. gethostbyname, gethostbyname2, gethostbyaddr
. getnetbyname, getnetbyaddr
. getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr
= host.conf has been removed from src/etc. rc.network has been modified
to warn that host.conf is no longer used at boot time. In addition, if
there is a host.conf but no nsswitch.conf, the latter is created at boot
time from the former.
Obtained from: NetBSD
2000-09-06 18:16:48 +00:00
|
|
|
.Xr nsswitch.conf 5 ,
|
1999-12-28 02:37:14 +00:00
|
|
|
.Xr services 5 ,
|
|
|
|
.Xr hostname 7 ,
|
|
|
|
.Xr named 8
|
|
|
|
.Pp
|
2000-08-09 23:16:23 +00:00
|
|
|
.Rs
|
|
|
|
.%A R. Gilligan
|
|
|
|
.%A S. Thomson
|
|
|
|
.%A J. Bound
|
|
|
|
.%A W. Stevens
|
|
|
|
.%T Basic Socket Interface Extensions for IPv6
|
|
|
|
.%R RFC2553
|
|
|
|
.%D March 1999
|
|
|
|
.Re
|
1999-12-28 02:37:14 +00:00
|
|
|
.\"
|
|
|
|
.Sh HISTORY
|
|
|
|
The implementation first appeared in KAME advanced networking kit.
|
|
|
|
.\"
|
|
|
|
.Sh STANDARDS
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
1999-12-28 02:37:14 +00:00
|
|
|
.Fn getipnodebyname
|
|
|
|
and
|
|
|
|
.Fn getipnodebyaddr
|
2002-12-18 12:45:11 +00:00
|
|
|
functions
|
2000-08-09 23:16:23 +00:00
|
|
|
are documented in
|
|
|
|
.Dq Basic Socket Interface Extensions for IPv6
|
2001-08-07 15:48:51 +00:00
|
|
|
(RFC2553).
|
1999-12-28 02:37:14 +00:00
|
|
|
.\"
|
|
|
|
.Sh BUGS
|
Make the resolver(3) and many associated interfaces much more reentrant.
The getaddrinfo(3), getipnodebyname(3) and resolver(3) can coincide now
with what should be totally reentrant, and h_errno values will now
be preserved correctly, but this does not affect interfaces such as
gethostbyname(3) which are still mostly non-reentrant.
In all of these relevant functions, the thread-safety has been pushed
down as far as it seems possible right now. This means that operations
that are selected via nsdispatch(3) (i.e. files, yp, dns) are protected
still under global locks that getaddrinfo(3) defines, but where possible
the locking is greatly reduced. The most noticeable improvement is
that multiple DNS lookups can now be run at the same time, and this
shows major improvement in performance of DNS-lookup threaded programs,
and solves the "Mozilla tab serialization" problem.
No single-threaded applications need to be recompiled. Multi-threaded
applications that reference "_res" to change resolver(3) options will
need to be recompiled, and ones which reference "h_errno" will also
if they desire the correct h_errno values. If the applications already
understood that _res and h_errno were not thread-safe and had their own
locking, they will see no performance improvement but will not
actually break in any way.
Please note that when NSS modules are used, or when nsdispatch(3)
defaults to adding any lookups of its own to the individual libc
_nsdispatch() calls, those MUST be reentrant as well.
2004-02-25 21:03:46 +00:00
|
|
|
Although the current implementation is otherwise thread-safe, using
|
|
|
|
it in conjunction with
|
|
|
|
.Fn gethostby*
|
2004-06-30 20:09:10 +00:00
|
|
|
(see
|
Make the resolver(3) and many associated interfaces much more reentrant.
The getaddrinfo(3), getipnodebyname(3) and resolver(3) can coincide now
with what should be totally reentrant, and h_errno values will now
be preserved correctly, but this does not affect interfaces such as
gethostbyname(3) which are still mostly non-reentrant.
In all of these relevant functions, the thread-safety has been pushed
down as far as it seems possible right now. This means that operations
that are selected via nsdispatch(3) (i.e. files, yp, dns) are protected
still under global locks that getaddrinfo(3) defines, but where possible
the locking is greatly reduced. The most noticeable improvement is
that multiple DNS lookups can now be run at the same time, and this
shows major improvement in performance of DNS-lookup threaded programs,
and solves the "Mozilla tab serialization" problem.
No single-threaded applications need to be recompiled. Multi-threaded
applications that reference "_res" to change resolver(3) options will
need to be recompiled, and ones which reference "h_errno" will also
if they desire the correct h_errno values. If the applications already
understood that _res and h_errno were not thread-safe and had their own
locking, they will see no performance improvement but will not
actually break in any way.
Please note that when NSS modules are used, or when nsdispatch(3)
defaults to adding any lookups of its own to the individual libc
_nsdispatch() calls, those MUST be reentrant as well.
2004-02-25 21:03:46 +00:00
|
|
|
.Xr gethostbyname 3 )
|
|
|
|
or
|
|
|
|
.Xr yp 8
|
|
|
|
breaks the thread-safety of both.
|
|
|
|
.Pp
|
2002-12-18 12:45:11 +00:00
|
|
|
The
|
2000-08-09 23:16:23 +00:00
|
|
|
.Fn getipnodebyname
|
|
|
|
and
|
|
|
|
.Fn getipnodebyaddr
|
2002-12-18 12:45:11 +00:00
|
|
|
functions
|
2000-08-09 23:16:23 +00:00
|
|
|
do not handle scoped IPv6 address properly.
|
|
|
|
If you use these functions,
|
|
|
|
your program will not be able to handle scoped IPv6 addresses.
|
|
|
|
For IPv6 address manipulation,
|
|
|
|
.Fn getaddrinfo 3
|
|
|
|
and
|
|
|
|
.Fn getnameinfo 3
|
|
|
|
are recommended.
|
|
|
|
.Pp
|
1999-12-28 02:37:14 +00:00
|
|
|
The text was shamelessly copied from RFC2553.
|