History log of /openbsd-current/lib/libc/rpc/clnt_udp.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.42 02-Apr-2024 jsg

fix unintended sizeof(pointer) introduced in rev 1.41
found with noderef.cocci, ok deraadt@


Revision tags: OPENBSD_7_5_BASE
# 1.41 22-Jan-2024 deraadt

When getpwnam(3) reaches out to YP, it calls clntudp_create(3) with a
pre-initialized ypconnect(2) socket. That calls clntudp_bufcreate(),
which contains code checking if the socket and address are configured..
If not, socket(2) is called, or an address allocation is performed via
the portmapper (which calls a whole lot more code).

Split clnt_udp.c into two .c files (which will compile as seperate .o
files), and create a new libc-private clntudp_bufcreate_simple() function
which skips the socket and address work.

Result: In most static binaries, this reduces the text segment by
~100K, and removes 5-7 system call stubs -- which might matter for
non-pledged binaries with otherwise lack socket(2).
ok millert jmatthew


Revision tags: OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.40 24-Aug-2022 deraadt

if the socket is connected, we can use recv() instead of recvfrom()
ok jmatthew


# 1.39 15-Jul-2022 deraadt

Add a new clnt*_control CLSET_CONNECTED, which says the socket has already
been connected. In the udp case, this means to use send(), not sendto()
ok jmatthew, claudio, miod


Revision tags: OPENBSD_7_1_BASE
# 1.38 14-Feb-2022 guenther

Mark all the rpc 'ops' vectors, for auth, client, service, and xdr,
as const, moving them from .data to .data.rel.ro. The other BSDs
did this a long time ago; NetBSD did a chunk in 1998, which is long
enough I didn't bother to get exact dates for others.

ok deraadt@ millert@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.37 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.35 06-Jan-2018 cheloha

Remove dead gettimeofday calls and timevals.

ok jca@


# 1.34 14-Dec-2017 jca

Simplify and unify timespec variables used in those event loops

ok millert@


# 1.33 14-Dec-2017 jca

Use CLOCK_MONOTONIC for the rpc event loops

From Scott Cheloha, ok deraadt@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.32 01-Nov-2015 guenther

delete old lint ARGSUSED comments


# 1.31 13-Sep-2015 guenther

