Commit Graph

635 Commits

Author SHA1 Message Date
Stefan Farfeleder
d8f77b4529 Include <sys/types.h> and <limits.h> ourselves, don't assume they are included
through <pthread.h>.

gen/sem.c:		Prerequisite for <_semaphore.h>
net/getprotoent.c:	USHRT_MAX
net/getservent.c:	USHRT_MAX
stdio/ungetwc.c:	MB_LEN_MAX
stdio/vfwscanf.c:	MB_LEN_MAX
2005-08-20 07:59:13 +00:00
Poul-Henning Kamp
3d86554c20 Respect the YES_HESIOD build variable. 2005-08-06 16:53:55 +00:00
Giorgos Keramidas
6fb9b618f5 Fix all the spelling mistakes I could find in the man pages for words
that have at least 3 characters.

MFC after:	1 week
Thanks to:	Music band ``Chingon''
		for keeping me company while searching for these.
2005-07-31 03:30:48 +00:00
Hajimu UMEMOTO
5495564735 don't accept invalid form of an address like 1:2:3:4:5:6:7::8.
PR:		bin/84106
Obtained from:	BIND9
MFC after:	2 days
2005-07-27 14:33:36 +00:00
Hajimu UMEMOTO
85a71a15c8 Remove padding for ABI compatibility of ai_addrlen member
from struct addrinfo.  This change break ABI compatibility
on 64 bit arch.
2005-07-22 18:21:28 +00:00
Hajimu UMEMOTO
d84e21303c refer RFC 3542 rather than RFC 2292bis.
Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Obtained from:	KAME
2005-07-19 18:13:58 +00:00
Hajimu UMEMOTO
d5cbe1abb0 fixed the validation code of routing header length in inet6_rth_getaddr().
reported by Delia Kecskemeti <delia.kecskemeti__at__windriver.com>

Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Obtained from:	KAME
2005-07-19 18:09:44 +00:00
Ruslan Ermilov
48856b0042 Markup fixes.
Approved by:	re
2005-06-16 19:01:07 +00:00
Ruslan Ermilov
f789cb8293 Assorted markup fixes.
Approved by:	re
2005-06-15 19:04:04 +00:00
Jacques Vidrine
a8e0b2e8ab Remove rexecd(8), a server that implements a particularly insecure
method of executing commands remotely.  There are no rexec clients in
the FreeBSD tree, and the client function rexec(3) is present only in
libcompat.  It has been documented as "obsolete" since 4.3BSD, and its
use has been discouraged in the man page for over 10 years.
2005-06-10 20:52:36 +00:00
Hajimu UMEMOTO
360a23ab31 reflect type change of n_net and getnetbyaddr(3). 2005-06-03 04:44:54 +00:00
Hajimu UMEMOTO
ad0fab44e2 - Remove padding for ABI compatibility of n_net member from struct
netent.
- Change 1st argument of getnetbyaddr() to an uint32_t on 64 bit
  arch as well to confirm to POSIX-2001.

These changes break ABI compatibility on 64 bit arch.
There is similar padding issue for ai_addrlen of struct addrinfo.
However, it is leaved as is for now.

Discussed on:	arch@, standards@ and current@
X-MFC after:	never
2005-06-03 03:32:06 +00:00
Hajimu UMEMOTO
d6fd3ed8ab reduce cast.
MFC after:	1 week
2005-05-27 20:44:57 +00:00
Hajimu UMEMOTO
036ae3dd79 - The ai_addrlen of a struct addrinfo used to be a size_t, per
RFC 2553.  In XNS5.2, and subsequently in POSIX-2001 and RFC
  3493, it was changed to a socklen_t.  And, the n_net of a
  struct netent used to be an unsigned long integer.  In XNS5,
  and subsequently in POSIX-2001, it was changed to an uint32_t.
  To accomodate for this while preserving ABI compatibility with
  the old interface, we need to prepend or append 32 bits of
  padding, depending on the (LP64) architecture's endianness.
- Correct 1st argument of getnetbyaddr() to uint32_t on 32
  bit arch.  Stay as is on 64 bit arch for ABI backward
  compatibility for now.

Reviewed by:	das, peter
MFC after:	2 weeks
2005-05-15 20:15:15 +00:00
George V. Neville-Neil
fd57e549e0 Submitted by: Jinmei Tatuya, Hajimu Umemoto
Reviewed by:	rwatson at freebsd dot org
Approved by:	rwatson at freebsd dot org
MFC after:	1 week

Fix the matchlen() function so that it handles the IPv4 (AF_INET)
case correctly.  Until now it has been treating IPv4 addresses
as if they were IPv6 which could lead to corruption errors.
2005-05-14 19:43:10 +00:00
Hajimu UMEMOTO
946e41f142 raise readability bit. 2005-05-13 17:56:53 +00:00
Hajimu UMEMOTO
f8997ca2f4 free ypbuf only when yp_match() succeed. 2005-05-13 17:30:03 +00:00
Hajimu UMEMOTO
4f10131848 NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.
2005-05-13 16:31:11 +00:00
Hajimu UMEMOTO
1ccfa322aa fix signed/unsigned comparison warnings.
Obtained from:	NetBSD
2005-05-03 16:13:31 +00:00
Hajimu UMEMOTO
943db5a2ab the 3rd argument of getsockname() should be socklen_t*.
Submitted by:	stefanf
2005-05-02 04:43:32 +00:00
Hajimu UMEMOTO
f468e837a1 oops, we don't need previous change. 2005-05-01 12:37:12 +00:00
Hajimu UMEMOTO
6bd1d1a192 make it compilable without YP definition. 2005-05-01 12:08:57 +00:00
Hajimu UMEMOTO
8592d23a9f don't see RES_USE_INET6 when called from getipnodeby*(). 2005-05-01 07:39:45 +00:00
Hajimu UMEMOTO
e84892eb74 oops, gethostbyaddr(3) must return h_addr as an IPv4-mapped
IPv6 address when RES_USE_INET6 was set, according to RFC 2133
section 6.2.
2005-04-30 20:07:01 +00:00
Hajimu UMEMOTO
6964622dd0 handling RES_USE_INET6 better. 2005-04-30 19:28:31 +00:00
Hajimu UMEMOTO
e4f846efec _ht_gethostbyaddr didn't handle RES_USE_INET6 correctly. 2005-04-30 18:46:27 +00:00
Hajimu UMEMOTO
e692b6186a _gethostbynisname() didn't support RES_USE_INET6. 2005-04-30 18:37:35 +00:00
Hajimu UMEMOTO
40ca152d15 _ht_gethostbyname didn't handle RES_USE_INET6 correctly. 2005-04-30 17:01:18 +00:00
Hajimu UMEMOTO
2c08ac2b38 - do validation check and IPv4-mapped IPv6 address handling before
any query.
- don't query against IPv6 link-local address.
- use IN6_IS_ADDR_V4{MAPPED,COMPAT} macros.
- use memcpy() instead of bcopy().

Inspired by:	NetBSD
2005-04-29 19:55:23 +00:00
Hajimu UMEMOTO
86726f325b NETDB_INTERNAL is not fit, here. return NO_RECOVERY for h_errno. 2005-04-29 17:36:54 +00:00
Hajimu UMEMOTO
49e0283df8 our get{addr,name}info() is considered thread-safe. 2005-04-29 14:37:51 +00:00
Hajimu UMEMOTO
0d389e7212 we cannot use inet_ntoa(3), here. so, use inet_ntop(3), instead. 2005-04-29 12:01:36 +00:00
Hajimu UMEMOTO
850bc9af6b sync _map_v4v6_host*() with bind9's. it treats align better bit.
Obtained from:	BIND9
2005-04-28 18:52:40 +00:00
Hajimu UMEMOTO
b8ab0f4506 we don't need mutex lock to call _gethostbynis*(), anymore. 2005-04-28 18:21:11 +00:00
Hajimu UMEMOTO
aa2f4ec72a make gethostby*() thread-safe. 2005-04-28 18:03:43 +00:00
Hajimu UMEMOTO
7b671d902b _gethostbynis{addr,name}() can handle an IPv6, now. 2005-04-28 17:44:44 +00:00
Hajimu UMEMOTO
a2a775011c make getnetby*() thread-safe. 2005-04-28 15:32:55 +00:00
Hajimu UMEMOTO
bcb131aa3c hide implementation specific internal functions from netdb.h.
it is needed to make get{host,net}by*() thread-safe.
2005-04-27 19:12:57 +00:00
Hajimu UMEMOTO
b190ee6140 our get{proto,serv}by*() use a thread-specific data space. 2005-04-26 18:04:09 +00:00
Hajimu UMEMOTO
72572cc6ea add IPv6 awareness for NIS query of gethostby*().
Inspired by:	NetBSD
2005-04-26 14:55:47 +00:00
Hajimu UMEMOTO
a72b0131c9 ensure parsing numeric address before any host query.
Inspired by:	NetBSD
2005-04-25 17:36:28 +00:00
Hajimu UMEMOTO
4801b1f131 remove unused variable. 2005-04-25 14:52:13 +00:00
Hajimu UMEMOTO
71d0cbb671 if last line didn't have trailing space, network address was also
treated as an alias.
2005-04-24 18:22:39 +00:00
Hajimu UMEMOTO
92b6f7be5a - add getproto{byname,bynumber,ent}_r for internal use within libc.
- make getproto{byname,bynumber,ent} thread-safe.
2005-04-19 14:41:13 +00:00
Hajimu UMEMOTO
d7d66e8c85 - nuke deprecated and unused getnodeby(3).
- remove unused variable.

