git: 7b8151b0cd1b - main - sctp: improve handling of SO_SETFIB socket option
Date: Mon, 26 Oct 2026 19:19:04 UTC
The branch main has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=7b8151b0cd1b4f077b382b6be2c02c936d1988fa
commit 7b8151b0cd1b4f077b382b6be2c02c936d1988fa
Author: Albin Hellqvist <albin.hellqvist@ericsson.com>
AuthorDate: 2026-10-26 19:07:03 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2026-10-26 19:07:03 +0000
sctp: improve handling of SO_SETFIB socket option
Since SCTP keeps fibnum in the SCTP protocol control block,
the code can't just defer the processing to the IPv4 or IPv6
layer. Therefore it needs to be implemented in the the SCTP
layer and it needs to call the socket layer function.
PR: 300091
Reviewed by: tuexen
Fixes: caccbaef8e26 ("socket: Move SO_SETFIB handling to protocol layers")
MFC after: 3 days
MFC to: stable/14
MFC to: stable/15
---
sys/netinet/sctp_usrreq.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 4345c0cc6326..1c53d07b9e6c 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -6877,15 +6877,23 @@ sctp_ctloutput(struct socket *so, struct sockopt *sopt)
if ((sopt->sopt_level == SOL_SOCKET) &&
(sopt->sopt_name == SO_SETFIB)) {
+ int optval;
+
+ error = sooptcopyin(sopt, &optval, sizeof(optval),
+ sizeof(optval));
+ if (error != 0)
+ return (error);
inp = (struct sctp_inpcb *)so->so_pcb;
if (inp == NULL) {
SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOBUFS);
return (EINVAL);
}
SCTP_INP_WLOCK(inp);
- inp->fibnum = so->so_fibnum;
+ error = sosetfib(so, optval);
+ if (error == 0)
+ inp->fibnum = optval;
SCTP_INP_WUNLOCK(inp);
- return (0);
+ return (error);
}
if (sopt->sopt_level != IPPROTO_SCTP) {
/* wrong proto level... send back up to IP */