Commit Graph

829 Commits

Author SHA1 Message Date
Giorgos Keramidas
ef824a431f mdoc fix: remove extraneous empty line.
MFC after:	3 days
2007-10-30 15:31:41 +00:00
Tom McLaughlin
908556717f - Correctly define CACHED_SOCKET_PATH as /var/run/nscd after cached to
nscd renaming.

Approved by:	mux
2007-10-17 23:20:49 +00:00
Christian Brueffer
44d9c28191 Assorted spelling, punctuation and mdoc fixes.
Approved by:	re (blanket)
2007-09-25 16:48:08 +00:00
Gabor Kovesdan
694b0a6ba4 - Fix description to say "receive" instead of "send"
PR:		docs/115466
Submitted by:	Bruce Cran <bruce@cran.org.uk>
Approved by:	re (bmah)
2007-09-20 10:49:10 +00:00
JINMEI Tatuya
e47c82ed72 ensure the head entry of addrinfo chain has non-NULL ai_canonname to be
compliant with RFC3493.

PR: standards/114910
Approved by:   ume (mentor)
Approved by:   re
MFC after:     1 week
2007-09-05 18:08:14 +00:00
Michael Bushkov
3e83e4a3f2 - Getipnodebyname() and getipnodebyaddr() reimplemented through
gethostbyname() and gethostbyaddr() accordingly

Approved by:	re (kensmith), brooks (mentor)
2007-07-31 16:09:41 +00:00
Randall Stewart
1b649582bb - take out a needless panic under invariants for sctp_output.c
- Fix addrs's error checking of sctp_sendx(3) when addrcnt is less than
   SCTP_SMALL_IOVEC_SIZE
 - re-add back inpcb_bind local address check bypass capability
 - Fix it so sctp_opt_info is independant of assoc_id postion.
 - Fix cookie life set to use MSEC_TO_TICKS() macro.
 - asconf changes
   o More comment changes/clarifications related to the old local address
    "not" list which is now an explicit restricted list.

   o Rename some functions for clarity:
     - sctp_add/del_local_addr_assoc to xxx_local_addr_restricted()
     - asconf related iterator functions to sctp_asconf_iterator_xxx()

   o Fix bug when the same address is deleted and added (and removed from
     the asconf queue) where the ifa is "freed" twice refcount wise,
     possibly freeing it completely.

   o Fix bug in output where the first ASCONF would not go out after the
     last address is changed (e.g. only goes out when retransmitted).

   o Fix bug where multiple ASCONFs can be bundled in the same packet with
     the and with the same serial numbers.

   o Fix asconf stcb iterator to not send ASCONF until after all work
     queue entries have been processed.

   o Change behavior so that when the last address is deleted (auto asconf
     on a bound all endpoint) no action is taken until an address is
     added; at that time, an ASCONF add+delete is sent (if the assoc
     is still up).

   o Fix local address counting so that address scoping is taken into
     account.

   o #ifdef SCTP_TIMER_BASED_ASCONF the old timer triggered sending
     of ASCONF (after an RTO).  The default now is to send
     ASCONF immediately (except for the case of changing/deleting the
     last usable address).
Approved by:	re(ken smith)@freebsd.org
2007-07-24 20:06:02 +00:00
Randall Stewart
b54d3a6c48 - Modular congestion control, with RFC2581 being the default.
- CMT_PF states added (w/sysctl to turn the PF version on)
- sctp_input.c had a missing incr of cookie case when the
  auth was bad. This meant a free was called without an
  increment to refcnt, added increment like rest of code.
- There was a case, unlikely, when the scope of the destination
  changed (this is a TSNH case). In that case, it would not free
  the alloc'ed asoc (in sctp_input.c).
- When listed addresses found a colliding cookie/Init, then
  the collided upon tcb was not unlocked in sctp_pcb.c
- Add error checking on arguments of sctp_sendx(3) to prevent it from
  referencing a NULL pointer.
- Fix an error return of sctp_sendx(3), it was returing
  ENOMEM not -1.
- Get assoc id was changed to use the sanctified socket api
  method for getting a assoc id (PEER_ADDR_INFO instead of
  PEER_ADDR_PARAMS).
- Fix it so a peeled off socket will get a proper error return
  if it trys to send to a different address then it is connected to.