Obtained from:	KAME
2005-04-19 12:28:17 +00:00
Hajimu UMEMOTO
a87b3988c9 rename the NIS related fields to have yp_ prefix.
Suggested by:	delphij
2005-04-18 18:34:58 +00:00
Xin LI
ffe49790ef Do not check whether a pointer is NULL, since free(3) already takes care of
this case.

Reviewed by:	ume
2005-04-18 03:45:23 +00:00
Xin LI
6d44c5c74b Fix build for !YP case.
BTW.  Shall we change these fields to have yp_ prefix?  That will make the
code easier to read.
2005-04-17 15:10:30 +00:00
Hajimu UMEMOTO
109e5709c0 libc-internal interfaces should have two underscores in front
of their names.

Pointed out by:	das
2005-04-17 14:42:52 +00:00
Xin LI
5c83bb4912 Wrong working directory, sorry. The previous patch was what I have
seen in NetBSD's tree, and this one is what I have submitted for review.

Pointy hat to:	me
2005-04-17 04:00:55 +00:00
Xin LI
f5d25e4900 Remove a check about whether sa->sa_len is equal to salen from
getnameinfo(3).  POSIX standard does not require a sa_len field
in sockaddr struct, hence such requirement will cause problem
for portability.

PR:		standards/80008
Requested by:	Xin Liu <lx@knight.6test.edu.cn>
Reviewed by:	freebsd-standards (das)
MFC After:	2 weeks
2005-04-17 03:56:07 +00:00
Hajimu UMEMOTO
62e8b17d72 Now, our getservbyname(3) is thread-safe. So, we don't need
to protect it with mutex lock.
2005-04-15 18:15:12 +00:00
Hajimu UMEMOTO
96f79dca76 - add getserv{byname,byport,ent}_r for internal use within libc.
- make getserv{byname,byport,ent} thread-safe.

Reviewed by:	gnn
2005-04-15 18:09:39 +00:00
Hajimu UMEMOTO
159d2a98c5 hostalias() is not thread-safe. So, introduce _res_hostalias()
and use it.

Obtained from:	BIND9
2005-04-15 14:42:29 +00:00
Hajimu UMEMOTO
f35528f852 remove needless res_init() call.
Inspired by:	NetBSD
2005-04-14 11:44:43 +00:00
Hajimu UMEMOTO
e8ffd81605 unbreak build without YP defined.
Submitted by:	Andrea Campi <andrea+freebsd_cvs_at_webcom.it>
2005-04-09 14:20:18 +00:00
Stefan Farfeleder
cf00abe993 Remove unused variables and assignments. 2005-04-08 21:24:23 +00:00
Hajimu UMEMOTO
2424b11851 - we are no longer shareing any resources to be locked between
getaddrinfo(3) and getipnodeby*(3).
- use definitions in reentrant.h.
- remove obsolete comment.
2005-04-06 15:36:34 +00:00
Hajimu UMEMOTO
148b7ece93 separate gai_strerror(3) from getaddrinfo.c.
Requested by:	phantom
2005-04-06 12:45:51 +00:00
Hajimu UMEMOTO
d7057edb15 make yp stuff re-entrant.
Obtained from:	NetBSD
2005-04-05 18:25:23 +00:00
Hajimu UMEMOTO
78ebcde839 add missing mutex unlock. 2005-04-05 17:13:28 +00:00
Hajimu UMEMOTO
9def31dcd7 make _files_getaddrinfo() re-entrant.
Obtained from:	NetBSD
2005-04-04 19:45:27 +00:00
Hajimu UMEMOTO
0fbf0979c8 nuke the logic for AF_UNSPEC and simplify. once, it was introduced
to improve getaddrinfo(3).  but, it is not needed for a long time
since getaddrinfo(3) became providing its own res_*N() functions.
2005-04-02 08:18:33 +00:00
Simon L. B. Nielsen
4bced63f6d Add byteorder(9) to SEE ALSO.
MFC after:	3 days
2005-03-20 17:27:57 +00:00
Stefan Farfeleder
10248e3a93 - Use socklen_t.
- No need for two instances of 'num'.
2005-02-14 17:51:45 +00:00
Stefan Farfeleder
78e3eed071 Fix most cases where the address of an int is passed to a function expecting a
socklen_t * argument.
2005-02-14 17:42:58 +00:00
Alexey Zelkin
ed61386604 . Convert return type of gai_strerror() to 'const char *' as POSIX requires.
. Convert ai_errlist[] to simple 'char *' array, and appropriately
  optimize gai_strerror()
