CVSROOT: /cvs Module name: src Changes by: bl...@cvs.openbsd.org 2025/06/18 10:15:46
Modified files: sys/netinet : tcp_input.c tcp_var.h udp_usrreq.c usr.bin/netstat: inet.c Log message: Handle sockets that are closing in parallel. After unlocking, sockets may close on one CPU while others are processing packets. For TCP the socket lock prevents this. Add a netstat counter for dropped packets if an inpcb has no associated socket after the lock has been acquired. UDP, raw IP, and divert sockets rely only on reference count. They do not take socket lock as they have little state to protect and want to avoid the performance penalty. This means that inp->inp_socket->so_pcb can become NULL anytime. Remove a kassert that checks this value. All other parts of the socket are either read only or protected by mutex. Sockets may still receive data into socket buffer while the socket is closing. After releasing all references, sorele() calls m_purge() and has to deal with it. OK mvs@