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:		caccbaef8e ("socket: Move SO_SETFIB handling to protocol layers")
MFC after:	3 days
MFC to:		stable/14
MFC to:		stable/15
This commit is contained in:
Albin Hellqvist authored and Michael Tuexen committed 2026-10-26 20:07:03 +01:00
1 parent 9a4bb77040
commit 7b8151b0cd
1 file changed
+10 -2
+10 -2
View File
@@ -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 */