git: 01235012e5b1 - main - unix/dgram: uipc_listen() is specific for SOCK_STREAM and SOCK_SEQPACKET

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Thu, 12 May 2022 18:05:19 UTC
The branch main has been updated by glebius:

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

commit 01235012e5b14e01181151309d690c7436cb8c53
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-05-12 18:04:40 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-05-12 18:04:40 +0000

    unix/dgram: uipc_listen() is specific for SOCK_STREAM and SOCK_SEQPACKET
    
    Rely on pr_usrreqs_init() to init SOCK_DGRAM to pru_listen_notsupp().
---
 sys/kern/uipc_usrreq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 85207416b356..efa586d346c5 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -872,8 +872,7 @@ uipc_listen(struct socket *so, int backlog, struct thread *td)
 	struct unpcb *unp;
 	int error;
 
-	if (so->so_type != SOCK_STREAM && so->so_type != SOCK_SEQPACKET)
-		return (EOPNOTSUPP);
+	MPASS(so->so_type != SOCK_DGRAM);
 
 	/*
 	 * Synchronize with concurrent connection attempts.
@@ -1312,7 +1311,6 @@ static struct pr_usrreqs uipc_usrreqs_dgram = {
 	.pru_connect2 =		uipc_connect2,
 	.pru_detach =		uipc_detach,
 	.pru_disconnect =	uipc_disconnect,
-	.pru_listen =		uipc_listen,
 	.pru_peeraddr =		uipc_peeraddr,
 	.pru_send =		uipc_send,
 	.pru_sense =		uipc_sense,