From: Alexander Bluhm Subject: connect in parallel To: tech@openbsd.org Date: Tue, 2 Jan 2024 13:26:01 +0100 Hi, I think it is time to run connect(2) in parallel. This unlocks soconnect() for udp, rip, rip6 and divert. ok? bluhm Index: kern/uipc_syscalls.c =================================================================== RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_syscalls.c,v diff -u -p -r1.215 uipc_syscalls.c --- kern/uipc_syscalls.c 18 Dec 2023 13:11:20 -0000 1.215 +++ kern/uipc_syscalls.c 2 Jan 2024 11:46:55 -0000 @@ -409,7 +409,7 @@ sys_connect(struct proc *p, void *v, reg if (KTRPOINT(p, KTR_STRUCT)) ktrsockaddr(p, mtod(nam, caddr_t), SCARG(uap, namelen)); #endif - solock(so); + solock_shared(so); if (isdnssocket(so)) { error = dns_portcheck(p, so, mtod(nam, void *), nam->m_len); if (error) @@ -443,7 +443,7 @@ bad: if (!interrupted) so->so_state &= ~SS_ISCONNECTING; unlock: - sounlock(so); + sounlock_shared(so); m_freem(nam); out: FRELE(fp, p); Index: netinet/in_pcb.h =================================================================== RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in_pcb.h,v diff -u -p -r1.146 in_pcb.h --- netinet/in_pcb.h 1 Jan 2024 22:16:51 -0000 1.146 +++ netinet/in_pcb.h 2 Jan 2024 11:46:55 -0000 @@ -83,6 +83,7 @@ * y inpt_notify pcb table rwlock for notify * p inpcb_mtx pcb mutex * L pf_inp_mtx link pf to inp mutex + * s so_lock socket rwlock */ /* @@ -194,7 +195,7 @@ struct inpcb { void *inp_upcall_arg; u_int inp_rtableid; /* [t] */ int inp_pipex; /* pipex indication */ - uint16_t inp_flowid; + uint16_t inp_flowid; /* [s] */ }; LIST_HEAD(inpcbhead, inpcb);