diff options
author | Roy Marples <roy@marples.name> | 2021-07-28 15:46:59 +0000 |
---|---|---|
committer | Kevin Bowling <kbowling@FreeBSD.org> | 2021-08-11 01:54:00 +0000 |
commit | f45271340836769d53320d6dbcf63226bb4e39e3 (patch) | |
tree | fc726f897cafa42eb7a3772b8e32a417a551e0cd /sys/netipsec/keysock.c | |
parent | 76aa36ab4853eac6e6f5d2617323872a62b80b46 (diff) |
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
(cherry picked from commit 7045b1603bdf054145dd958a4acc17b410fb62a0)
Diffstat (limited to 'sys/netipsec/keysock.c')
-rw-r--r-- | sys/netipsec/keysock.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/netipsec/keysock.c b/sys/netipsec/keysock.c index 317eb53289cf..aa893b131a57 100644 --- a/sys/netipsec/keysock.c +++ b/sys/netipsec/keysock.c @@ -141,7 +141,6 @@ end: static int key_sendup0(struct rawcb *rp, struct mbuf *m, int promisc) { - int error; if (promisc) { struct sadb_msg *pmsg; @@ -165,11 +164,12 @@ key_sendup0(struct rawcb *rp, struct mbuf *m, int promisc) m, NULL)) { PFKEYSTAT_INC(in_nomem); m_freem(m); - error = ENOBUFS; - } else - error = 0; + soroverflow(rp->rcb_socket); + return ENOBUFS; + } + sorwakeup(rp->rcb_socket); - return error; + return 0; } /* so can be NULL if target != KEY_SENDUP_ONE */ |