2005-02-14 11:33:12 +00:00
Alexey Zelkin
03c51c7e90 EAI_ADDRFAMILY and EAI_NODATA are obsoleted, and not definined anymore,
so do not export these definitions via manual page
2005-02-14 11:24:58 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
6b806d21d1 Fixed the misplaced $FreeBSD$. 2005-02-09 18:07:17 +00:00
Hajimu UMEMOTO
8743b270c9 use strdup().
Obtained from:	KAME
MFC after:	1 week
2005-01-28 19:35:42 +00:00
Hajimu UMEMOTO
a2a24ec881 make _getipnodebyname_multi() static. 2005-01-27 15:01:05 +00:00
Hajimu UMEMOTO
c224435ed9 implement AI_NUMERICSERV (as defined in RFC3493).
Obtained from:	KAME
MFC after:	1 week
2005-01-27 14:45:11 +00:00
Hajimu UMEMOTO
8755b918a1 fill ai_canonname field for numeric hostname, by the given hostname.
follow new recommendation in RFC3493.

Obtained from:	KAME
MFC after:	1 week
2005-01-27 14:41:56 +00:00
Hajimu UMEMOTO
d0d6a2c7cc query A RR before AAAA RR.
MFC after:	1 week
2005-01-27 08:03:46 +00:00
Ruslan Ermilov
f000229472 Markup and grammar fixes. 2005-01-24 18:14:18 +00:00
George V. Neville-Neil
f579625397 Update man pages to be in line with guidelines for IPv6 in FreeBSD.
FreeBSD currently implements the most up to date IPv6 APIs for
option and route header parsing.   This checkin marks the older APIs
as deprecated and points the reader to the newer pages.

Reviewed by: Jun-ichiro Itojun
Approved by: rwatson (mentor)
2005-01-24 11:23:14 +00:00
George V. Neville-Neil
b986ced475 Fix a dangling MKLINK from my last commit.
Approved by:	rwatson (mentor)
2005-01-24 01:40:16 +00:00
George V. Neville-Neil
6617cf5778 Submitted by: George V. Neville-Neil (gnn at freebsd dot org)
Reviewed by: Kame Project (including Itojun-san, Jinmei-san and Suzuki-san)
Approved by: Robert Watson (robert at freebsd dot org)
Obtained from:	Kame Project and OpenBSD

Replace manual pages that may have violated the IETF's Copyright.

All come from the Kame tree.

Several were from OpenBSD except for ip6.4, and the inet6* pages which were
rewritten by me.

All of the text is new and drawn from reading the code and
documentation.
2005-01-23 16:02:48 +00:00
George V. Neville-Neil
b8a3e40819 Submitted by: George V. Neville-Neil (gnn at freebsd dot org)
Approved by: Robert Watson (robert at freebsd dot org)

Remove files in preparation for replacement with totally new versions
of the manual pages.

Update the Makefile to handle the new file to be added.
2005-01-23 15:41:10 +00:00
Ruslan Ermilov
24a0682c64 Sort sections. 2005-01-20 09:17:07 +00:00
Ruslan Ermilov
6a5796e734 Eliminate macro calls inside literal displays. 2005-01-15 12:28:01 +00:00
Ruslan Ermilov
2d82ac3110 Scheduled mdoc(7) sweep. 2005-01-11 20:50:51 +00:00
Maxim Sobolev
7b6cc40479 Don't ignore the last line of config file (/etc/hosts, /etc/services, etc)
which doesn't end in \n, since it may be very confusing. Also this should
increase consistency, since most other config files work just fine regardless
of the presence of traling \n in the last line.

