diff options
Diffstat (limited to 'sys/netinet6/udp6_usrreq.c')
-rw-r--r-- | sys/netinet6/udp6_usrreq.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index cc10527..56faf5a 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -1104,6 +1104,10 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) error = EINVAL; goto out; } + if ((inp->inp_vflag & INP_IPV4) == 0) { + error = EAFNOSUPPORT; + goto out; + } if (inp->inp_faddr.s_addr != INADDR_ANY) { error = EISCONN; goto out; @@ -1121,6 +1125,11 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) if (error == 0) soisconnected(so); goto out; + } else { + if ((inp->inp_vflag & INP_IPV6) == 0) { + error = EAFNOSUPPORT; + goto out; + } } #endif if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { |