History log of /freebsd-current/usr.sbin/rpcbind/rpcbind.c
Revision Date Author Comments
# 4d65a7c6 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.sbin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 8a7b6120 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.sbin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 8789e3b0 30-Aug-2023 Stephen J. Kiernan <stevek@FreeBSD.org>

rpcbind: Add flag for foreground mode

Added the -N flag to enable foreground mode.

It is useful to be able to run rpcbind in foreground mode when
starting from launcher applications. The existing debug flag
is not sufficient as it enables additional debug messages.

Update man page to document the added flag.

Reviewed by: imp
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D41674


# 2a63c3be 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c comment pattern

Remove /^/[*/]\s*\$FreeBSD\$.*\n/


# 3e09403f 18-Mar-2018 Xin LI <delphij@FreeBSD.org>

Plug a possible memory leak.

MFC after: 2 weeks


# 35f85edc 02-Jan-2018 Conrad Meyer <cem@FreeBSD.org>

rpcbind: Fix race in signal termination

If a signal was delivered while the main thread was not in poll(2) and after
check was performed, we could reenter poll and never detect termination. Fix
this with the pipefd trick. (This race was introduced very recently, in
r327482.)

PR: 224503
Reported by: kib
Reviewed by: kib, markj
Sponsored by: Dell EMC Isilon


# 055569f6 01-Jan-2018 Conrad Meyer <cem@FreeBSD.org>

rpcbind: Do not use signal-unsafe functions in SIGTERM handler

syslog(3), routines used in write_warmstart(), and exit(3) are all
signal-unsafe. Instead, set a signal-safe flag and check the flag in the
rpcbind main loop to shutdown safely.

PR: 224503
Reviewed by: kib, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13728


# c3fc0d96 01-Jan-2018 Xin LI <delphij@FreeBSD.org>

Remove unused includes.


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# fadafdfa 19-Apr-2017 Enji Cooper <ngie@FreeBSD.org>

Print out the signal number on exit in terminate(..) if WARMSTART is compiled
into rpcbind.

The signal number can provide helpful diagnostic info.

MFC after: 1 week
Obtained from: Isilon OneFS
Sponsored by: Dell EMC Isilon


# 4eb767ea 29-May-2016 Enji Cooper <ngie@FreeBSD.org>

Staticize variables only used in rpcbind.c

This is some low hanging fruit necessary for making this WARNS?= 6 clean

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division


# ea9ed3d8 06-Mar-2014 Alexander Motin <mav@FreeBSD.org>

Disable libwrap (TCP wrappers) support in rpcbind by default, introducing
new command line options -W, to enable it when needed.

On my tests this change by almost ten times improves rpcbind performance.

No objections: many, net@


# a7c51fa1 25-Nov-2013 Hiroki Sato <hrs@FreeBSD.org>

Replace Sun RPC license with a 3-clause BSD license, with the explicit
permission of Sun Microsystems in 2009.


# a5752d55 21-Dec-2012 Kevin Lo <kevlo@FreeBSD.org>

Fix socket calls on error post-r243965.

Submitted by: Garrett Cooper


# 3df5ecac 30-Dec-2011 Ulrich Spörlein <uqs@FreeBSD.org>

Spelling fixes for usr.sbin/


# 07de1c52 14-Jul-2011 Xin LI <delphij@FreeBSD.org>

Use prototype. While I'm there, add a pair of parenthesis to mark an if
statment's border.

MFC after: 1 month


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 3d1783b6 12-Apr-2010 Warner Losh <imp@FreeBSD.org>

MFC r203710:

When you have multiple addresses on the same network on different
interfaces (such as when you are part of a carp pool), and you run
rpcbind -h to restrict which interfaces have rpc services, rpcbind can
none-the-less return addresses that aren't in the -h list. This patch
enforces the rule that when you specify -h on the command line, then
services returned from rpcbind must be to one of the addresses listed
in -h, or be a loopback address (since localhost is implicit when
running -h).

The root cause of this is the assumption in addrmerge that there can
be only one interface that matches a given network IP address. This
turns out not to be the case. To retain historical behavior, I didn't
try to fix the routine to prefer the address that the request came
into, since I didn't know the side effects that might cause in the
normal case. My quick analysis suggests that it wouldn't be a
problem, but since this code is tricky I opted for the more
conservative patch of only restricting the reply when -h is in effect.

Hence, this change will have no effect when you are running rpcbind
without -h.

Reviewed by: alfred@
Sponsored by: iX Systems
MFC after: 2 weeks


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 923dd9a7 09-Feb-2010 Warner Losh <imp@FreeBSD.org>

When you have multiple addresses on the same network on different
interfaces (such as when you are part of a carp pool), and you run
rpcbind -h to restrict which interfaces have rpc services, rpcbind can
none-the-less return addresses that aren't in the -h list. This patch
enforces the rule that when you specify -h on the command line, then
services returned from rpcbind must be to one of the addresses listed
in -h, or be a loopback address (since localhost is implicit when
running -h).

The root cause of this is the assumption in addrmerge that there can
be only one interface that matches a given network IP address. This
turns out not to be the case. To retain historical behavior, I didn't
try to fix the routine to prefer the address that the request came
into, since I didn't know the side effects that might cause in the
normal case. My quick analysis suggests that it wouldn't be a
problem, but since this code is tricky I opted for the more
conservative patch of only restricting the reply when -h is in effect.

Hence, this change will have no effect when you are running rpcbind
without -h.

Reviewed by: alfred@
Sponsored by: iX Systems
MFC after: 2 weeks


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 870db2da 14-Feb-2008 Yaroslav Tykhiy <ytykhiy@gmail.com>

No network addresses in the system isn't a good excuse
for rpcbind(8) to crash.

The crash was due to a boolean variable initialized
improperly. Besides fixing the initialization, pick
a better name for the variable so that its meaning is
clear and no more coding errors appear around it.


# 784bddbc 07-Nov-2007 Kevin Lo <kevlo@FreeBSD.org>

Cleanup of userland __P use


# 8a06ee9e 23-Oct-2007 Matteo Riondato <matteo@FreeBSD.org>

Avoid leaking file descriptors


# e2f7e255 09-Jun-2007 Matteo Riondato <matteo@FreeBSD.org>

Remove a comment I forgot to remove


# 48e5a99e 01-May-2007 Matteo Riondato <matteo@FreeBSD.org>

Correctly inizialize local/unix transport. I broke it in rev.1.15.

PR: bin/1122566
MFC after: 1 week


# 55987d86 23-Apr-2007 Matteo Riondato <matteo@FreeBSD.org>

1)Make it possible for rpcbind(8) to bind TCP listening socket to an IP
other than INADDR_ANY.

2) Add the -6 option to specify "IPv6 only".

Glanced at by: bms
Requested by: bms [2]
PR: bin/84494 [1]
Approved by: silence from maintainer (~2 weeks) [1]
MFC after: 2 weeks


# cb4c0b80 06-Nov-2004 Dima Dorfman <dd@FreeBSD.org>

Make the usage message match reality about -h and -w.


# 90c9edaa 15-Aug-2004 Martin Blapp <mbr@FreeBSD.org>

MFNetBSD

Decrease log severity to debug if a protocol is not supported by the
kernel (rpcbind checks /etc/netconfig if a protocol is available).
This avoids "rpcbind: cannot create socket for tcp6" messages
at startup on IPv4-only kernels.


# 11362b09 29-Oct-2003 Martin Blapp <mbr@FreeBSD.org>

Don't pass NULL as an integer.

Obtained from: NetBSD


# bcb53b16 16-Jan-2003 Martin Blapp <mbr@FreeBSD.org>

Implement nonblocking tpc-connections. rpcgen -m does still
produce backcompatible code.

Reviewed by: rwatson
Obtained from: NetBSD
MFC after: 1 day


# 9d5abbdd 01-Jan-2003 Jens Schweikhardt <schweikh@FreeBSD.org>

Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.


# fb4c8061 16-Dec-2002 Martin Blapp <mbr@FreeBSD.org>

Change the name for the local unix-socket based protocol
from "unix" back to "local". Add some compat stuff so both
ways work for some time.

Reviewed by: phk
Approved by: imp (UPDATING)
Requested by: iedowse, lukem@netbsd.org


# b1c56f9c 10-Dec-2002 Martin Blapp <mbr@FreeBSD.org>

Check if rpcbind is already running and print a warning.
Fixes segfault if rpcbind is started up a second time.

Solution has been taken from mountd(8).

Reviewed by: phk
Approved by: re (rwatson)


# 4180788f 06-Oct-2002 Alfred Perlstein <alfred@FreeBSD.org>

WARNS=3 safety (mostly), use __unused for unused params and unsigned where
needed to avoid warnings about comparing signed and unsigned values.


# 4362ea29 06-Oct-2002 Alfred Perlstein <alfred@FreeBSD.org>

fix line wrap.


# e9fb8a0e 06-Oct-2002 Alfred Perlstein <alfred@FreeBSD.org>

Don't pass a NULL pointer to syslog(3).

Submitted by: kris


# fc99a00c 22-Jul-2002 Hajimu UMEMOTO <ume@FreeBSD.org>

use IPV6_V6ONLY instead of non standard IPV6_BINDV6ONLY.

MFC after: 1 week


# 9fb91417 11-Jul-2002 Alfred Perlstein <alfred@FreeBSD.org>

Add -h option to rpcbind, used to specify what address to bind to for
UDP requests.

Submitted by: mbr


# 2244ec01 16-May-2002 Juli Mallett <jmallett@FreeBSD.org>

Stop this program's abuse of malloc(3). Its return value doesn't need these
ugly explicit casts, and its argument doesn't need explicitly cast to u_int,
especially if sizeof() is being used.


# 8360efbd 18-Mar-2001 Alfred Perlstein <alfred@FreeBSD.org>

Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
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