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
This commit is contained in:
Michael Tuexen 2023-11-05 15:28:54 +01:00
parent b10ae5a9b2
commit 03c3a70abe
2 changed files with 9 additions and 1 deletions

View file

@ -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);

View file

@ -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, \