diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-06-14 17:00:59 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-06-14 17:00:59 +0000 |
commit | 27a5008cc2bc7e86b58eda8d6a8e0f59e8272a32 (patch) | |
tree | d58816d9f754ecc785935791a6bca5a40671d4a6 /sys/netinet | |
parent | d4abb587047c245f1df252f7555212e191e790c4 (diff) |
Assert that the INP_IPV6 in in6_pcbconnect() is correct. Just call
in_pcbconnect() to avoid the address family maze in syn_cache_get().
input claudio@; OK mpi@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/in_pcb.c | 5 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 26 |
2 files changed, 6 insertions, 25 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 5a50b4108e6..9c3eeefec75 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.237 2018/06/11 08:57:35 mpi Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.238 2018/06/14 17:00:57 bluhm Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -511,8 +511,7 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam) #ifdef INET6 if (sotopf(inp->inp_socket) == PF_INET6) return (in6_pcbconnect(inp, nam)); - if ((inp->inp_flags & INP_IPV6) != 0) - panic("IPv6 pcb passed into in_pcbconnect"); + KASSERT((inp->inp_flags & INP_IPV6) == 0); #endif /* INET6 */ if ((error = in_nam2sin(nam, &sin))) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 25795a1155c..e1fdee67feb 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.356 2018/06/11 07:40:26 bluhm Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.357 2018/06/14 17:00:57 bluhm Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -3537,27 +3537,9 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, goto resetandabort; am->m_len = src->sa_len; memcpy(mtod(am, caddr_t), src, src->sa_len); - - switch (src->sa_family) { - case AF_INET: - /* drop IPv4 packet to AF_INET6 socket */ - if (inp->inp_flags & INP_IPV6) { - (void) m_free(am); - goto resetandabort; - } - if (in_pcbconnect(inp, am)) { - (void) m_free(am); - goto resetandabort; - } - break; -#ifdef INET6 - case AF_INET6: - if (in6_pcbconnect(inp, am)) { - (void) m_free(am); - goto resetandabort; - } - break; -#endif + if (in_pcbconnect(inp, am)) { + (void) m_free(am); + goto resetandabort; } (void) m_free(am); |