diff options
author | 2016-06-27 12:25:27 +0000 | |
---|---|---|
committer | 2016-06-27 12:25:27 +0000 | |
commit | 3de4c66a28621a05b46c9c6f843828c67a9ecf0d (patch) | |
tree | 296087fc0141635a6e167ba35a917d4151d56c32 /sys/netinet/tcp_input.c | |
parent | add ure(4), a driver for Realtek RTL8152 10/100 USB Ethernet adapters, (diff) | |
download | wireguard-openbsd-3de4c66a28621a05b46c9c6f843828c67a9ecf0d.tar.xz wireguard-openbsd-3de4c66a28621a05b46c9c6f843828c67a9ecf0d.zip |
The variable swapping between inp, newinp and oldinpcb in syn_cache_get()
was overly complicated. Simplify the code without functional change.
OK jca@
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r-- | sys/netinet/tcp_input.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index afe5c807a85..5c778028e19 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.319 2016/06/09 23:09:51 bluhm Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.320 2016/06/27 12:25:27 bluhm Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -3627,7 +3627,7 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, { struct syn_cache *sc; struct syn_cache_head *scp; - struct inpcb *inp = NULL; + struct inpcb *inp, *oldinp; struct tcpcb *tp = NULL; struct mbuf *am; int s; @@ -3670,7 +3670,8 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, if (so == NULL) goto resetandabort; - inp = sotoinpcb(oso); + oldinp = sotoinpcb(oso); + inp = sotoinpcb(so); #ifdef IPSEC /* @@ -3678,30 +3679,18 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, * from the old pcb. Ditto for any other * IPsec-related information. */ - { - struct inpcb *newinp = sotoinpcb(so); - memcpy(newinp->inp_seclevel, inp->inp_seclevel, - sizeof(inp->inp_seclevel)); - } + memcpy(inp->inp_seclevel, oldinp->inp_seclevel, + sizeof(oldinp->inp_seclevel)); #endif /* IPSEC */ #ifdef INET6 /* * inp still has the OLD in_pcb stuff, set the * v6-related flags on the new guy, too. */ - { - int flags = inp->inp_flags; - struct inpcb *oldinpcb = inp; - - inp = sotoinpcb(so); - inp->inp_flags |= (flags & INP_IPV6); - if ((inp->inp_flags & INP_IPV6) != 0) { - inp->inp_ipv6.ip6_hlim = - oldinpcb->inp_ipv6.ip6_hlim; - } + inp->inp_flags |= (oldinp->inp_flags & INP_IPV6); + if (inp->inp_flags & INP_IPV6) { + inp->inp_ipv6.ip6_hlim = oldinp->inp_ipv6.ip6_hlim; } -#else /* INET6 */ - inp = sotoinpcb(so); #endif /* INET6 */ #if NPF > 0 |