aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2017-05-22 15:29:10 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2017-05-22 15:29:10 +0000
commit5dba6ada91ba4a38d183007270f4a5f73bcea40c (patch)
tree9cdb902e1b40d61c52904d8ac48e23511e785207 /sys/netinet/tcp_usrreq.c
parent9b8d05b8ac78509e8c4b9f6f1e71c873b38a06b9 (diff)
Notes
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 77c704186522..f0251290367c 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -597,6 +597,10 @@ tcp6_usr_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;
+ }
in6_sin6_2_sin(&sin, sin6p);
inp->inp_vflag |= INP_IPV4;
@@ -614,6 +618,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
#endif
error = tp->t_fb->tfb_tcp_output(tp);
goto out;
+ } else {
+ if ((inp->inp_vflag & INP_IPV6) == 0) {
+ error = EAFNOSUPPORT;
+ goto out;
+ }
}
#endif
inp->inp_vflag &= ~INP_IPV4;