sockets: garbage collect SS_ISCONFIRMING

Fixes:	8df32b19de
This commit is contained in:
Gleb Smirnoff 2024-01-30 10:09:48 -08:00
parent fae467c221
commit f79a8585bb
9 changed files with 9 additions and 23 deletions

View file

@ -56,7 +56,7 @@ sock_getname(struct socket *so, struct sockaddr *sa, int *sockaddr_len,
* length. Such notion doesn't even exist in Linux KPI.
*/
if (peer) {
if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0)
if ((so->so_state & SS_ISCONNECTED) == 0)
return (-ENOTCONN);
error = so->so_proto->pr_peeraddr(so, sa);

View file

@ -176,10 +176,6 @@ db_print_sostate(short so_state)
db_printf("%sSS_ASYNC", comma ? ", " : "");
comma = 1;
}
if (so_state & SS_ISCONFIRMING) {
db_printf("%sSS_ISCONFIRMING", comma ? ", " : "");
comma = 1;
}
}
static void

View file

@ -792,7 +792,7 @@ solisten_clone(struct socket *head)
return (so);
}
/* Connstatus may be 0, or SS_ISCONFIRMING, or SS_ISCONNECTED. */
/* Connstatus may be 0 or SS_ISCONNECTED. */
struct socket *
sonewconn(struct socket *head, int connstatus)
{
@ -1516,8 +1516,7 @@ sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio,
*/
if ((so->so_proto->pr_flags & PR_CONNREQUIRED) &&
(so->so_proto->pr_flags & PR_IMPLOPCL) == 0) {
if ((so->so_state & SS_ISCONFIRMING) == 0 &&
!(resid == 0 && clen != 0)) {
if (!(resid == 0 && clen != 0)) {
SOCKBUF_UNLOCK(&so->so_snd);
error = ENOTCONN;
goto out;
@ -1725,8 +1724,7 @@ sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio,
*/
if ((so->so_proto->pr_flags & PR_CONNREQUIRED) &&
(so->so_proto->pr_flags & PR_IMPLOPCL) == 0) {
if ((so->so_state & SS_ISCONFIRMING) == 0 &&
!(resid == 0 && clen != 0)) {
if (!(resid == 0 && clen != 0)) {
SOCKBUF_UNLOCK(&so->so_snd);
error = ENOTCONN;
goto release;
@ -2068,11 +2066,6 @@ soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio,
return (soreceive_rcvoob(so, uio, flags));
if (mp != NULL)
*mp = NULL;
if ((pr->pr_flags & PR_WANTRCVD) && (so->so_state & SS_ISCONFIRMING)
&& uio->uio_resid) {
VNET_SO_ASSERT(so);
pr->pr_rcvd(so, 0);
}
error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags));
if (error)
@ -3862,7 +3855,7 @@ soisconnected(struct socket *so)
bool last __diagused;
SOCK_LOCK(so);
so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING);
so->so_state |= SS_ISCONNECTED;
if (so->so_qstate == SQ_INCOMP) {

View file

@ -1412,7 +1412,7 @@ kern_getpeername(struct thread *td, int fd, struct sockaddr *sa)
if (error != 0)
return (error);
so = fp->f_data;
if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) {
if ((so->so_state & SS_ISCONNECTED) == 0) {
error = ENOTCONN;
goto done;
}

View file

@ -782,8 +782,7 @@ ng_ksocket_rcvmsg(node_p node, item_p item, hook_p lasthook)
/* Get function */
if (msg->header.cmd == NGM_KSOCKET_GETPEERNAME) {
if ((so->so_state
& (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0)
if ((so->so_state & SS_ISCONNECTED) == 0)
ERROUT(ENOTCONN);
func = sopeeraddr;
} else

View file

@ -4851,7 +4851,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
SOCKBUF_LOCK(&so->so_rcv);
so->so_state &= ~(SS_ISCONNECTING |
SS_ISDISCONNECTING |
SS_ISCONFIRMING |
SS_ISCONNECTED);
so->so_state |= SS_ISDISCONNECTED;
socantrcvmore_locked(so);

View file

@ -5654,7 +5654,6 @@ sctp_sorecvmsg(struct socket *so,
}
so->so_state &= ~(SS_ISCONNECTING |
SS_ISDISCONNECTING |
SS_ISCONFIRMING |
SS_ISCONNECTED);
if (error == 0) {
if ((inp->sctp_flags & SCTP_PCB_FLAGS_WAS_CONNECTED) == 0) {

View file

@ -153,7 +153,7 @@ clnt_vc_create(
ct->ct_upcallrefs = 0;
ct->ct_rcvstate = RPCRCVSTATE_NORMAL;
if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) {
if ((so->so_state & SS_ISCONNECTED) == 0) {
error = soconnect(so, raddr, curthread);
SOCK_LOCK(so);
interrupted = 0;

View file

@ -211,7 +211,7 @@ struct socket {
#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */
#define SS_NBIO 0x0100 /* non-blocking ops */
#define SS_ASYNC 0x0200 /* async i/o notify */
#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */
/* was SS_ISCONFIRMING 0x0400 */
#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
#ifdef _KERNEL