diff options
author | ume <ume@FreeBSD.org> | 2006-02-02 11:46:05 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2006-02-02 11:46:05 +0000 |
commit | bd1c5824b3f968a41c82dab2523d66726224e973 (patch) | |
tree | 4d2ac3c3cd1e3cf8e995406e803197e63452c2b1 /sys/netinet6 | |
parent | 6eef1325305dbfae9dc6a898875c9d69dfb0b407 (diff) | |
download | FreeBSD-src-bd1c5824b3f968a41c82dab2523d66726224e973.zip FreeBSD-src-bd1c5824b3f968a41c82dab2523d66726224e973.tar.gz |
make IPV6_V6ONLY socket option work for UDP as well.
PR: ports/92620
Reported by: Kurt Miller <kurt__at__intricatesoftware.com>
MFC after: 1 week
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/udp6_usrreq.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index b8ca0fe..8cacd44 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -549,7 +549,7 @@ udp6_attach(struct socket *so, int proto, struct thread *td) INP_LOCK(inp); INP_INFO_WUNLOCK(&udbinfo); inp->inp_vflag |= INP_IPV6; - if (!ip6_v6only) + if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) inp->inp_vflag |= INP_IPV4; inp->in6p_hops = -1; /* use kernel default */ inp->in6p_cksum = -1; /* just to be sure */ @@ -653,7 +653,8 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) error = in6_pcbconnect(inp, nam, td->td_ucred); splx(s); if (error == 0) { - if (!ip6_v6only) { /* should be non mapped addr */ + if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { + /* should be non mapped addr */ inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; } @@ -754,7 +755,7 @@ udp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, } #ifdef INET - if (!ip6_v6only) { + if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { int hasv4addr; struct sockaddr_in6 *sin6 = 0; @@ -768,15 +769,6 @@ udp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, if (hasv4addr) { struct pr_usrreqs *pru; - if ((inp->inp_flags & IN6P_IPV6_V6ONLY)) { - /* - * since a user of this socket set the - * IPV6_V6ONLY flag, we discard this - * datagram destined to a v4 addr. - */ - error = EINVAL; - goto out; - } if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && !IN6_IS_ADDR_V4MAPPED(&inp->in6p_laddr)) { /* |