git: c4b44adcf0b6 - main - sctp: Remove special handling for a listen(2) backlog of 0

Mark Johnston markj at FreeBSD.org
Tue Sep 7 21:12:39 UTC 2021


The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=c4b44adcf0b631eb2d4187f285ed37cf4ce1caff

commit c4b44adcf0b631eb2d4187f285ed37cf4ce1caff
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-09-07 18:51:19 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-09-07 21:12:09 +0000

    sctp: Remove special handling for a listen(2) backlog of 0
    
    ... when applied to one-to-one-style sockets.  sctp_listen() cannot be
    used to toggle the listening state of such a socket.  See RFC 6458's
    description of expected listen(2) semantics for one-to-one- and
    one-to-many-style sockets.
    
    Reviewed by:    tuexen
    MFC after:      1 month
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D31774
---
 sys/netinet/sctp_usrreq.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 76d73a11304a..516e58753163 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -7249,14 +7249,16 @@ sctp_listen(struct socket *so, int backlog, struct thread *p)
 	}
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) == 0) {
 		solisten_proto(so, backlog);
-	} else {
-		solisten_proto_abort(so);
-	}
-	SOCK_UNLOCK(so);
-	if (backlog > 0) {
+		SOCK_UNLOCK(so);
 		inp->sctp_flags |= SCTP_PCB_FLAGS_ACCEPTING;
 	} else {
-		inp->sctp_flags &= ~SCTP_PCB_FLAGS_ACCEPTING;
+		solisten_proto_abort(so);
+		SOCK_UNLOCK(so);
+		if (backlog > 0) {
+			inp->sctp_flags |= SCTP_PCB_FLAGS_ACCEPTING;
+		} else {
+			inp->sctp_flags &= ~SCTP_PCB_FLAGS_ACCEPTING;
+		}
 	}
 out:
 	SCTP_INP_WUNLOCK(inp);


More information about the dev-commits-src-main mailing list