summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2013-04-02 18:27:46 +0000
committerbluhm <bluhm@openbsd.org>2013-04-02 18:27:46 +0000
commitfaff72426c3829a1ac8d12a6f45ec88e24dd9fd9 (patch)
tree38df231aa48629f79da7d7e345545db887e0686b /sys/netinet/tcp_input.c
parentbetter implementation for tcp_read() that can get the packet length in (diff)
downloadwireguard-openbsd-faff72426c3829a1ac8d12a6f45ec88e24dd9fd9.tar.xz
wireguard-openbsd-faff72426c3829a1ac8d12a6f45ec88e24dd9fd9.zip
Use macros sotoinpcb() and intotcpcb() instead of casts. Use NULL
instead of 0 for pointers. No binary change. OK mpi@
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index e3dba6a0cda..a98381ebb03 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.258 2013/03/29 13:16:14 bluhm Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.259 2013/04/02 18:27:47 bluhm Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -360,7 +360,7 @@ tcp_input(struct mbuf *m, ...)
u_int8_t *optp = NULL;
int optlen = 0;
int tlen, off;
- struct tcpcb *tp = 0;
+ struct tcpcb *tp = NULL;
int tiflags;
struct socket *so = NULL;
int todrop, acked, ourfinisacked;
@@ -764,7 +764,7 @@ findpcb:
* full-blown connection.
*/
tp = NULL;
- inp = (struct inpcb *)so->so_pcb;
+ inp = sotoinpcb(so);
tp = intotcpcb(inp);
if (tp == NULL)
goto badsyn; /*XXX*/
@@ -3657,7 +3657,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 tcpcb *tp = 0;
+ struct tcpcb *tp = NULL;
struct mbuf *am;
int s;
struct socket *oso;
@@ -3708,7 +3708,7 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
* IPsec-related information.
*/
{
- struct inpcb *newinp = (struct inpcb *)so->so_pcb;
+ struct inpcb *newinp = sotoinpcb(so);
bcopy(inp->inp_seclevel, newinp->inp_seclevel,
sizeof(inp->inp_seclevel));
newinp->inp_secrequire = inp->inp_secrequire;
@@ -3736,7 +3736,7 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
int flags = inp->inp_flags;
struct inpcb *oldinpcb = inp;
- inp = (struct inpcb *)so->so_pcb;
+ inp = sotoinpcb(so);
inp->inp_flags |= (flags & INP_IPV6);
if ((inp->inp_flags & INP_IPV6) != 0) {
inp->inp_ipv6.ip6_hlim =
@@ -3744,7 +3744,7 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
}
}
#else /* INET6 */
- inp = (struct inpcb *)so->so_pcb;
+ inp = sotoinpcb(so);
#endif /* INET6 */
#if NPF > 0