MFC After:	2 weeks
2005-01-03 11:07:45 +00:00
Tom Rhodes
8f79184fe2 Various markup and spelling fixes.
PR:		75574
Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp> (original version)
2004-12-29 02:18:24 +00:00
Bjoern A. Zeeb
6c58990d47 Add knob NO_NIS (fka NO_YP_LIBC) and make world compileable when set.
If turned on  no NIS support and related programs will be built.

Lost parts rediscovered by:	Danny Braniss <danny at cs.huji.ac.il>
PR:		bin/68303
No objections:	des, gshapiro, nectar
Reviewed by:	ru
Approved by:	rwatson (mentor)
MFC after:	2 weeks
2004-11-13 20:40:32 +00:00
Maxim Konovalov
e2494b93fc o Backout rev. 1.16, see 1.3 commit log for more info.
Requested by:	bde

o Remove unneeded sys/types.h and netinet/in.h from the synopsis and
the example.
o We do have struct in_addr in arpa/inet.h, so no need for netinet/in.h.
o Mention where AF_* constants defined are.

Educated by:	bde
2004-10-09 17:13:58 +00:00
Maxim Konovalov
796a03f172 Reflect the fact addr2ascii(3) and ascii2addr(3) need sys/socket.h
for AF_* constants.

Submitted by:	Matthew George
MFC after:	2 weeks
2004-09-29 17:54:30 +00:00
Yaroslav Tykhiy
23b5c802b8 Use the recently introduced RES_DFLRETRY parameter instead of a well-hidden
constant for the default number of retries.
2004-09-09 17:42:18 +00:00
Peter Pentchev
16d9177176 Bump the document date, since the content changed today.
Discussed with:	ru
2004-08-06 15:29:54 +00:00
Peter Pentchev
808712c91c Cross-reference getnameinfo(3), getaddrinfo(3), getipnodebyname(3) and
getipnodebyaddr(3).

PR:		54229
Submitted by:	Samuel Tardieu <sam@inf.enst.fr>
MFC after:	2 weeks
2004-08-06 12:02:07 +00:00
Hajimu UMEMOTO
0def575fd7 now e.f.f.3.ip6.arpa is delegated, we no longer need to query ip6.int
Obtained from:	KAME
2004-07-21 17:26:40 +00:00
Ruslan Ermilov
5792ef0983 Markup nits. 2004-07-07 20:15:31 +00:00
Ruslan Ermilov
1af1ea79a8 Markup fixes. 2004-07-05 07:21:55 +00:00
Ruslan Ermilov
30950a21e1 Eliminate double whitespace. 2004-07-03 22:30:10 +00:00
Ruslan Ermilov
1a0a934547 Mechanically kill hard sentence breaks. 2004-07-02 23:52:20 +00:00
Ruslan Ermilov
33992dc0ed Markup, grammar, and spelling fixes. 2004-06-30 20:09:10 +00:00
Mike Pritchard
6b4a832600 Spelling fixes. 2004-06-21 20:10:35 +00:00
Hajimu UMEMOTO
a214cd1abd Rename variable name from name' to hostname'.
This is a corresponding change to bin/67994.  I'll soon commit
bin/67994 into 4-STABLE.  Actually, 5-CURRENT's getaddrinfo()
doesn't have the problem mentiond in bin/67994.  However, it is
good to be in sync variable name with 4-STABLE and KAME.

