aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2021-07-28 15:46:59 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2021-07-28 16:35:09 +0000
commit7045b1603bdf054145dd958a4acc17b410fb62a0 (patch)
tree9802ca364b6612648e33425e92b0f53f40799308 /lib/libc
parent33ff39796ffe469a764e485ac49c31700a51fd6f (diff)
downloadsrc-7045b1603bdf054145dd958a4acc17b410fb62a0.tar.gz
src-7045b1603bdf054145dd958a4acc17b410fb62a0.zip
socket: Implement SO_RERROR
SO_RERROR indicates that receive buffer overflows should be handled as errors. Historically receive buffer overflows have been ignored and programs could not tell if they missed messages or messages had been truncated because of overflows. Since programs historically do not expect to get receive overflow errors, this behavior is not the default. This is really really important for programs that use route(4) to keep in sync with the system. If we loose a message then we need to reload the full system state, otherwise the behaviour from that point is undefined and can lead to chasing bogus bug reports. Reviewed by: philip (network), kbowling (transport), gbe (manpages) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26652
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/getsockopt.210
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2
index 1e4ed6827170..3ff971a0e5db 100644
--- a/lib/libc/sys/getsockopt.2
+++ b/lib/libc/sys/getsockopt.2
@@ -28,7 +28,7 @@
.\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95
.\" $FreeBSD$
.\"
-.Dd June 3, 2020
+.Dd February 8, 2021
.Dt GETSOCKOPT 2
.Os
.Sh NAME
@@ -177,6 +177,7 @@ for the socket
.It Dv SO_PROTOCOL Ta "get the protocol number for the socket (get only)"
.It Dv SO_PROTOTYPE Ta "SunOS alias for the Linux SO_PROTOCOL (get only)"
.It Dv SO_ERROR Ta "get and clear error on the socket (get only)"
+.It Dv SO_RERROR Ta "enables receive error reporting"
.It Dv SO_SETFIB Ta "set the associated FIB (routing table) for the socket (set only)"
.El
.Pp
@@ -514,6 +515,13 @@ returns any pending error on the socket and clears
the error status.
It may be used to check for asynchronous errors on connected
datagram sockets or for other asynchronous errors.
+.Dv SO_RERROR
+indicates that receive buffer overflows should be handled as errors.
+Historically receive buffer overflows have been ignored and programs
+could not tell if they missed messages or messages had been truncated
+because of overflows.
+Since programs historically do not expect to get receive overflow errors,
+this behavior is not the default.
.Pp
.Dv SO_LABEL
returns the MAC label of the socket.