Wrap <rpc/*.h> so that calls go direct and the symbols are all weak.
Hide __xprt_register() and _authenticate(); truncate <rpc/svc_auth.h>

ok deraadt@


# 1.30 09-Sep-2015 guenther

Use SOCK_NONBLOCK in a couple more places

ok deraadt@


# 1.29 01-Sep-2015 deraadt

Remove all bogus writes to stderr. Only explicit requests should
go that way.
ok miod beck


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

Use fcntl() to set non-blocking-mode, rather ioctl(). This has a better
chance of working in systrace restricted environments.
ok guenther


Revision tags: OPENBSD_5_7_BASE
# 1.27 11-Nov-2014 guenther

Merge from NetBSD from 1999-03-25:"
* don't close the socket unless it was opened by the function
* note (in the comments) that the client is responsible for closing
the socket if they opened it, or they didn't use CLNT_DESTROY()

fixes a couple of unnecessary closing of already-closed sockets.
noted by: Matthias Drochner <M.Drochner@fz-juelich.de>"

tested by many in snaps
ok schwarze@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 01-Sep-2010 millert

Oracle has re-licensed sunrpc under a three-clause BSD license.
Update our sources appropriately. OK deraadt@ jsg@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.25 02-Jun-2009 schwarze

When authnone_create fails, do not leave behind a NULL cl_auth attribute,
because that one will typically derefenced later without any checking.
Instead, flag the error condition and bail out cleanly.
useful feedback from kjell@ and ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.24 31-Mar-2006 deraadt

sprinkle a bit of ARGSUSED


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.22 01-Apr-2005 otto

ansify. ok deraadt@ jaredy@


Revision tags: OPENBSD_3_7_BASE
# 1.21 08-Jan-2005 krw

Bit of KNF - replace (<type> *)0 and (<type> *)NULL with NULL. Pointed
out by mickey@, seconded by millert@.

ok deraadt@.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.20 31-Dec-2003 millert

Implement svc_getreq_poll(3) and friends and use poll(2) instead of select(2)
in the libc rpc code. The main difference between this and the previous
version is the use of a simple free list that simplifies the logic when
adding a socket to svc_pollfd. I've also added code to pack svc_pollfd
when the free list gets too big. The idea general idea is to keep
svc_pollfd as tightly packed as possible to make poll(2) efficient.
Tested by many people and OK deraadt@


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE
# 1.19 06-Sep-2002 deraadt

use socklen_t where needed; henning pvalchev ok


# 1.18 03-Jun-2002 deraadt

compatiblity -> compatibility
decriptor -> descriptor
authentciated -> authenticated
transmition -> transmission


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.17 15-Sep-2001 deraadt

prototype cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.16 24-Aug-2000 deraadt

uninit variables


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.15 01-Mar-1998 deraadt

match xid nicer; plus notes for later work


# 1.14 05-Nov-1997 deraadt

if xdr_replymsg() fails, it can leave memory still allocated. thus we
need to go XDR_FREE it; wpaul@freebsd. clnt_raw.c also appears to have
the same problem, and there is precedent for the solution in various
other rpc code.


Revision tags: OPENBSD_2_2_BASE
# 1.13 22-Sep-1997 millert

Some -Wall.


Revision tags: OPENBSD_2_1_BASE
# 1.12 29-Apr-1997 deraadt

something is wrong with this level of randomness; let 2.1 go out with this "problem"


# 1.11 27-Apr-1997 deraadt

re-randomize xid on reuse of a CLIENT *; pointed out by adam@math.tau.ac.il


# 1.10 02-Jan-1997 deraadt

use arc4random for xid generation


# 1.9 14-Nov-1996 etheisen

Missed one cast.


Revision tags: OPENBSD_2_0_BASE
# 1.8 02-Sep-1996 deraadt

perturb xid further. confuse the world


# 1.7 20-Aug-1996 deraadt

memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org


# 1.6 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.5 15-Aug-1996 deraadt

support descriptors > FD_SETSIZE and correct timeout handling


# 1.4 20-Jul-1996 deraadt

bcopy->memcpy & tag


# 1.3 29-Jun-1996 deraadt

typo


# 1.2 25-Mar-1996 tholo

Pull prototypes into scope
Remove graticious casts


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.41 22-Jan-2024 deraadt

When getpwnam(3) reaches out to YP, it calls clntudp_create(3) with a
pre-initialized ypconnect(2) socket. That calls clntudp_bufcreate(),
which contains code checking if the socket and address are configured..
If not, socket(2) is called, or an address allocation is performed via
the portmapper (which calls a whole lot more code).

Split clnt_udp.c into two .c files (which will compile as seperate .o
files), and create a new libc-private clntudp_bufcreate_simple() function
which skips the socket and address work.

Result: In most static binaries, this reduces the text segment by
~100K, and removes 5-7 system call stubs -- which might matter for
non-pledged binaries with otherwise lack socket(2).
ok millert jmatthew


Revision tags: OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.40 24-Aug-2022 deraadt

if the socket is connected, we can use recv() instead of recvfrom()
ok jmatthew


# 1.39 15-Jul-2022 deraadt

Add a new clnt*_control CLSET_CONNECTED, which says the socket has already
been connected. In the udp case, this means to use send(), not sendto()
ok jmatthew, claudio, miod


Revision tags: OPENBSD_7_1_BASE
# 1.38 14-Feb-2022 guenther

Mark all the rpc 'ops' vectors, for auth, client, service, and xdr,
as const, moving them from .data to .data.rel.ro. The other BSDs
did this a long time ago; NetBSD did a chunk in 1998, which is long
enough I didn't bother to get exact dates for others.

ok deraadt@ millert@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.37 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.35 06-Jan-2018 cheloha

Remove dead gettimeofday calls and timevals.

ok jca@


# 1.34 14-Dec-2017 jca

Simplify and unify timespec variables used in those event loops

ok millert@


# 1.33 14-Dec-2017 jca

Use CLOCK_MONOTONIC for the rpc event loops

From Scott Cheloha, ok deraadt@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.32 01-Nov-2015 guenther

delete old lint ARGSUSED comments


# 1.31 13-Sep-2015 guenther

Wrap <rpc/*.h> so that calls go direct and the symbols are all weak.
Hide __xprt_register() and _authenticate(); truncate <rpc/svc_auth.h>

ok deraadt@


# 1.30 09-Sep-2015 guenther

Use SOCK_NONBLOCK in a couple more places

ok deraadt@


# 1.29 01-Sep-2015 deraadt

Remove all bogus writes to stderr. Only explicit requests should
go that way.
ok miod beck


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

Use fcntl() to set non-blocking-mode, rather ioctl(). This has a better
chance of working in systrace restricted environments.
ok guenther


Revision tags: OPENBSD_5_7_BASE
# 1.27 11-Nov-2014 guenther

Merge from NetBSD from 1999-03-25:"
* don't close the socket unless it was opened by the function
* note (in the comments) that the client is responsible for closing
the socket if they opened it, or they didn't use CLNT_DESTROY()

fixes a couple of unnecessary closing of already-closed sockets.
noted by: Matthias Drochner <M.Drochner@fz-juelich.de>"

tested by many in snaps
ok schwarze@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 01-Sep-2010 millert

Oracle has re-licensed sunrpc under a three-clause BSD license.
Update our sources appropriately. OK deraadt@ jsg@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.25 02-Jun-2009 schwarze

When authnone_create fails, do not leave behind a NULL cl_auth attribute,
because that one will typically derefenced later without any checking.
Instead, flag the error condition and bail out cleanly.
useful feedback from kjell@ and ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.24 31-Mar-2006 deraadt

sprinkle a bit of ARGSUSED


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.22 01-Apr-2005 otto

ansify. ok deraadt@ jaredy@


Revision tags: OPENBSD_3_7_BASE
# 1.21 08-Jan-2005 krw

Bit of KNF - replace (<type> *)0 and (<type> *)NULL with NULL. Pointed
out by mickey@, seconded by millert@.

ok deraadt@.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.20 31-Dec-2003 millert

Implement svc_getreq_poll(3) and friends and use poll(2) instead of select(2)
in the libc rpc code. The main difference between this and the previous
version is the use of a simple free list that simplifies the logic when
adding a socket to svc_pollfd. I've also added code to pack svc_pollfd
when the free list gets too big. The idea general idea is to keep
svc_pollfd as tightly packed as possible to make poll(2) efficient.
Tested by many people and OK deraadt@


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE
# 1.19 06-Sep-2002 deraadt

use socklen_t where needed; henning pvalchev ok


# 1.18 03-Jun-2002 deraadt

compatiblity -> compatibility
decriptor -> descriptor
authentciated -> authenticated
transmition -> transmission


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.17 15-Sep-2001 deraadt

prototype cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.16 24-Aug-2000 deraadt

uninit variables


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.15 01-Mar-1998 deraadt

match xid nicer; plus notes for later work


# 1.14 05-Nov-1997 deraadt

if xdr_replymsg() fails, it can leave memory still allocated. thus we
need to go XDR_FREE it; wpaul@freebsd. clnt_raw.c also appears to have
the same problem, and there is precedent for the solution in various
other rpc code.


Revision tags: OPENBSD_2_2_BASE
# 1.13 22-Sep-1997 millert

Some -Wall.


Revision tags: OPENBSD_2_1_BASE
# 1.12 29-Apr-1997 deraadt

something is wrong with this level of randomness; let 2.1 go out with this "problem"


# 1.11 27-Apr-1997 deraadt

re-randomize xid on reuse of a CLIENT *; pointed out by adam@math.tau.ac.il


# 1.10 02-Jan-1997 deraadt

use arc4random for xid generation


# 1.9 14-Nov-1996 etheisen

Missed one cast.


Revision tags: OPENBSD_2_0_BASE
# 1.8 02-Sep-1996 deraadt

perturb xid further. confuse the world


# 1.7 20-Aug-1996 deraadt

memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org


# 1.6 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.5 15-Aug-1996 deraadt

support descriptors > FD_SETSIZE and correct timeout handling


# 1.4 20-Jul-1996 deraadt

bcopy->memcpy & tag


# 1.3 29-Jun-1996 deraadt

typo


# 1.2 25-Mar-1996 tholo

Pull prototypes into scope
Remove graticious casts


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.40 24-Aug-2022 deraadt

if the socket is connected, we can use recv() instead of recvfrom()
ok jmatthew


# 1.39 15-Jul-2022 deraadt

Add a new clnt*_control CLSET_CONNECTED, which says the socket has already
been connected. In the udp case, this means to use send(), not sendto()
ok jmatthew, claudio, miod


Revision tags: OPENBSD_7_1_BASE
# 1.38 14-Feb-2022 guenther

Mark all the rpc 'ops' vectors, for auth, client, service, and xdr,
as const, moving them from .data to .data.rel.ro. The other BSDs
did this a long time ago; NetBSD did a chunk in 1998, which is long
enough I didn't bother to get exact dates for others.

ok deraadt@ millert@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.37 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.35 06-Jan-2018 cheloha

Remove dead gettimeofday calls and timevals.

ok jca@


# 1.34 14-Dec-2017 jca

Simplify and unify timespec variables used in those event loops

ok millert@


# 1.33 14-Dec-2017 jca

Use CLOCK_MONOTONIC for the rpc event loops

From Scott Cheloha, ok deraadt@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.32 01-Nov-2015 guenther

delete old lint ARGSUSED comments


# 1.31 13-Sep-2015 guenther

Wrap <rpc/*.h> so that calls go direct and the symbols are all weak.
Hide __xprt_register() and _authenticate(); truncate <rpc/svc_auth.h>

ok deraadt@


# 1.30 09-Sep-2015 guenther

Use SOCK_NONBLOCK in a couple more places

ok deraadt@


# 1.29 01-Sep-2015 deraadt

Remove all bogus writes to stderr. Only explicit requests should
go that way.
ok miod beck


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

Use fcntl() to set non-blocking-mode, rather ioctl(). This has a better
chance of working in systrace restricted environments.
ok guenther


Revision tags: OPENBSD_5_7_BASE
# 1.27 11-Nov-2014 guenther

Merge from NetBSD from 1999-03-25:"
* don't close the socket unless it was opened by the function
* note (in the comments) that the client is responsible for closing
the socket if they opened it, or they didn't use CLNT_DESTROY()

fixes a couple of unnecessary closing of already-closed sockets.
noted by: Matthias Drochner <M.Drochner@fz-juelich.de>"

tested by many in snaps
ok schwarze@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 01-Sep-2010 millert

Oracle has re-licensed sunrpc under a three-clause BSD license.
Update our sources appropriately. OK deraadt@ jsg@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.25 02-Jun-2009 schwarze

When authnone_create fails, do not leave behind a NULL cl_auth attribute,
because that one will typically derefenced later without any checking.
Instead, flag the error condition and bail out cleanly.
useful feedback from kjell@ and ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.24 31-Mar-2006 deraadt

sprinkle a bit of ARGSUSED


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.22 01-Apr-2005 otto

ansify. ok deraadt@ jaredy@


Revision tags: OPENBSD_3_7_BASE
# 1.21 08-Jan-2005 krw

Bit of KNF - replace (<type> *)0 and (<type> *)NULL with NULL. Pointed
out by mickey@, seconded by millert@.

ok deraadt@.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.20 31-Dec-2003 millert

Implement svc_getreq_poll(3) and friends and use poll(2) instead of select(2)
in the libc rpc code. The main difference between this and the previous
version is the use of a simple free list that simplifies the logic when
adding a socket to svc_pollfd. I've also added code to pack svc_pollfd
when the free list gets too big. The idea general idea is to keep
svc_pollfd as tightly packed as possible to make poll(2) efficient.
Tested by many people and OK deraadt@


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE
# 1.19 06-Sep-2002 deraadt

use socklen_t where needed; henning pvalchev ok


# 1.18 03-Jun-2002 deraadt

compatiblity -> compatibility
decriptor -> descriptor
authentciated -> authenticated
transmition -> transmission


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.17 15-Sep-2001 deraadt

prototype cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.16 24-Aug-2000 deraadt

uninit variables


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.15 01-Mar-1998 deraadt

match xid nicer; plus notes for later work


# 1.14 05-Nov-1997 deraadt

if xdr_replymsg() fails, it can leave memory still allocated. thus we
need to go XDR_FREE it; wpaul@freebsd. clnt_raw.c also appears to have
the same problem, and there is precedent for the solution in various
other rpc code.


Revision tags: OPENBSD_2_2_BASE
# 1.13 22-Sep-1997 millert

Some -Wall.


Revision tags: OPENBSD_2_1_BASE
# 1.12 29-Apr-1997 deraadt

something is wrong with this level of randomness; let 2.1 go out with this "problem"


# 1.11 27-Apr-1997 deraadt

re-randomize xid on reuse of a CLIENT *; pointed out by adam@math.tau.ac.il


# 1.10 02-Jan-1997 deraadt

use arc4random for xid generation


# 1.9 14-Nov-1996 etheisen

Missed one cast.


Revision tags: OPENBSD_2_0_BASE
# 1.8 02-Sep-1996 deraadt

perturb xid further. confuse the world


# 1.7 20-Aug-1996 deraadt

memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org


# 1.6 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.5 15-Aug-1996 deraadt

support descriptors > FD_SETSIZE and correct timeout handling


# 1.4 20-Jul-1996 deraadt

bcopy->memcpy & tag


# 1.3 29-Jun-1996 deraadt

typo


# 1.2 25-Mar-1996 tholo

Pull prototypes into scope
Remove graticious casts


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.39 15-Jul-2022 deraadt

Add a new clnt*_control CLSET_CONNECTED, which says the socket has already
been connected. In the udp case, this means to use send(), not sendto()
ok jmatthew, claudio, miod


Revision tags: OPENBSD_7_1_BASE
# 1.38 14-Feb-2022 guenther

Mark all the rpc 'ops' vectors, for auth, client, service, and xdr,
as const, moving them from .data to .data.rel.ro. The other BSDs
did this a long time ago; NetBSD did a chunk in 1998, which is long
enough I didn't bother to get exact dates for others.

ok deraadt@ millert@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.37 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.35 06-Jan-2018 cheloha

Remove dead gettimeofday calls and timevals.

ok jca@


# 1.34 14-Dec-2017 jca

Simplify and unify timespec variables used in those event loops

ok millert@


# 1.33 14-Dec-2017 jca

Use CLOCK_MONOTONIC for the rpc event loops

From Scott Cheloha, ok deraadt@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.32 01-Nov-2015 guenther

delete old lint ARGSUSED comments


# 1.31 13-Sep-2015 guenther

Wrap <rpc/*.h> so that calls go direct and the symbols are all weak.
Hide __xprt_register() and _authenticate(); truncate <rpc/svc_auth.h>

ok deraadt@


# 1.30 09-Sep-2015 guenther

Use SOCK_NONBLOCK in a couple more places

ok deraadt@


# 1.29 01-Sep-2015 deraadt

Remove all bogus writes to stderr. Only explicit requests should
go that way.
ok miod beck


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

Use fcntl() to set non-blocking-mode, rather ioctl(). This has a better
chance of working in systrace restricted environments.
ok guenther


Revision tags: OPENBSD_5_7_BASE
# 1.27 11-Nov-2014 guenther

Merge from NetBSD from 1999-03-25:"
* don't close the socket unless it was opened by the function
* note (in the comments) that the client is responsible for closing
the socket if they opened it, or they didn't use CLNT_DESTROY()

fixes a couple of unnecessary closing of already-closed sockets.
noted by: Matthias Drochner <M.Drochner@fz-juelich.de>"

tested by many in snaps
ok schwarze@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 01-Sep-2010 millert

Oracle has re-licensed sunrpc under a three-clause BSD license.
Update our sources appropriately. OK deraadt@ jsg@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.25 02-Jun-2009 schwarze

When authnone_create fails, do not leave behind a NULL cl_auth attribute,
because that one will typically derefenced later without any checking.
Instead, flag the error condition and bail out cleanly.
useful feedback from kjell@ and ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.24 31-Mar-2006 deraadt

sprinkle a bit of ARGSUSED


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.22 01-Apr-2005 otto

ansify. ok deraadt@ jaredy@


Revision tags: OPENBSD_3_7_BASE
# 1.21 08-Jan-2005 krw

Bit of KNF - replace (<type> *)0 and (<type> *)NULL with NULL. Pointed
out by mickey@, seconded by millert@.

ok deraadt@.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.20 31-Dec-2003 millert

Implement svc_getreq_poll(3) and friends and use poll(2) instead of select(2)
in the libc rpc code. The main difference between this and the previous
version is the use of a simple free list that simplifies the logic when
adding a socket to svc_pollfd. I've also added code to pack svc_pollfd
when the free list gets too big. The idea general idea is to keep
svc_pollfd as tightly packed as possible to make poll(2) efficient.
Tested by many people and OK deraadt@


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE
# 1.19 06-Sep-2002 deraadt

use socklen_t where needed; henning pvalchev ok


# 1.18 03-Jun-2002 deraadt

compatiblity -> compatibility
decriptor -> descriptor
authentciated -> authenticated
transmition -> transmission


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.17 15-Sep-2001 deraadt

prototype cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.16 24-Aug-2000 deraadt

uninit variables


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.15 01-Mar-1998 deraadt

match xid nicer; plus notes for later work


# 1.14 05-Nov-1997 deraadt

if xdr_replymsg() fails, it can leave memory still allocated. thus we
need to go XDR_FREE it; wpaul@freebsd. clnt_raw.c also appears to have
the same problem, and there is precedent for the solution in various
other rpc code.


Revision tags: OPENBSD_2_2_BASE
# 1.13 22-Sep-1997 millert

Some -Wall.


Revision tags: OPENBSD_2_1_BASE
# 1.12 29-Apr-1997 deraadt

something is wrong with this level of randomness; let 2.1 go out with this "problem"


# 1.11 27-Apr-1997 deraadt

re-randomize xid on reuse of a CLIENT *; pointed out by adam@math.tau.ac.il


# 1.10 02-Jan-1997 deraadt

use arc4random for xid generation


# 1.9 14-Nov-1996 etheisen

Missed one cast.


Revision tags: OPENBSD_2_0_BASE
# 1.8 02-Sep-1996 deraadt

perturb xid further. confuse the world


# 1.7 20-Aug-1996 deraadt

memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org


# 1.6 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.5 15-Aug-1996 deraadt

support descriptors > FD_SETSIZE and correct timeout handling


# 1.4 20-Jul-1996 deraadt

bcopy->memcpy & tag


# 1.3 29-Jun-1996 deraadt

typo


# 1.2 25-Mar-1996 tholo

Pull prototypes into scope
Remove graticious casts


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.38 14-Feb-2022 guenther

Mark all the rpc 'ops' vectors, for auth, client, service, and xdr,
as const, moving them from .data to .data.rel.ro. The other BSDs
did this a long time ago; NetBSD did a chunk in 1998, which is long
enough I didn't bother to get exact dates for others.

ok deraadt@ millert@


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.37 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.35 06-Jan-2018 cheloha

Remove dead gettimeofday calls and timevals.

ok jca@


# 1.34 14-Dec-2017 jca

Simplify and unify timespec variables used in those event loops

ok millert@


# 1.33 14-Dec-2017 jca

Use CLOCK_MONOTONIC for the rpc event loops

From Scott Cheloha, ok deraadt@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.32 01-Nov-2015 guenther

delete old lint ARGSUSED comments


# 1.31 13-Sep-2015 guenther

Wrap <rpc/*.h> so that calls go direct and the symbols are all weak.
Hide __xprt_register() and _authenticate(); truncate <rpc/svc_auth.h>

ok deraadt@


# 1.30 09-Sep-2015 guenther

Use SOCK_NONBLOCK in a couple more places

ok deraadt@


# 1.29 01-Sep-2015 deraadt

Remove all bogus writes to stderr. Only explicit requests should
go that way.
ok miod beck


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

Use fcntl() to set non-blocking-mode, rather ioctl(). This has a better
chance of working in systrace restricted environments.
ok guenther


Revision tags: OPENBSD_5_7_BASE
# 1.27 11-Nov-2014 guenther

Merge from NetBSD from 1999-03-25:"
* don't close the socket unless it was opened by the function
* note (in the comments) that the client is responsible for closing
the socket if they opened it, or they didn't use CLNT_DESTROY()

fixes a couple of unnecessary closing of already-closed sockets.
noted by: Matthias Drochner <M.Drochner@fz-juelich.de>"

tested by many in snaps
ok schwarze@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 01-Sep-2010 millert

Oracle has re-licensed sunrpc under a three-clause BSD license.
Update our sources appropriately. OK deraadt@ jsg@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.25 02-Jun-2009 schwarze

When authnone_create fails, do not leave behind a NULL cl_auth attribute,
because that one will typically derefenced later without any checking.
Instead, flag the error condition and bail out cleanly.
useful feedback from kjell@ and ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.24 31-Mar-2006 deraadt

sprinkle a bit of ARGSUSED


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.22 01-Apr-2005 otto

ansify. ok deraadt@ jaredy@


Revision tags: OPENBSD_3_7_BASE
# 1.21 08-Jan-2005 krw

Bit of KNF - replace (<type> *)0 and (<type> *)NULL with NULL. Pointed
out by mickey@, seconded by millert@.

ok deraadt@.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.20 31-Dec-2003 millert

Implement svc_getreq_poll(3) and friends and use poll(2) instead of select(2)
in the libc rpc code. The main difference between this and the previous
version is the use of a simple free list that simplifies the logic when
adding a socket to svc_pollfd. I've also added code to pack svc_pollfd
when the free list gets too big. The idea general idea is to keep
svc_pollfd as tightly packed as possible to make poll(2) efficient.
Tested by many people and OK deraadt@


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE
# 1.19 06-Sep-2002 deraadt

use socklen_t where needed; henning pvalchev ok


# 1.18 03-Jun-2002 deraadt

compatiblity -> compatibility
decriptor -> descriptor
authentciated -> authenticated
transmition -> transmission


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.17 15-Sep-2001 deraadt

prototype cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.16 24-Aug-2000 deraadt

uninit variables


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.15 01-Mar-1998 deraadt

match xid nicer; plus notes for later work


# 1.14 05-Nov-1997 deraadt

if xdr_replymsg() fails, it can leave memory still allocated. thus we
need to go XDR_FREE it; wpaul@freebsd. clnt_raw.c also appears to have
the same problem, and there is precedent for the solution in various
other rpc code.


Revision tags: OPENBSD_2_2_BASE
# 1.13 22-Sep-1997 millert

Some -Wall.


Revision tags: OPENBSD_2_1_BASE
# 1.12 29-Apr-1997 deraadt

something is wrong with this level of randomness; let 2.1 go out with this "problem"


# 1.11 27-Apr-1997 deraadt

re-randomize xid on reuse of a CLIENT *; pointed out by adam@math.tau.ac.il


# 1.10 02-Jan-1997 deraadt

use arc4random for xid generation


# 1.9 14-Nov-1996 etheisen

Missed one cast.


Revision tags: OPENBSD_2_0_BASE
# 1.8 02-Sep-1996 deraadt

perturb xid further. confuse the world


# 1.7 20-Aug-1996 deraadt

memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org


# 1.6 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.5 15-Aug-1996 deraadt

support descriptors > FD_SETSIZE and correct timeout handling


# 1.4 20-Jul-1996 deraadt

bcopy->memcpy & tag


# 1.3 29-Jun-1996 deraadt

typo


# 1.2 25-Mar-1996 tholo

Pull prototypes into scope
Remove graticious casts


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.37 06-Jul-2020 pirofti

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.35 06-Jan-2018 cheloha

Remove dead gettimeofday calls and timevals.

ok jca@


# 1.34 14-Dec-2017 jca

Simplify and unify timespec variables used in those event loops

ok millert@


# 1.33 14-Dec-2017 jca

Use CLOCK_MONOTONIC for the rpc event loops

From Scott Cheloha, ok deraadt@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.32 01-Nov-2015 guenther

delete old lint ARGSUSED comments


# 1.31 13-Sep-2015 guenther

Wrap <rpc/*.h> so that calls go direct and the symbols are all weak.
Hide __xprt_register() and _authenticate(); truncate <rpc/svc_auth.h>

ok deraadt@


# 1.30 09-Sep-2015 guenther

Use SOCK_NONBLOCK in a couple more places

ok deraadt@


# 1.29 01-Sep-2015 deraadt

Remove all bogus writes to stderr. Only explicit requests should
go that way.
ok miod beck


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

Use fcntl() to set non-blocking-mode, rather ioctl(). This has a better
chance of working in systrace restricted environments.
ok guenther


Revision tags: OPENBSD_5_7_BASE
# 1.27 11-Nov-2014 guenther

Merge from NetBSD from 1999-03-25:"
* don't close the socket unless it was opened by the function
* note (in the comments) that the client is responsible for closing
the socket if they opened it, or they didn't use CLNT_DESTROY()

fixes a couple of unnecessary closing of already-closed sockets.
noted by: Matthias Drochner <M.Drochner@fz-juelich.de>"

tested by many in snaps
ok schwarze@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 01-Sep-2010 millert

Oracle has re-licensed sunrpc under a three-clause BSD license.
Update our sources appropriately. OK deraadt@ jsg@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.25 02-Jun-2009 schwarze

When authnone_create fails, do not leave behind a NULL cl_auth attribute,
because that one will typically derefenced later without any checking.
Instead, flag the error condition and bail out cleanly.
useful feedback from kjell@ and ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.24 31-Mar-2006 deraadt

sprinkle a bit of ARGSUSED


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.22 01-Apr-2005 otto

ansify. ok deraadt@ jaredy@


Revision tags: OPENBSD_3_7_BASE
# 1.21 08-Jan-2005 krw

Bit of KNF - replace (<type> *)0 and (<type> *)NULL with NULL. Pointed
out by mickey@, seconded by millert@.

ok deraadt@.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.20 31-Dec-2003 millert

Implement svc_getreq_poll(3) and friends and use poll(2) instead of select(2)
in the libc rpc code. The main difference between this and the previous
version is the use of a simple free list that simplifies the logic when
adding a socket to svc_pollfd. I've also added code to pack svc_pollfd
when the free list gets too big. The idea general idea is to keep
svc_pollfd as tightly packed as possible to make poll(2) efficient.
Tested by many people and OK deraadt@


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE
# 1.19 06-Sep-2002 deraadt

use socklen_t where needed; henning pvalchev ok


# 1.18 03-Jun-2002 deraadt

compatiblity -> compatibility
decriptor -> descriptor
authentciated -> authenticated
transmition -> transmission


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.17 15-Sep-2001 deraadt

prototype cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.16 24-Aug-2000 deraadt

uninit variables


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.15 01-Mar-1998 deraadt

match xid nicer; plus notes for later work


# 1.14 05-Nov-1997 deraadt

if xdr_replymsg() fails, it can leave memory still allocated. thus we
need to go XDR_FREE it; wpaul@freebsd. clnt_raw.c also appears to have
the same problem, and there is precedent for the solution in various
other rpc code.


Revision tags: OPENBSD_2_2_BASE
# 1.13 22-Sep-1997 millert

Some -Wall.


Revision tags: OPENBSD_2_1_BASE
# 1.12 29-Apr-1997 deraadt

something is wrong with this level of randomness; let 2.1 go out with this "problem"


# 1.11 27-Apr-1997 deraadt

re-randomize xid on reuse of a CLIENT *; pointed out by adam@math.tau.ac.il


# 1.10 02-Jan-1997 deraadt

use arc4random for xid generation


# 1.9 14-Nov-1996 etheisen

Missed one cast.


Revision tags: OPENBSD_2_0_BASE
# 1.8 02-Sep-1996 deraadt

perturb xid further. confuse the world


# 1.7 20-Aug-1996 deraadt

memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org


# 1.6 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.5 15-Aug-1996 deraadt

support descriptors > FD_SETSIZE and correct timeout handling


# 1.4 20-Jul-1996 deraadt

bcopy->memcpy & tag


# 1.3 29-Jun-1996 deraadt

typo


# 1.2 25-Mar-1996 tholo

Pull prototypes into scope
Remove graticious casts


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.35 06-Jan-2018 cheloha

Remove dead gettimeofday calls and timevals.

ok jca@


# 1.34 14-Dec-2017 jca

Simplify and unify timespec variables used in those event loops

ok millert@


# 1.33 14-Dec-2017 jca

Use CLOCK_MONOTONIC for the rpc event loops

From Scott Cheloha, ok deraadt@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.32 01-Nov-2015 guenther

delete old lint ARGSUSED comments


# 1.31 13-Sep-2015 guenther

Wrap <rpc/*.h> so that calls go direct and the symbols are all weak.
Hide __xprt_register() and _authenticate(); truncate <rpc/svc_auth.h>

ok deraadt@


# 1.30 09-Sep-2015 guenther

Use SOCK_NONBLOCK in a couple more places

ok deraadt@


# 1.29 01-Sep-2015 deraadt

Remove all bogus writes to stderr. Only explicit requests should
go that way.
ok miod beck


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

Use fcntl() to set non-blocking-mode, rather ioctl(). This has a better
chance of working in systrace restricted environments.
ok guenther


Revision tags: OPENBSD_5_7_BASE
# 1.27 11-Nov-2014 guenther

Merge from NetBSD from 1999-03-25:"
* don't close the socket unless it was opened by the function
* note (in the comments) that the client is responsible for closing
the socket if they opened it, or they didn't use CLNT_DESTROY()

fixes a couple of unnecessary closing of already-closed sockets.
noted by: Matthias Drochner <M.Drochner@fz-juelich.de>"

tested by many in snaps
ok schwarze@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 01-Sep-2010 millert

Oracle has re-licensed sunrpc under a three-clause BSD license.
Update our sources appropriately. OK deraadt@ jsg@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.25 02-Jun-2009 schwarze

When authnone_create fails, do not leave behind a NULL cl_auth attribute,
because that one will typically derefenced later without any checking.
Instead, flag the error condition and bail out cleanly.
useful feedback from kjell@ and ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.24 31-Mar-2006 deraadt

sprinkle a bit of ARGSUSED


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.22 01-Apr-2005 otto

ansify. ok deraadt@ jaredy@


Revision tags: OPENBSD_3_7_BASE
# 1.21 08-Jan-2005 krw

Bit of KNF - replace (<type> *)0 and (<type> *)NULL with NULL. Pointed
out by mickey@, seconded by millert@.

ok deraadt@.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.20 31-Dec-2003 millert

Implement svc_getreq_poll(3) and friends and use poll(2) instead of select(2)
in the libc rpc code. The main difference between this and the previous
version is the use of a simple free list that simplifies the logic when
adding a socket to svc_pollfd. I've also added code to pack svc_pollfd
when the free list gets too big. The idea general idea is to keep
svc_pollfd as tightly packed as possible to make poll(2) efficient.
Tested by many people and OK deraadt@


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE
# 1.19 06-Sep-2002 deraadt

use socklen_t where needed; henning pvalchev ok


# 1.18 03-Jun-2002 deraadt

compatiblity -> compatibility
decriptor -> descriptor
authentciated -> authenticated
transmition -> transmission


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.17 15-Sep-2001 deraadt

prototype cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.16 24-Aug-2000 deraadt

uninit variables


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.15 01-Mar-1998 deraadt

match xid nicer; plus notes for later work


# 1.14 05-Nov-1997 deraadt

if xdr_replymsg() fails, it can leave memory still allocated. thus we
need to go XDR_FREE it; wpaul@freebsd. clnt_raw.c also appears to have
the same problem, and there is precedent for the solution in various
other rpc code.


Revision tags: OPENBSD_2_2_BASE
# 1.13 22-Sep-1997 millert

Some -Wall.


Revision tags: OPENBSD_2_1_BASE
# 1.12 29-Apr-1997 deraadt

something is wrong with this level of randomness; let 2.1 go out with this "problem"


# 1.11 27-Apr-1997 deraadt

re-randomize xid on reuse of a CLIENT *; pointed out by adam@math.tau.ac.il


# 1.10 02-Jan-1997 deraadt

use arc4random for xid generation


# 1.9 14-Nov-1996 etheisen

Missed one cast.


Revision tags: OPENBSD_2_0_BASE
# 1.8 02-Sep-1996 deraadt

perturb xid further. confuse the world


# 1.7 20-Aug-1996 deraadt

memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org


# 1.6 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.5 15-Aug-1996 deraadt

support descriptors > FD_SETSIZE and correct timeout handling


# 1.4 20-Jul-1996 deraadt

bcopy->memcpy & tag


# 1.3 29-Jun-1996 deraadt

typo


# 1.2 25-Mar-1996 tholo

Pull prototypes into scope
Remove graticious casts


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.35 06-Jan-2018 cheloha

Remove dead gettimeofday calls and timevals.

ok jca@


# 1.34 14-Dec-2017 jca

Simplify and unify timespec variables used in those event loops

ok millert@


# 1.33 14-Dec-2017 jca

Use CLOCK_MONOTONIC for the rpc event loops

From Scott Cheloha, ok deraadt@ tb@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.32 01-Nov-2015 guenther

delete old lint ARGSUSED comments


# 1.31 13-Sep-2015 guenther

Wrap <rpc/*.h> so that calls go direct and the symbols are all weak.
Hide __xprt_register() and _authenticate(); truncate <rpc/svc_auth.h>

ok deraadt@


# 1.30 09-Sep-2015 guenther

Use SOCK_NONBLOCK in a couple more places

ok deraadt@


# 1.29 01-Sep-2015 deraadt

Remove all bogus writes to stderr. Only explicit requests should
go that way.
ok miod beck


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

Use fcntl() to set non-blocking-mode, rather ioctl(). This has a better
chance of working in systrace restricted environments.
ok guenther


Revision tags: OPENBSD_5_7_BASE
# 1.27 11-Nov-2014 guenther

Merge from NetBSD from 1999-03-25:"
* don't close the socket unless it was opened by the function
* note (in the comments) that the client is responsible for closing
the socket if they opened it, or they didn't use CLNT_DESTROY()

fixes a couple of unnecessary closing of already-closed sockets.
noted by: Matthias Drochner <M.Drochner@fz-juelich.de>"

tested by many in snaps
ok schwarze@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 01-Sep-2010 millert

Oracle has re-licensed sunrpc under a three-clause BSD license.
Update our sources appropriately. OK deraadt@ jsg@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.25 02-Jun-2009 schwarze

When authnone_create fails, do not leave behind a NULL cl_auth attribute,
because that one will typically derefenced later without any checking.
Instead, flag the error condition and bail out cleanly.
useful feedback from kjell@ and ok millert@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.24 31-Mar-2006 deraadt

sprinkle a bit of ARGSUSED


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


# 1.22 01-Apr-2005 otto

ansify. ok deraadt@ jaredy@


Revision tags: OPENBSD_3_7_BASE
# 1.21 08-Jan-2005 krw

Bit of KNF - replace (<type> *)0 and (<type> *)NULL with NULL. Pointed
out by mickey@, seconded by millert@.

ok deraadt@.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.20 31-Dec-2003 millert

Implement svc_getreq_poll(3) and friends and use poll(2) instead of select(2)
in the libc rpc code. The main difference between this and the previous
version is the use of a simple free list that simplifies the logic when
adding a socket to svc_pollfd. I've also added code to pack svc_pollfd
when the free list gets too big. The idea general idea is to keep
svc_pollfd as tightly packed as possible to make poll(2) efficient.
Tested by many people and OK deraadt@


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE
# 1.19 06-Sep-2002 deraadt

use socklen_t where needed; henning pvalchev ok


# 1.18 03-Jun-2002 deraadt

compatiblity -> compatibility
decriptor -> descriptor
authentciated -> authenticated
transmition -> transmission


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
# 1.17 15-Sep-2001 deraadt

prototype cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.16 24-Aug-2000 deraadt

uninit variables


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.15 01-Mar-1998 deraadt

match xid nicer; plus notes for later work


# 1.14 05-Nov-1997 deraadt

if xdr_replymsg() fails, it can leave memory still allocated. thus we
need to go XDR_FREE it; wpaul@freebsd. clnt_raw.c also appears to have
the same problem, and there is precedent for the solution in various
other rpc code.


Revision tags: OPENBSD_2_2_BASE
# 1.13 22-Sep-1997 millert

Some -Wall.


Revision tags: OPENBSD_2_1_BASE
# 1.12 29-Apr-1997 deraadt

something is wrong with this level of randomness; let 2.1 go out with this "problem"


# 1.11 27-Apr-1997 deraadt

re-randomize xid on reuse of a CLIENT *; pointed out by adam@math.tau.ac.il


# 1.10 02-Jan-1997 deraadt

use arc4random for xid generation


# 1.9 14-Nov-1996 etheisen

Missed one cast.


Revision tags: OPENBSD_2_0_BASE
# 1.8 02-Sep-1996 deraadt

perturb xid further. confuse the world


# 1.7 20-Aug-1996 deraadt

memset 0; also fix for byte order botch in __svc_fdset handling; thanks to mw@openbsd.org


# 1.6 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.5 15-Aug-1996 deraadt

support descriptors > FD_SETSIZE and correct timeout handling


# 1.4 20-Jul-1996 deraadt

bcopy->memcpy & tag


# 1.3 29-Jun-1996 deraadt

typo


# 1.2 25-Mar-1996 tholo

Pull prototypes into scope
Remove graticious casts


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision