Commit Graph

423 Commits

Author SHA1 Message Date
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
Jacques Vidrine
46d9306383 = Implement name service switch modules (NSS modules). NSS modules
may be built into libc (`static NSS modules') or dynamically loaded
  via dlopen (`dynamic NSS modules').  Modules are loaded/initialized
  at configuration time (i.e.  when nsdispatch is called and nsswitch.conf
  is read or re-read).

= Make the nsdispatch(3) core thread-safe.

= New status code for nsdispatch(3) `NS_RETURN', currently used to
  signal ERANGE-type issues.

= syslog(3) problems, don't warn/err/abort.

= Try harder to avoid namespace pollution.

= Implement some shims to assist in porting NSS modules written for
  the GNU C Library nsswitch interface.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-17 14:14:22 +00:00
Peter Wemm
e3220e017a Remove NS and ISO stuff. 2003-03-05 19:16:41 +00:00
David E. O'Brien
c492fac741 Restore vendor ID. 2003-03-03 01:12:24 +00:00
Jacques Vidrine
2bbd7cf820 Eliminate 19 warnings in libc (at level WARNS=2) of the
`implicit declaration of function' variety.
2003-02-27 13:40:01 +00:00
Jacques Vidrine
6d7bd75a4e Whack 28 unused variables. 2003-02-18 13:39:52 +00:00
Jacques Vidrine
e0554a531f Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.

Reviewed by:	/sbin/md5
2003-02-16 17:29:11 +00:00
Philippe Charnier
d649825182 The .Fn function 2003-02-06 11:04:47 +00:00
Bill Fenner
a6497df52c Use in_addr_t for the right size of an IPv4 address, and copy into
an unaligned destination using bcopy instead of an assignment.

Submitted by:	Hartmut Brandt <brandt@fokus.gmd.de>
PR:		sparc64/46729
2003-01-05 14:05:24 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Jens Schweikhardt
57bd0fc6e8 english(4) police. 2002-12-27 12:15:40 +00:00
Ruslan Ermilov
2efeeba554 mdoc(7) police: "The .Fa argument.". 2002-12-19 09:40:28 +00:00
Ruslan Ermilov
5c564bae0a mdoc(7) police: Fixed abuses of the .Ar and .Em macros. 2002-12-18 13:33:04 +00:00