PR:		bin/67994
Submitted by:	JINMEI Tatuya <jinmei@ocean.jinmei.org>
2004-06-16 16:41:23 +00:00
Bruce M Simpson
445d6be61e Date bump.
Requested by:	krion
2004-06-14 14:24:18 +00:00
Bruce M Simpson
3c6ba09bdf Document some return values.
PR:		bin/22198
Submitted by:	Nick Johnson (with cleanups)
2004-06-14 14:18:41 +00:00
Hajimu UMEMOTO
146cd1bc0a use source address as a hint to determine destination address
by getipnodebyname().
2004-06-02 06:49:36 +00:00
Brooks Davis
cf7549084d Add Aerospace Corporation copyrights to EUI64 support files.
Suggested by:	marcel, imp
2004-06-01 19:30:13 +00:00
Hajimu UMEMOTO
251b48a1bb Treat IPv4 private address as global scope rather than site scope.
Though it breaks RFC 3484, without this change, dest addr selection
doesn't work well under NAT environment.
2004-05-31 21:09:14 +00:00
Hajimu UMEMOTO
4d489f472b use source address as a hint to determine destination address.
Obtained from:	KAME
2004-05-31 19:27:54 +00:00
Brooks Davis
7387768ef4 Add support for an /etc/eui64 file modeled on /etc/ethers. The API is
modeled on ethers(3) except that all functions are thread-safe.

Reviewed by:	simokawa
2004-05-26 22:58:06 +00:00
Ruslan Ermilov
2d695ed31d Unbreak world. 2004-04-21 09:50:52 +00:00
Nate Lawson
1cc11684ac MFdragonfly: resolver fix for timeouts on unqualified hostnames
res_search only incremented got_servfail for h_errno == TRY_AGAIN *AND*
  hp->rcode == SERVFAIL.  However, there are cases such as timeouts where
  rcode is not always set to SERVFAIL.  This leads to inconsistent nameserver
  operation during multi-domain and truncated dot searches, especially during
  booting when portions of the network are being brought up simultanious with
  dns lookups.

  This patch attempts to correct the problem by unconditionally terminating
  the search if TRY_AGAIN is returned (after res_query has gone through all
  retries and name servers) instead of trying other domain elements in the
  domain seach path.

  This patch should fix reported problems (which I can reproduce) with some
  NFS mounts failing during boot.  This occured because mount_nfs thought the
  host name lookup returned a definitive failure using a non-dotted host name
  when, in fact, it timed out on the first part (host.search.domain.name) and
  got a definitive host-not-found response on the second part (host.).

  Generally speaking, search path name server timeouts can exceed 60 seconds
  per element and most machines which consistently timeout on earlier portions
  of a search path are effectively non-operational due to the imposed delays.
  It is more important for DNS lookups to return the proper error code then
  to be able to recover a valid lookup in later portions of the search path
  in these situations.

Obtained from:	DragonFly
MFC after:	3 weeks
2004-04-21 00:56:38 +00:00
Pierre Beyssac
54846c9ff0 Add a missing "*errp = h_errno" forgotten in rev 1.36. 2004-04-06 09:31:22 +00:00
Pierre Beyssac
e651d83aa3 Fix _dns_ghbyname() to return NS_TRYAGAIN instead of NS_NOTFOUND
on temporary nameserver failure. This is necessary to get
getipnodebyname(3) to correctly return h_errno=TRY_AGAIN instead
of HOST_NOT_FOUND.

Reviewed by:	green, thomas
MFC after:	1 week
2004-04-05 20:18:48 +00:00
Jacques Vidrine
8074e24dce The previous commit changed the behavior of nsdispatch() in the
case where an /etc/nsswitch.conf file was present, but could not
be opened (e.g. due to permissions).  Previously, the open failure
condition was suppressed, and the built-in defaults were used.  In
revision 1.11, however, propagated the open failure causing all
nsdispatch() invocations to return NS_UNAVAIL, and thus many APIs
including getpwnam and gethostbyname unconditionally failed.

This commit restores the previous behavior.

Pointy hat:	nectar  (+1 for obstinance; ache had to use clue bat)
Reported by:	ache
2004-04-01 19:12:45 +00:00
Jacques Vidrine
a03fd3b656 When a dynamic NSS module is built and linked against a thread
library, it may pull in that thread library at run time.  If the
process started out single-threaded, this could cause attempts to
release locks that do not exist.  Guard against this possibility by
checking __isthreaded before invoking thread primitives.

A similar problem remains if the process is linked against one thread
library, but the NSS module is linked against another.  This can only
be avoided by careful design of the NSS module.

Submitted by:	Sean McNeil <sean@mcneil.com> (mostly; bugs are mine)
2004-03-30 15:56:15 +00:00
Dag-Erling Smørgrav
5b3ce02186 Don't try to pass off a struct sockaddr as a struct sockaddr_in when it
may in fact very well be a struct sockaddr_in6.  Just use plain struct
sockaddr.

