git: fee67650e0f5 - releng/15.1 - sctp: fix NOINET build

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Thu, 21 May 2026 21:21:52 UTC
The branch releng/15.1 has been updated by cperciva:

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

commit fee67650e0f5d2e1fe2f14ab0d8a1b96c7a7cc61
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-02-27 07:51:29 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-05-21 21:20:55 +0000

    sctp: fix NOINET build
    
    Approved by:    re (cperciva)
    Reported by:            ngie
    Fixes:                  454212b9718b ("sctp: fix so_proto when peeling off a socket")
    
    (cherry picked from commit 6bd97e9e01ff159eef49b2521fdbe67d5db10d95)
    (cherry picked from commit 9c440e552c4cc252fe150b5f0edef9b8cd75a72f)
---
 sys/netinet/sctp_syscalls.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/sctp_syscalls.c b/sys/netinet/sctp_syscalls.c
index 79c1dfb21495..da7d0556a809 100644
--- a/sys/netinet/sctp_syscalls.c
+++ b/sys/netinet/sctp_syscalls.c
@@ -30,6 +30,8 @@
 
 #include <sys/cdefs.h>
 #include "opt_capsicum.h"
+#include "opt_inet.h"
+#include "opt_inet6.h"
 #include "opt_sctp.h"
 #include "opt_ktrace.h"
 
@@ -78,6 +80,9 @@
 #include <netinet/sctp.h>
 #include <netinet/sctp_pcb.h>
 #include <netinet/sctp_var.h>
+#ifdef INET6
+#include <netinet6/sctp6_var.h>
+#endif
 #include <netinet/sctp_os_bsd.h>
 #include <netinet/sctp_peeloff.h>
 
@@ -174,7 +179,21 @@ sys_sctp_peeloff(struct thread *td, struct sctp_peeloff_args *uap)
 	td->td_retval[0] = fd;
 
 	CURVNET_SET(head->so_vnet);
-	so = sopeeloff(head, &sctp_stream_protosw);
+	switch (head->so_proto->pr_domain->dom_family) {
+#ifdef INET
+	case AF_INET:
+		so = sopeeloff(head, &sctp_stream_protosw);
+		break;
+#endif
+#ifdef INET6
+	case AF_INET6:
+		so = sopeeloff(head, &sctp6_stream_protosw);
+		break;
+#endif
+	default:
+		error = EOPNOTSUPP;
+		goto noconnection;
+	}
 	if (so == NULL) {
 		error = ENOMEM;
 		goto noconnection;