aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2023-11-05 14:28:54 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2023-11-05 14:28:54 +0000
commit03c3a70abe5e9fa259b954de78ae69229fa9c99f (patch)
tree6895bdddd7cb8f78c2288fb697be42708625984c
parentb10ae5a9b21aa11e96a1951ccc4525dd1fdb60b3 (diff)
downloadsrc-03c3a70abe5e9fa259b954de78ae69229fa9c99f.tar.gz
src-03c3a70abe5e9fa259b954de78ae69229fa9c99f.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
-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 a96ec22c5992..069cd8623464 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 4e69608b71de..068b9e7095a9 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -1244,7 +1244,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, \