aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2023-11-05 14:28:54 +0000
committerEd Maste <emaste@FreeBSD.org>2024-01-11 01:22:52 +0000
commita4925f0f8cf76c32140d7c2077aa9628de20630f (patch)
treebb1e481fe5a119ecb7a6460ea96b7edddc5fe7a5
parent3a89a5d54daa4d044b3f2b36c44f72c3333e3284 (diff)
downloadsrc-a4925f0f8cf76c32140d7c2077aa9628de20630f.tar.gz
src-a4925f0f8cf76c32140d7c2077aa9628de20630f.zip
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)
-rw-r--r--sys/netinet/udp_usrreq.c8
-rw-r--r--sys/netinet6/udp6_usrreq.c2
2 files changed, 9 insertions, 1 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 4ea0efad3491..7329600ecc79 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -897,6 +897,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);
@@ -944,6 +948,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);
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index 35d68e164145..c8b38c24d193 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -1243,7 +1243,7 @@ udp6_disconnect(struct socket *so)
#define UDP6_PROTOSW \
.pr_type = SOCK_DGRAM, \
.pr_flags = PR_ATOMIC|PR_ADDR|PR_CAPATTACH, \
- .pr_ctloutput = ip6_ctloutput, \
+ .pr_ctloutput = udp_ctloutput, \
.pr_abort = udp6_abort, \
.pr_attach = udp6_attach, \
.pr_bind = udp6_bind, \