git: socket: introduce SO_RERROR to detect receive buffer overflow

Roy Marples roy at crater.dragonflybsd.org
Tue Aug 6 17:51:19 PDT 2019


commit 7eaeff3d5b7170299f570487da1da8a4e87ab072
Author: Roy Marples <roy at marples.name>
Date:   Wed Aug 7 01:48:21 2019 +0100

    socket: introduce SO_RERROR to detect receive buffer overflow
    
    kernel receive buffers are initially of a limited size and
    generally the network protocols that use them don't care
    if a packet gets lost.
    
    However some users do care about lost messages even if not
    baked into the protocol - such as consumers of route(4) to
    track state.
    
    POSIX states that read(2) can return an error of ENOBUFS so
    return this error code when an overflow is detected.
    Guard this with socket option SO_RERROR so that existing
    applications which do not care can carry on not caring by
    default.
    
    Taken-from: NetBSD
    Reviewed-by: sephe

Summary of changes:
 lib/libc/sys/getsockopt.2       | 10 +++++++++-
 sys/kern/uipc_socket.c          | 31 +++++++++++++++++++++++--------
 sys/kern/uipc_socket2.c         | 13 +++++++++++++
 sys/net/ip_mroute/ip_mroute.c   |  4 +++-
 sys/net/raw_usrreq.c            |  7 ++++---
 sys/netgraph/socket/ng_socket.c |  2 ++
 sys/netinet/ip_divert.c         |  5 +++--
 sys/netinet/raw_ip.c            |  3 ++-
 sys/netinet/udp_usrreq.c        |  1 +
 sys/netinet6/icmp6.c            |  3 ++-
 sys/netinet6/ip6_mroute.c       |  3 ++-
 sys/netinet6/raw_ip6.c          |  2 ++
 sys/netinet6/udp6_usrreq.c      |  3 +++
 sys/sys/socket.h                |  1 +
 sys/sys/socketvar.h             |  2 ++
 15 files changed, 72 insertions(+), 18 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/7eaeff3d5b7170299f570487da1da8a4e87ab072


-- 
DragonFly BSD source repository


More information about the Commits mailing list