git: 03c3a70abe5e - main - udplite: make socketoption available on IPv6 sockets
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 05 Nov 2023 14:31:47 UTC
The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=03c3a70abe5e9fa259b954de78ae69229fa9c99f commit 03c3a70abe5e9fa259b954de78ae69229fa9c99f Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2023-11-05 14:28:54 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2023-11-05 14:28:54 +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 --- sys/netinet/udp_usrreq.c | 8 ++++++++ sys/netinet6/udp6_usrreq.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) 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, \