- Fix so that select_a_stream can avoid an endless loop that
  could hang a caller.
- time_entered (state set time) was not being set in all cases
  to the time we went established.
Approved by:	re(ken smith)
2007-07-14 09:36:28 +00:00
Peter Wemm
f275d39c8f Fix missing prototype warnings. (Compile errors with -Werror on)
When using namespace.h/un-namespace.h, you use _ versions of syscalls.
Change getsockopt() to _getsockopt() and same for setsockopt().

Approved by:  re
2007-07-04 00:55:50 +00:00
Randall Stewart
602afc03e4 - Removes some incorrect error returns (errno was being overriden in
one of the functions)
- Fixes the error return of sctp_get_opt, it was returning the errno not
 -1.
Approved by:	re@freebsd.org (Robert Watson)
Obtained from:	Weongyo Jeong (weongyo.jeong@gmail.com)
2007-07-02 10:52:34 +00:00
Matt Jacob
f1d305391f Add missing semi-colon.
Approved by:	re (not really, but it's better to have things compile than not for right now. Sorry)
2007-06-26 02:07:47 +00:00
Randall Stewart
25d63f19e6 - Fix wrong error return (the errno was being returned and not placed
in errno) - Found by Weongyo Jeong
- Remove two extra un-needed memset() after calloc()'s - Found by
  Weongyo Jeong
- Tightened up parameter requirement checking on input to
  bindx/connectx per socket api spec.
Approved by:	re@freebsd.org(Ken Smith)
2007-06-25 18:58:27 +00:00
Randall Stewart
a593094ea0 - Fix incorrect error return on sctp_getaddrlen
- Fix a memory leak when a non v4/v6 address was passed in.
- Take out strange line that copy's back to the src array
  incorrectly (corrupting the input array).

Approved by:	re(bmah@freebsd.org)
Obtained from:	Weongyo Jeong(weongyo.jeong@gmail.com)
2007-06-22 13:59:54 +00:00
Christian Brueffer
c89181915c Clean up after previous commit: new sentence -> new line, no empty lines,
.Fa macro usage.

Approved by:	re (blanket)
2007-06-19 16:29:46 +00:00
Randall Stewart
7e94ae79f3 - Fix the signature of sctp_connectx to match the function and adds some
text about the last argument.
Approved by:	re (bmah@freebsd.org)
2007-06-19 16:18:43 +00:00
Christian Brueffer
16c90ceeb3 Major cleanup: mdoc macros, style, typos etc. 2007-06-18 10:20:32 +00:00
Xin LI
0bb263df82 Require users to provide a length information for inet_ntoa_r,
this is common on other platforms.

Reported by:	pointyhat via kris
2007-06-14 07:13:28 +00:00
Andrey A. Chernov
418130b101 Fix yet another (make install) stopper with wrong sourcefilter.3 links 2007-06-12 22:32:52 +00:00
Bruce M Simpson
9153727f2f Fix typo in filename from mismerged earlier rev of this file. 2007-06-12 21:05:31 +00:00
Bruce M Simpson
a85a378773 Fix a typo which crept in from an earlier version of this file. 2007-06-12 19:08:38 +00:00
Bruce M Simpson
35c261275e Add missing userland support files from previous commit for the new
multicast source filter API functions.
2007-06-12 18:03:37 +00:00
Bruce M Simpson
71498f308b Import rewrite of IPv4 socket multicast layer to support source-specific
and protocol-independent host mode multicast. The code is written to
accomodate IPv6, IGMPv3 and MLDv2 with only a little additional work.

This change only pertains to FreeBSD's use as a multicast end-station and
does not concern multicast routing; for an IGMPv3/MLDv2 router
implementation, consider the XORP project.

The work is based on Wilbert de Graaf's IGMPv3 code drop for FreeBSD 4.6,
which is available at: http://www.kloosterhof.com/wilbert/igmpv3.html

Summary
 * IPv4 multicast socket processing is now moved out of ip_output.c
   into a new module, in_mcast.c.
 * The in_mcast.c module implements the IPv4 legacy any-source API in
   terms of the protocol-independent source-specific API.
 * Source filters are lazy allocated as the common case does not use them.
   They are part of per inpcb state and are covered by the inpcb lock.
 * struct ip_mreqn is now supported to allow applications to specify
   multicast joins by interface index in the legacy IPv4 any-source API.
 * In UDP, an incoming multicast datagram only requires that the source
   port matches the 4-tuple if the socket was already bound by source port.
   An unbound socket SHOULD be able to receive multicasts sent from an
   ephemeral source port.
 * The UDP socket multicast filter mode defaults to exclusive, that is,
   sources present in the per-socket list will be blocked from delivery.
 * The RFC 3678 userland functions have been added to libc: setsourcefilter,
   getsourcefilter, setipv4sourcefilter, getipv4sourcefilter.
 * Definitions for IGMPv3 are merged but not yet used.
 * struct sockaddr_storage is now referenced from <netinet/in.h>. It
   is therefore defined there if not already declared in the same way
   as for the C99 types.
 * The RFC 1724 hack (specify 0.0.0.0/8 addresses to IP_MULTICAST_IF
   which are then interpreted as interface indexes) is now deprecated.
 * A patch for the Rhyolite.com routed in the FreeBSD base system
   is available in the -net archives. This only affects individuals
   running RIPv1 or RIPv2 via point-to-point and/or unnumbered interfaces.
 * Make IPv6 detach path similar to IPv4's in code flow; functionally same.
 * Bump __FreeBSD_version to 700048; see UPDATING.

This work was financially supported by another FreeBSD committer.

Obtained from:  p4://bms_netdev
Submitted by:   Wilbert de Graaf (original work)
Reviewed by:    rwatson (locking), silence from fenner,
		net@ (but with encouragement)
2007-06-12 16:24:56 +00:00
Randall Stewart
2c356be294 - Validate incoming addresses and sizes for connectx and bindx.
- For non-sys call version pass the msg_flags.
2007-06-11 21:05:29 +00:00
Xin LI
0c927cdd8e Add inet_ntoa_r, a reentrant version of inet_ntoa. This is
available on a lot of platforms, as well as libkern for years.

Submitted by:	"MQ"
2007-06-11 07:21:21 +00:00
Remko Lodder
eb1db428b7 Document getaddrinfo(3)'s AI_ADDRCONFIG
PR:		docs/78357
Submitted by:	Matthias Andree <matthias dot andree at gmx dot de>
Patch by:	asmodai
MFC after:	1 week
2007-06-06 19:24:02 +00:00
Daniel Eischen
2665faf497 Some libc symbol map cleanups.
net: endhostdnsent is named _endhostdnsent and is
  private to netdb family of functions.

  posix1e: acl_size.c has been never compiled in,
  so there's no "acl_size".

  rpc: "getnetid" is a static function.

  stdtime: "gtime" is #ifdef'ed out in the source.

  some symbols are specific only to some architectures,
  e.g., ___tls_get_addr is only defined on i386.

  __htonl, __htons, __ntohl and __ntohs are no longer
  functions, they are now (internal) defines in
  <machine/endian.h>.

Submitted by:	ru
2007-05-31 13:01:34 +00:00
Robert Watson
7a2f86ce08 Precede symbol names consistently with tabs rather than spaces. 2007-05-28 11:33:44 +00:00
Ruslan Ermilov
7172f8c4db Also fix the misspelling of hes_resolve().
Submitted by:	Danny Braniss
2007-05-25 09:58:25 +00:00
Ruslan Ermilov
6f9900d9f6 hesiod_resolv -> hesiod_resolve
Submitted by:	Danny Braniss
2007-05-24 13:50:06 +00:00
Jonathan Chen
bb5bff06a7 Move nss_compat symbols from r1.11 to private section of symbol map.
Suggested by: deischen
2007-05-18 15:41:54 +00:00
Jonathan Chen
6a536ad948 __nss_compat_* from net/nss_compat.c are needed by ports/net/nss_ldap, so export them. 2007-05-18 05:45:28 +00:00
Jonathan Chen
7a800a56f7 fix memory leak from reading nsswitch.conf
MFC after:	1 week
2007-05-17 03:33:23 +00:00
Randall Stewart
002b1f0bba -Fix so getoptinfo() is in conformance with socket api (it
can be used on any read socketopt).
-Clean up of sendmsg call and make it conformant when no syscall
 is available.
2007-05-16 20:23:39 +00:00
Randall Stewart
ad9f3b406a Resolves symbols map so sctp_xxx() functions are included.
PR:		112704
Submitted by:	kou@cozmixng.org
2007-05-16 20:20:54 +00:00
Robert Watson
caa399aa66 Add ether_aton_r and ether_ntoa_r to public symbol map for libc.
Pointed out by:	deischen
2007-05-13 15:01:25 +00:00
Robert Watson
62ad77f006 Add and document ether_ntoa_r() and ether_aton_r() functions, which accept
passed storage buffers rather than using static storage.  Reimplement
ether_ntoa() and ether_aton() in terms of these functions.  These variants
are thread-safe.
2007-05-13 13:57:45 +00:00
Robert Watson
b06619453f Move to more conformant style(9) before making functional changes. 2007-05-13 12:04:06 +00:00
Daniel Eischen
5f864214bb Use C comments since we now preprocess these files with CPP. 2007-04-29 14:05:22 +00:00
Mike Makonnen
18a6073100 Make inet6_rth_* family of functions more compliant with RFC3542:
1. CMSG_NXTHDR(mhdr, cmsg) is supposed to dereference cmsg and return
   the next header in the chain. If cmsg is NULL it should return
   the first header, behaving essentially like CMSG_FIRSTHDR().
2. inet6_rth_(space|init|add) should do basic checking on their input
   to verify that the number of headers (segments) is
   between 0 and 127 inclusive.

MFC-After: 1 month
2007-04-19 15:48:16 +00:00
Max Laier
02023242ea Let people in on the magic of INET[6]_ADDRSTRLEN which comes quite handy in
combination with inet_ntop().

Reviewed by:	trhodes "works for me"
2007-03-21 05:46:18 +00:00
Randall Stewart
42551e993f - Sysctl's move to seperate file
- moved away from ifn/ifa access to sctp_ifa/sctp_ifn
  built and managed by the add-ip code.
- cleaned up add-ip code to use the iterator
- made iterator be a thread, which enables auto-asconf now.
- rewrote and cleaned up source address selection (also
  made it use new structures).
- Fixed a couple of memory leaks.
- DACK now settable as to how many packets to delay as
  well as time.
- connectx() to latest socket API, new associd arg.
- Fixed issue with revoking and loosing potential to
  send when we inflate the flight size. We now inflate
  the cwnd too and deflate it later when the revoked
  chunk is sent or acked.
- Got rid of some temp debug code
- src addr selection moved to a common file (sctp_output.c)
- Support for simple VRF's (we have support for multi-vfr
  via compile switch that is scrubbed from BSD but we won't
  need multi-vrf until we first get VRF :-D)
