summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc/clnt_udp.c
Commit message (Collapse)AuthorAgeFilesLines
* Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) andalfred2001-03-191-569/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | associated changes that had to happen to make this possible as well as bugs fixed along the way. Bring in required TLI library routines to support this. Since we don't support TLI we've essentially copied what NetBSD has done, adding a thin layer to emulate direct the TLI calls into BSD socket calls. This is mostly from Sun's tirpc release that was made in 1994, however some fixes were backported from the 1999 release (supposedly only made available after this porting effort was underway). The submitter has agreed to continue on and bring us up to the 1999 release. Several key features are introduced with this update: Client calls are thread safe. (1999 code has server side thread safe) Updated, a more modern interface. Many userland updates were done to bring the code up to par with the recent RPC API. There is an update to the pthreads library, a function pthread_main_np() was added to emulate a function of Sun's threads library. While we're at it, bring in NetBSD's lockd, it's been far too long of a wait. New rpcbind(8) replaces portmap(8) (supporting communication over an authenticated Unix-domain socket, and by default only allowing set and unset requests over that channel). It's much more secure than the old portmapper. Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded to support TI-RPC and to support IPV6. Umount(8) is also fixed to unmount pathnames longer than 80 chars, which are currently truncated by the Kernel statfs structure. Submitted by: Martin Blapp <mb@imp.ch> Manpage review: ru Secure RPC implemented by: wpaul
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-241-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),jasone2000-01-271-1/+1
| | | | | | | | | | | | | | | | | just use _foo() <-- foo(). In the case of a libpthread that doesn't do call conversion (such as linuxthreads and our upcoming libpthread), this is adequate. In the case of libc_r, we still need three names, which are now _thread_sys_foo() <-- _foo() <-- foo(). Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(), nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo(). Remove all internal libc usage of: creat(), pause(), sleep(), system(), tcdrain(), wait(), and waitpid(). Make thread cancellation fully POSIX-compliant. Suggested by: deischen
* Add three-tier symbol naming in support of POSIX thread cancellationjasone2000-01-121-1/+1
| | | | | | points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read().
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* In clntudp_call(), it is possible that xdr_replymsg() might failwpaul1997-10-261-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | partway through its attempt to decode the result structure sent by the server. If this happens, it can leave the result partially populated with dynamically allocated memory. In this event, the xdr_replymsg() failure is detected and RPC_CANTDECODERES is returned, but the memory in the partially populated result struct is not free()d. The end result is that memory is leaked when an RPC_CANTDECODERES error occurs. (This condition can occur if a CLIENT * handle is created using clntudp_bufcreate() with a receive buffer size that is too small to handle the result sent by the server.) Fixed by setting reply_xdrs.x_op to XDR_FREE and calling xdr_replymsg() again to free the memory if an RPC_CANTDECODERES error is detected. I suspect that the clnt_tcp.c, clnt_unix.c and clnt_raw.c modules may ha a similar problem, but I haven't duplicated the condition with those yet. Found by: dbmalloc
* Resolve conflicts.wpaul1997-05-281-3/+92
| | | | | | | | | | | This concludes tonight's entertainment. Once I'm sure I haven't destroyed the world with all these changes, I'll import the utilities. Everything should continue to work as before. If it doesn't let me know. Special thanks to Mark Murray for running a test 'make world' for me to shake out the bugs, which, hopefully, I have fixed. (And there was much rejoicing.)
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* - prototypes now in include filepeter1996-12-301-49/+64
| | | | | | | | | | | - fix timeout code - better "random" initial transaction id for long running daemons - unlimited number of file descriptors to select(). - 64 bit type safe wire protocol Obtained from: a diff of FreeBSD vs. OpenBSD/NetBSD rpc code. - typo (spelling police :-) - dont die on select() that returns time remaining (on my systems)
* Code cleanup (part two):jraynard1996-06-101-3/+5
| | | | | | | | | | | | 1. Added missing function prototypes. 2. Added missing function return types. 3. Added missing function argument types. 4. Added missing headers for system function prototypes. 5. Corrected casts in select() args. 6. Got rid of more "extern int errno" rubbish. 7. Added extra parentheses around assignment used as truth value. 8. Fixed bug in clnt_{tcp, udp}create() where pointers could be free'd even if they hadn't been successfully malloc()'d.
* Fixed type mismatches.bde1995-12-071-3/+3
|
* Well, cvs commit core'ed on me, I belive I have got all the locks out,phk1995-10-221-1/+4
| | | | | | | | | | | | | | | | | | | but a commit mail got lost, it's the same as for this commit: lib/libc/gen confstr.c crypt.c disklabel.c fstab.c getcap.c getgrent.c getgrouplist.c getpass.c getpwent.c initgroups.c nlist.c psignal.c pwcache.c setmode.c sleep.c sysconf.c sysctl.c syslog.c usleep.c lib/libc/locale none.c read_runemagi.c setlocale.c lib/libc/net gethostbydns.c getnetbydns.c getnetbynis.c lib/libc/nls msgcat.c lib/libc/quad Makefile.inc lib/libc/regex engine.c regcomp.c regerror.c Minor cleanup, mostly unused vars and missing #includes. Limit the number of quad functions we pull in for 'i386'. I still belive the quad stuff should go back into gcc. Add compile-time warnings about crypt functions.
* Reviewed by: David Greenmanwpaul1995-08-021-14/+4
| | | | | | | | | | | | | | | Back out the 'help NIS rebind faster' hack. This change used a connect()/send() pair rather than the original sendto() to allow RPC to pass ICMP host unreachable and similar errors up to RPC programs that use UDP. This is not a terrible thing by itself, but it can cause trouble in environments with multi-homed hosts: if the portmapper on the multi-homed machine sends a reply with a source address that's different than the one associated with the connection by connect(), the kernel will send a port unreachable message and drop the reply. For the sake of compatibility with everybody else on the planet, it's best to revert to the old behavior. *long, heavy sigh*
* Remove trailing whitespace.rgrimes1995-05-301-18/+18
|
* Submitted by: Sebastian Strollowwpaul1995-04-021-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Obtained from: Casper H. Dik (by vay of Usenet) Small patch to help improve NIS rebinding times (among other things): >From: casper@fwi.uva.nl (Casper H.S. Dik) >Newsgroups: comp.sys.sun.misc,comp.sys.sun.admin >Subject: FIX for slow rebinding of NIS. >Summary: a small change in libc makes life with NIS a lot easier. >Message-ID: <1992Jan17.173905.11727@fwi.uva.nl> >Date: 17 Jan 92 17:39:05 GMT >Sender: news@fwi.uva.nl >Organization: FWI, University of Amsterdam >Lines: 138 >Nntp-Posting-Host: halo.fwi.uva.nl Have you been plagued by long waits when your NIS server is rebooted? READ ON! Sun has a patch, but the README says: ********************* WARNING ****************************** This is a new version of ypbind that never uses the NIS binding file to cache the servers binding. This will have the effect of fixing the current symptom. However, it might degrade the overall performance of the system when the server is available. This is most likely to happen on an overloaded server, which will cause the network to produce a broadcast storm. ************************************************************* Therefor, I have produced another fix. o What goes wrong. When the NIS server is rebooted, ypserv will obtain different ports to listen for RPC requests. All clients will continue to use the old binding they obtained earlier. The NIS server will send ICMP dst unreachable messages for the RPC requests that arrive at the old port. These ICMPs are dropped on the floor and the client code will continue sending the requests until the timer has expired. The small fix at the end of this message will pick up these ICMP messages and deliver them to the RPC layer. o Before and after. I've tested this on some machines and this is the result: (kill and restart ypserv on the server) original% time ypmatch user passwd user:.... 0.040u 0.090s 2:35.64 0.0% 0+126k 0+0io 0pf+0w (155 seconds elapsed time) fixedhost% time ypmatch user passwd user:.... 0.050u 0.050s 0:10.20 0.9% 0+136k 0+0io 0pf+0w (10 seconds elapsed time) Rebinding is almost instantaneous. o Other benefits. RPC calls that use UDP as transport will no longer time out but will abort much sooner. (E.g., the remote host is unreachable or 111/udp is filtered by an intermediate router)
* Moving Sun RPC code into libc, part 1. Based on work done by a number ofwollman1994-08-071-0/+444
people, including J.T. Conklin, Theo de Raadt, Paul Richards, and probably someone else who's going to flame me as soon as they see this message.
OpenPOWER on IntegriCloud