This brings us yet another step closer to a clean -O2 build.
2004-03-15 17:08:28 +00:00
Dag-Erling Smørgrav
4705e3da6a Make this compile with -O2. A proper fix would use a struct to represent
vectors, instead of requiring the caller to keep track of element size
and count and pass them in by reference.
2004-03-15 08:14:35 +00:00
Dag-Erling Smørgrav
2fb05f85d5 Whitespace nits. 2004-03-15 08:03:10 +00:00
Mark Murray
16fc3635f7 Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64
2004-03-05 08:10:19 +00:00
Brian Feldman
33dee81933 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
Hajimu UMEMOTO
b8b31f33b1 add destination address selection support for getipnodebyname(3).
though getipnodebyname(3) is obsoleted api, some major applications
such as Mozilla are still using it.  so, it will help ipv4 users.
2004-02-20 17:59:33 +00:00
Colin Percival
3c754d8be1 style cleanup: Remove duplicate $FreeBSD$ tags.
These files had tags at the start of the file
(incorrect, removed), and after the copyright
notices (correct).

Approved by:	rwatson (mentor)
2004-02-10 20:40:17 +00:00
Ruslan Ermilov
50a51e39a9 Unbreak world. 2004-02-07 11:13:47 +00:00
Diomidis Spinellis
a54c3906ad getnetbyname fixes:
Do not choke on malformed network addresses.
Return n_name in static space, not on the function's stack.

MFC after: 1 week
2004-02-07 07:30:02 +00:00
Jacques Vidrine
c849849d06 It was reported that when using nss_ldap, getgrent(3) would behave
incorrectly when encountering `large' groups (many members and/or many
long member names).  The reporter tracked this down to the glibc NSS
module compatibility code (nss_compat.c): it would prematurely record
that a NSS module was finished iterating through its database in some
cases.

Two aspects are corrected:

1. nss_compat.c recorded that a NSS module was finished iterating
   whenever the module reported something other than SUCCESS.  The
   correct logic is to continue iteration when the module reports
   either SUCCESS or RETURN.  The __nss_compat_getgrent_r and
   __nss_compat_getpwent_r routines are updated to reflect this.

2. An internal helper macro __nss_compat_result is used to map glibc
   NSS status codes to BSD NSS status codes (e.g. NSS_STATUS_SUCCESS ->
   NS_SUCCESS).  It provided the obvious mapping.

   When a NSS routine is called with a too-small buffer, the
   convention in the BSD NSS code is to report RETURN.  (This is used
   to implement reentrant APIs such as getpwnam_r(3).)  However, the
   convention in glibc for this case is to set errno = ERANGE and
   overload TRYAGAIN.  __nss_compat_result is updated to handle this
   case.

PR:		bin/60287
Reported by:	Lachlan O'Dea <odela01@ca.com>
2004-01-09 13:43:49 +00:00
Jacques Vidrine
e602b918db Work around a `warning: zero-length printf format string'. 2004-01-06 18:45:13 +00:00
Murray Stokely
a298e0ba03 Add support for timeout: and attempts: resolver options.
Submitted by:	Paul Vixie <paul@vix.com> / ISC
MFC After:	1 week
2003-12-07 12:32:24 +00:00
Bruce M Simpson
2554d76f85 Add the userland part of the NET_RT_IFMALIST sysctl MIB. A new function,
getifmaddrs(), is added to retrieve current multicast group memberships.

Reviewed by:	harti
2003-11-14 18:53:22 +00:00
Hajimu UMEMOTO
2daa2369f0 u_int8_t cannot carry a number greater than 255.
Reported by:	nectar
2003-11-14 18:07:50 +00:00
Hajimu UMEMOTO
4c6867a867 add destination address selection described in RFC3484.
in KAME implementation, even when no policy is installed
into kernel, getaddrinfo(3) sorts addresses.  Since it
causes POLA violation, I modified to don't sort addresses
when no policy is installed into kernel,

Obtained from:	KAME
2003-10-30 17:36:53 +00:00
Hajimu UMEMOTO
8827557e37 according to RFC3542 10.5, the 5th argment of inet6_opt_next()
is not size_t but socklen_t.