- Rest of mib work for address information now done
- Limit number of addresses in INIT/INIT-ACK to
  a #def (30).

Reviewed by:	gnn
2007-03-15 11:27:14 +00:00
Bruce M Simpson
160a2e5504 Document the AF_LINK extension which was imported from NetBSD. 2007-02-28 21:28:33 +00:00
Bruce M Simpson
67228c4621 Nuke ascii2addr() and addr2ascii(). They have no consumers anywhere
in FreeBSD, and originated from INRIA IPv6.

Stub out netstat reference to addr2ascii() I mistakenly introduced.
Update misleading man page sections.

Merge NetBSD's getnameinfo() AF_LINK extensions for a portable way to
print link-layer addresses given a sockaddr_dl(), minus the IEEE 1394
bits which don't map directly to our code.

Obtained from:	NetBSD (getnameinfo.c)
Discussed on:	current (March 2006)
2007-02-28 21:18:38 +00:00
Randall Stewart
7c3768006d Fix include declaration it was sys/sctp.h should be netinet/sctp.h,
reported by pluknet@gmail.com.
2007-02-26 12:23:32 +00:00
Randall Stewart
2cbcccc774 Fixes build breakage.. invalid type casts.. and invalid
type for size in one place.
2007-02-22 14:48:12 +00:00
Randall Stewart
d8b5fd91b9 First cut of the sctp man pages. Still need work. 2007-02-22 14:32:39 +00:00
Randall Stewart
2c0d559d1e Fixes __FreeBSD__ being present (they should not)
and also trailing garbage on undef of magic numbers.
2007-02-22 13:39:57 +00:00
Randall Stewart
804cf64147 Adds a performance improvement for when sctp_sendx is
called with only one address, we then can call the
generic system call. Also fixes some socket api
type issues and cleans up the "magic" numbers that
were being used in the code.

Reviewed by:	gnn
2007-02-22 12:42:43 +00:00
Bruce M Simpson
50c317ac7c Docuemnt exactly which functions access which NSS databases.
Point out that FreeBSD libc has compat stubs for GNU glibc NSS
modules which access NSDB_PASSWD/NSDB_GROUP, but not NSDB_HOSTS;
based on painful experience porting nss_mdns.

Reviewed by:	ru
2007-01-22 11:45:25 +00:00
Warner Losh
c879ae3536 Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.
2007-01-09 00:28:16 +00:00
Craig Rodrigues
066f54d831 Consistently use a socklen_t type where required, and eliminate
GCC warning "dereferencing type-punned pointer will
break strict-aliasing rules".

Reviewed by:	rrs
2006-12-16 06:03:43 +00:00
Randall Stewart
d6dda9b282 This adds the "system calls"
sctp_getaddrlen()
 sctp_connectx()
 sctp_bindx()
 sctp_opt_info()
 sctp_getpaddrs()
 sctp_freepaddrs()
 sctp_getladdrs()
 sctp_freeladdrs()
 sctp_sendmsg()
 sctp_getassocid()
 sctp_send()
 sctp_sendx()
 sctp_sendmsgx()
 sctp_recvmsg()
 sctp_peeloff()

Manual pages will be forthcoming (and the commit to porters-handbook)
2006-12-15 12:01:50 +00:00
Hajimu UMEMOTO
909e7467d8 Use _kevent() instead of kevent().
Requested by:	nork
2006-12-04 17:08:43 +00:00
Olivier Houchard
05b432d2d1 Instead of re-implementing hton[ls] and friends for each arch, add a new MI
file, net/ntoh.c, which just implement them using the inline functions from
<sys/endian.h>.

Suggested by:	bde
2006-11-06 22:07:47 +00:00
Sam Lawrance
6b0a380f6d Document return values for res_query and res_search.
h_errno is not an extern int, just a macro providing an integer lvalue.

PR:		doc/50573
Submitted by:	Ronald F.Guilmette <rfg@monkeys.com>
Reviewed by:	trhodes
MFC after:	3 days
2006-11-04 09:42:22 +00:00
Ruslan Ermilov
0f0eddbb01 Add missing markup bits.
Submitted by:	Emil Mikulic
2006-10-28 13:05:10 +00:00
Ruslan Ermilov
a73a3ab56b Markup fixes. 2006-09-17 21:27:35 +00:00
Yaroslav Tykhiy
11eb328ec5 Respect MK_INET6_SUPPORT. 2006-07-26 08:36:46 +00:00
Yaroslav Tykhiy
720fc1c7dc Fix build w/o INET6.
Submitted by:	Andre Albsmeier <Andre.Albsmeier siemens com>
2006-07-26 08:35:46 +00:00
Hajimu UMEMOTO
e24e9d9988 do not overload the port number on to the return value of
str2number().  this could result in an unexpected code path.

Obtained from:	KAME
MFC after:	1 week
2006-07-23 15:31:03 +00:00
Hajimu UMEMOTO
18d2f53d00 stop use of mutex lock in ICMP lookup.
MFC after:	1 week
2006-07-23 07:07:49 +00:00
Hajimu UMEMOTO
816dc28540 remove obsolete comments.
MFC after:	3 days
2006-07-22 14:36:56 +00:00
Hajimu UMEMOTO
da83bf18e4 simplification in explore_numeric: unified the post-process with
GET_AI and GET_PORT.  Commented on an impossible case.

Obtained from:	KAME
MFC after:	1 week
2006-07-21 19:02:28 +00:00
Hajimu UMEMOTO
0cf41987df RFC3493 requires use of inet_aton for AF_INET.
Obtained from:	KAME
MFC after:	1 week
2006-07-21 19:00:22 +00:00
Hajimu UMEMOTO
0aceddcef7 clean-up: rewrote explore_null and explore_numeric without using sentinel.
we do not need it since we make (at most) a single addrinfo entry in these
cases.

