summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc/get_myaddress.c
Commit message (Collapse)AuthorAgeFilesLines
* Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) andalfred2001-03-191-114/+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-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Replace structure copy form ifreq obtained by SIOCGIFADDRshin2000-03-031-1/+1
| | | | | | to memcpy(), to avoid unaligned access trap on alpha. Approved by: jkh
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),jasone2000-01-271-3/+3
| | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | 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
|
* Fix two bugs which caused various RPC programs (mountd, nfsd, ...)jdp1997-10-171-3/+3
| | | | | | | | | | | | | | | to fail under certain circumstances. 1. In one spot, the ifr_flags member was being examined in the wrong structure, thus it contained garbage. On a machine in which only the loopback interface was up, this caused everything that wanted to talk to the portmapper to fail -- a particular problem with laptops, where the pccard ethernet interface is likely to come up long after the attempt to start mountd, nfsd, amd, etc. 2. Compounding the above problem, get_myaddress() returned a successful status even though it failed to find an address that it considered good enough.
* Make selection logic more strict. Only select AF_INET loopback interfaceswpaul1997-09-211-3/+6
| | | | | that are up on second (loopback only) pass, and only select non-loopback AF_INET interfaces that are up on first pass.
* Hm... wonder how long this has been here.wpaul1997-06-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic in get_myaddress() is broken: it always returns the loopback address due to the following rule: if ((ifreq.ifr_flags & IFF_UP) && ifr->ifr_addr.sa_family == AF_INET && (loopback == 1 && (ifreq.ifr_flags & IFF_LOOPBACK))) { The idea is that we want to select the interface address only if it's up and it's in the AF_INET family. If it turns uout we don't have such an interface available, we make a second pass through the loop, this time settling for the loopback interface. But the logic inadvertently locks out all cases when loopback == 0, so nothing is ever selected until the second pass (when loopback == 1). This is changed to: if (((ifreq.ifr_flags & IFF_UP) && ifr->ifr_addr.sa_family == AF_INET) || (loopback == 1 && (ifreq.ifr_flags & IFF_LOOPBACK))) { which I think does the right thing. This is yet another bogon I discovered during NIS+ testing; I need get_myaddress() to work correctly so that the callback code in the client library will work.
* Resolve conflicts.wpaul1997-05-281-5/+3
| | | | | | | | | | | 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.
* Correct logic braino when attempting to exclude loopback addresses onpeter1997-01-091-2/+2
| | | | | | the first pass. Submitted by: Greg Lehey <grog@lemis.de>
* Two minor changes to try and make it more robust in the face of manypeter1997-01-091-2/+4
| | | | | | | | | interfaces, until it's redone to use sysctl(). - bump the SIOCGIFCONF buffer size from 1K to 8K - if we didn't find a suitable address, return a failure. Previously if it didn't find anything it left the return address uninitialised. Perhaps it would be better to return AF_INET/111/127.0.0.1 rather than failing?
* - canonical function declarationpeter1996-12-301-9/+21
| | | | | | | | - don't exit. It's bad form for libc to exit() or abort() instead of returning an error. - only use loopback addresses after checking the real interfaces. Obtained from: a diff of FreeBSD vs. OpenBSD/NetBSD rpc code.
* get_myaddress() wasn't following the interface array properlypst1996-11-221-12/+9
| | | | Cannidate for: 2.2
* Code cleanup (part one):jraynard1996-06-081-2/+2
| | | | | | | | | | | | 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. Got rid of "extern int errno" rubbish.
* Well, cvs commit core'ed on me, I belive I have got all the locks out,phk1995-10-221-1/+2
| | | | | | | | | | | | | | | | | | | 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.
* Remove trailing whitespace.rgrimes1995-05-301-7/+7
|
* Moving Sun RPC code into libc, part 1. Based on work done by a number ofwollman1994-08-071-0/+99
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