CVSROOT: /cvs Module name: src Changes by: bl...@cvs.openbsd.org 2025/06/03 10:51:26
Modified files: sys/kern : kern_sysctl.c sys/netinet : in_pcb.c in_pcb.h tcp_input.c tcp_subr.c tcp_timer.c tcp_usrreq.c udp_usrreq.c sys/netinet6 : in6_pcb.c Log message: Reference count the socket within internet PCB. Instead of protecting inp_socket with special mutex when being freed and reference counting in in_pcbsolock_ref(), better reference count inp_socket. When an inpcb is created, inp_socket is initialized with a socket pointer that is reference counted. When the inpcb is freed, release the socket reference. As incpb is reference counted itself, we can always access the socket memory when we have a valid inpcb counter. in_pcbsolock() can just lock the socket, no reference counting is needed. This reduces contention a bit. As in_pcbdetach() is protected by socket lock, in_pcbsolock() has to check so_pcb while holding the lock to skip sockets that are being closed. OK mvs@