git: 3b766249d9f0 - stable/13 - udplite: make socketoption available on IPv6 sockets
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Jan 2024 17:50:49 UTC
The branch stable/13 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=3b766249d9f04a4cb8d9d44c98853611e02bfd6d
commit 3b766249d9f04a4cb8d9d44c98853611e02bfd6d
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2023-11-05 14:28:54 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-01-12 17:35:25 +0000
udplite: make socketoption available on IPv6 sockets
This patch allows the IPPROTO_UDPLITE-level socket options
UDPLITE_SEND_CSCOV and UDPLITE_RECV_CSCOV to be used on
AF_INET6 sockets in addition to AF_INET sockets.
Reviewed by: ae, rscheff
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42430
(cherry picked from commit 03c3a70abe5e9fa259b954de78ae69229fa9c99f)
---
sys/netinet/udp_usrreq.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index ea9ff161e429..c868bf777103 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1009,6 +1009,10 @@ udp_ctloutput(struct socket *so, struct sockopt *sopt)
#if defined(IPSEC) || defined(IPSEC_SUPPORT)
#ifdef INET
case UDP_ENCAP:
+ if (!INP_CHECK_SOCKAF(so, AF_INET)) {
+ INP_WUNLOCK(inp);
+ return (EINVAL);
+ }
if (!IPSEC_ENABLED(ipv4)) {
INP_WUNLOCK(inp);
return (ENOPROTOOPT);
@@ -1056,6 +1060,10 @@ udp_ctloutput(struct socket *so, struct sockopt *sopt)
#if defined(IPSEC) || defined(IPSEC_SUPPORT)
#ifdef INET
case UDP_ENCAP:
+ if (!INP_CHECK_SOCKAF(so, AF_INET)) {
+ INP_WUNLOCK(inp);
+ return (EINVAL);
+ }
if (!IPSEC_ENABLED(ipv4)) {
INP_WUNLOCK(inp);
return (ENOPROTOOPT);