Obtained from:	KAME
MFC after:	1 week
2006-07-21 18:57:44 +00:00
Hajimu UMEMOTO
b88ad6b5d6 - draft-ietf-ipngwg-icmp-namelookups-09
- make it compilable

It still requires root privilege and is experimental.

Obtained from:	KAME
MFC after:	1 week
2006-07-21 18:55:51 +00:00
Stefan Farfeleder
33ef612ede Use a prototype for res_init().
MFC after:	3 days
2006-07-17 09:27:26 +00:00
Hajimu UMEMOTO
1bdf356bd3 Fix gethostbyaddr() prototype to conform to IEEE Std 1003.1 on 64 bit
arch.

X-MFC after:	never
2006-05-21 11:27:28 +00:00
Hajimu UMEMOTO
734aa10414 Return EAI_OVERFLOW instead of EAI_MEMORY when the supplied buffer is
too short.  This conforms to RFC3493, POSIX and XPG6.

Obtained from:	NetBSD
2006-05-21 11:22:31 +00:00
Hajimu UMEMOTO
d808369aa1 Upgrade res_update(3) and the friends to BIND9's one excluding TSIG
support.

X-MFC after:	never
2006-05-21 11:19:36 +00:00
Hajimu UMEMOTO
3da59cd007 Fix gethostbyaddr() prototype to conform to IEEE Std 1003.1:
http://www.opengroup.org/onlinepubs/009695399/functions/gethostbyaddr.html

gethostbyaddr_r() is changed as well.
It breaks ABI backward compatibility on 64 bit arch.  So, we fix it
on 32 bit arch only for now.

Reported by:	Rostislav Krasny <rosti.bsd@gmail.com>
2006-05-12 15:37:23 +00:00
Hajimu UMEMOTO
b947683ce1 Fix alignment problem on AMD64.
Reported by:	Pascal Hofstee <caelian__at__gmail.com>
Submitted by:	Michael Bushkov <bushman__at__rsu.ru>
Tested by:	Pascal Hofstee <caelian__at__gmail.com>
2006-05-02 23:02:32 +00:00
Hajimu UMEMOTO
eb59e992e1 cache' couldn't co-exist with compat'.
Submitted by:	"Michael Bushkov" <bushman__at__rsu.ru>
2006-04-30 21:25:00 +00:00
Hajimu UMEMOTO
06a99fe36f - Extend the nsswitch to support Services, Protocols and Rpc
databases.
- Make nsswitch support caching.

Submitted by:	Michael Bushkov <bushman__at__rsu.ru>
Sponsored by:	Google Summer of Code 2005
2006-04-28 12:03:38 +00:00
Hajimu UMEMOTO
d3ac2b30d4 - make reentrant version of netdb functions glibc style API, and
expose them to outside of libc.
- make netdb functions NSS friendly.

Reviewed by:	arch@ and current@ (no objection)
2006-04-15 16:20:27 +00:00
Hajimu UMEMOTO
3c3c80e4c8 fix indent. 2006-04-01 15:53:39 +00:00
Hajimu UMEMOTO
eb27a220f8 Expose res_update and friends again. At least, ports/mail/spamilter
uses them.
Now, we have res_nupdate and res_nmkupdate as well, but they are
still based on our old resolver for binary backward compatibility.
So, they don't provide new features such as TSIG support.

Reported by:	pointyhat via kris
2006-03-30 20:15:53 +00:00
Hajimu UMEMOTO
1259a17acd If the query choked with EDNS0, retry without EDNS0.
Obtained from:	res_nquery() of BIND9.
2006-03-28 07:42:57 +00:00
Hajimu UMEMOTO
90d1d883e9 - Use ANSI C prototype.
- Remove trailing space.
2006-03-25 11:46:37 +00:00
Hajimu UMEMOTO
aebc6ec293 When res_nquerydomain() returns SERVFAIL, we should try next domain. 2006-03-24 13:30:10 +00:00
Hajimu UMEMOTO
d05ad2ab4d When res_send() fails, we should reserve an error code. 2006-03-24 04:49:30 +00:00
Hajimu UMEMOTO
5342d17f09 Update the resolver in libc to BIND9's one.
Since, res_sendsigned(3) and the friends use MD5 functions, it is
hard to include them without having MD5 functions in libc.  So,
res_sendsigned(3) is not merged into libc.