Reported by:	tinderbox
2003-10-25 06:51:23 +00:00
Hajimu UMEMOTO
bf838688af oops, revert previous change to getaddrinfo.c. This is not related
to RFC3493.  The previous change was related to RFC3484 (Default
Address Selection for IPv6), and it will come later.
2003-10-24 18:43:24 +00:00
Hajimu UMEMOTO
f95d46333d Switch Advanced Sockets API for IPv6 from RFC2292 to RFC3542
(aka RFC2292bis).  Though I believe this commit doesn't break
backward compatibility againt existing binaries, it breaks
backward compatibility of API.
Now, the applications which use Advanced Sockets API such as
telnet, ping6, mld6query and traceroute6 use RFC3542 API.

Obtained from:	KAME
2003-10-24 18:26:30 +00:00
Hajimu UMEMOTO
688a5c3ea3 reorder functions to be in sync with KAME. 2003-10-23 14:32:03 +00:00
Hajimu UMEMOTO
37b3e94167 EAI_ADDRFAMILY and EAI_NODATA was deprecated in RFC3493
(aka RFC2553bis).  Now, getaddrinfo(3) returns EAI_NONAME
instead of EAI_NODATA.  Our getaddrinfo(3) nor getnameinfo(3)
didn't use EAI_ADDRFAMILY.

Obtained from:	KAME
2003-10-23 13:55:36 +00:00
Hajimu UMEMOTO
3b1a779723 oops, gai_strerror must return default value when error code
isn't found in ai_errlist.
2003-10-22 16:53:21 +00:00
Hajimu UMEMOTO
b29ec00b70 make ai_errlist struct. this is preparation for RFC3493
(EAI_NODATA is depricated).

Obtained from:	KAME
2003-10-22 15:41:38 +00:00
Hajimu UMEMOTO
d24cb2490d stop use of NI_WITHSCOPEID. it was deprecated.
Obtained from:	KAME
2003-10-21 20:11:47 +00:00
Bill Fenner
2b9de089a7 From OpenBSD:
always widen the imputed netmask if it is narrower than the specified octets.
fixes a strange behaviour where inet_net_pton would always return 4 (bits)
for multicast addresses no matter how many octets were specified.

negotiated with Paul Vixie, original author of this function.

PR:		standards/53151
Submitted by:	Max Laier <max@love2party.net>
Optained from:	OpenBSD
2003-09-15 23:38:06 +00:00
Hajimu UMEMOTO
5c4c2dbb56 Our getaddrinfo() and getnameinfo() are thread-safe but
some limitation.

Reported by:	Marc G. Fournier <scrappy@hub.org>
2003-09-15 04:52:15 +00:00
Ruslan Ermilov
743d5d518c mdoc(7): Properly mark C headers. 2003-09-10 19:24:35 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Maxime Henrion
434252892a An u_int8_t can never be bigger than 255, so remove a useless check.
Spotted by:	GCC
2003-07-25 12:23:25 +00:00
Kris Kennaway
97cbd1c728 Remove bogus non-reentrant "temporary" implementation of gethostbyaddr_r()
that has been here for 6 years and 9 months.

Reviewed by:	deischen
MFC After:	1 week
2003-06-19 07:57:11 +00:00
Philippe Charnier
fe71ab1cf4 .Xr -> .Lb for librairy. There is no manual page corresponding to .Xr. 2003-06-08 10:07:14 +00:00
Ruslan Ermilov
3a5146d9e2 Assorted mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-22 13:02:28 +00:00
Ruslan Ermilov
aba60fa66b Fixed troff(1) and mdoc(7) warnings.
Approved by:	re (blanket)
2003-05-18 21:05:22 +00:00
Daniel Eischen
e8baaa7062 Replace use of a spinlock with a mutex. 2003-05-04 22:36:46 +00:00
Jacques Vidrine
d05090827f Back out the `hiding' of strlcpy and strlcat. Several people
vocally objected to this safety belt.
2003-05-01 19:03:14 +00:00
Jacques Vidrine
5723e501ab `Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
technique) so that we don't wind up calling into an application's
version if the application defines them.

Inspired by:	qpopper's interfering and buggy version of strlcpy
2003-04-29 21:13:50 +00:00
Jacques Vidrine
43f9b2521d Don't complain about missing NSS methods when built statically. It is
annoying and not very useful.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-24 19:57:31 +00:00
Jacques Vidrine
c5774e2d30 Catch up with nsdispatch.c: nsdispatch(3) is now `hidden' by
namespace.h.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-24 18:05:48 +00:00
Jacques Vidrine
20e0e084e7 Catch up with nsdispatch.c: nsdispatch(3) is now `hidden' by
namespace.h.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-24 17:41:20 +00:00