Since, res_update(3) in BIND9 is not binary compatible with our
res_update(3), res_update(3) is leaved as is, except some
necessary modifications.
The res_update(3) and the friends are not essential part of the
resolver.  They are not defined in resolv.h but defined in
res_update.h separately in BIND9.  Further, they are not called from
our tree.  So, I hide them from our resolv.h, but leave them only
for binary backward compatibility (perhaps, no one calls them).

Since, struct __res_state_ext is not exposed in BIND9, I hide it
from our resolv.h.  And, global variable _res_ext is removed.  It
breaks binary backward compatibility.  But, since it is not used from
outside of our libc, I think it is safe.

Reviewed by:	arch@ (no objection)
2006-03-21 16:11:11 +00:00
Xin LI
f1fa5b4f51 When we are doing initialization against q, use its own size, not
the size of q2.  This should be a no-op because q and q2 are of
the same type.

Submitted by:	Alexey Dobriyan <adobriyan gmail com>
2006-03-21 12:39:29 +00:00
Ruslan Ermilov
e1fe3dba5c Reimplementation of world/kernel build options. For details, see:
http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html

The src.conf(5) manpage is to follow in a few days.

Brought to you by:	imp, jhb, kris, phk, ru (all bugs are mine)
2006-03-17 18:54:44 +00:00
Daniel Eischen
ed323e898c ns_name_skip was recently redefined to __ns_name_skip
like the others in <include/arpa/nameser.h>.

Submitted by:	ume
2006-03-13 04:49:40 +00:00
Daniel Eischen
6fad3aaf15 Add each directory's symbol map file to SYM_MAPS. 2006-03-13 01:15:01 +00:00
Daniel Eischen
cce72e8860 Add symbol maps and initial symbol version definitions to libc.
Reviewed by:	davidxu
2006-03-13 00:53:21 +00:00
Hajimu UMEMOTO
3a0b3b6739 Handle the errors returned by res_querydomain() in same manner.
Reported by:	yar
Tested by:	yar, Rostislav Krasny <rosti.bsd__at__gmail.com>
MFC after:	1 week
2006-03-01 15:53:49 +00:00
Daniel Eischen
fc9ae54dca Correct a comment.
Staticize two tables thare are not visible in <resolv.h>
and which are also local in Solaris' libresolv.

Remove two functions that are not referenced in libc nor
anywhere else I can find, not visible in <resolv.h> and
which are also local in Solaris libresolv.
2006-02-27 22:08:16 +00:00
Hajimu UMEMOTO
12d96fe63f Sync inet_net_pton() and inet_net_ntop() with latest BIND9's includes
an IPv6 support.

PR:		kern/93740
Submitted by:	Rudolf Cejka <cejkar__at__fit.vutbr.cz>
Obtained from:	BIND9
MFC after:	1 week
2006-02-26 05:44:21 +00:00
Hajimu UMEMOTO
5ecccefb4a - Just query 'as is', if there is a trailing dot in the name.
- Don't query 'as is' twice.

PR:		bin/62139
Reported by:	Rostislav Krasny <rosti.bsd__at__gmail.com>
Tested by:	Rostislav Krasny <rosti.bsd__at__gmail.com>
Obtained from:	BIND9 (with some modification)
MFC after:	1 week
2006-02-24 16:53:42 +00:00
Ruslan Ermilov
49e5b98f5a Fix inet6_opt_get_val() prototype. 2005-11-23 16:07:54 +00:00
Ruslan Ermilov
c48648d2c1 Add missing includes. 2005-11-23 10:49:07 +00:00
Hajimu UMEMOTO
4a58c5f5a3 The KAME's getipnodebyaddr() code honor the MULTI_PTRS_ARE_ALIASES
define also, but res_config.h was not included into libc/net/name6.c.
So getipnodebyaddr() ignored the multiple PTRs.

PR:		kern/88241
Submitted by:	Dan Lukes <dan__at__obluda.cz>
MFC after:	3 days
2005-11-15 03:40:15 +00:00
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
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