summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/in_pcb.c4
-rw-r--r--sys/netinet/ip_divert.c4
-rw-r--r--sys/netinet/raw_ip.c4
-rw-r--r--sys/netinet/tcp_input.c14
-rw-r--r--sys/netinet/tcp_subr.c8
-rw-r--r--sys/netinet/udp_usrreq.c9
-rw-r--r--sys/netinet6/ip6_divert.c4
7 files changed, 23 insertions, 24 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 3b67f7fcfd2..30ee8166062 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.135 2013/03/31 11:18:35 bluhm Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.136 2013/04/02 18:27:46 bluhm Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -657,7 +657,7 @@ struct inpcb *
in_pcblookup(struct inpcbtable *table, void *faddrp, u_int fport_arg,
void *laddrp, u_int lport_arg, int flags, u_int rdomain)
{
- struct inpcb *inp, *match = 0;
+ struct inpcb *inp, *match = NULL;
int matchwild = 3, wildcard;
u_int16_t fport = fport_arg, lport = lport_arg;
struct in_addr faddr = *(struct in_addr *)faddrp;
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index fdb8fa86aee..463d9ef8bcf 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.c,v 1.11 2013/03/28 16:45:16 tedu Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.12 2013/04/02 18:27:47 bluhm Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -244,7 +244,7 @@ divert_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
error = soreserve(so, divert_sendspace, divert_recvspace);
if (error)
break;
- ((struct inpcb *) so->so_pcb)->inp_flags |= INP_HDRINCL;
+ sotoinpcb(so)->inp_flags |= INP_HDRINCL;
break;
case PRU_DETACH:
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 4f3bbc95285..dfd498b12c7 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.64 2013/03/31 11:18:35 bluhm Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.65 2013/04/02 18:27:47 bluhm Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -431,7 +431,7 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
break;
}
splx(s);
- inp = (struct inpcb *)so->so_pcb;
+ inp = sotoinpcb(so);
inp->inp_ip.ip_p = (long)nam;
break;
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
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 285a510e9e4..9954687ff55 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.116 2013/03/28 23:10:06 tedu Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.117 2013/04/02 18:27:47 bluhm Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -459,7 +459,7 @@ tcp_newtcpcb(struct inpcb *inp)
tp = pool_get(&tcpcb_pool, PR_NOWAIT|PR_ZERO);
if (tp == NULL)
- return ((struct tcpcb *)0);
+ return (NULL);
TAILQ_INIT(&tp->t_segq);
tp->t_maxseg = tcp_mssdflt;
tp->t_maxopd = 0;
@@ -576,7 +576,7 @@ tcp_close(struct tcpcb *tp)
inp->inp_ppcb = 0;
soisdisconnected(so);
in_pcbdetach(inp);
- return ((struct tcpcb *)0);
+ return (NULL);
}
void
@@ -629,7 +629,7 @@ tcp_notify(inp, error)
struct inpcb *inp;
int error;
{
- struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb;
+ struct tcpcb *tp = intotcpcb(inp);
struct socket *so = inp->inp_socket;
/*
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index f5c1c094c94..6aa01777569 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.157 2013/03/31 11:18:35 bluhm Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.158 2013/04/02 18:27:47 bluhm Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -1160,12 +1160,11 @@ udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
}
splx(s);
#ifdef INET6
- if (((struct inpcb *)so->so_pcb)->inp_flags & INP_IPV6)
- ((struct inpcb *) so->so_pcb)->inp_ipv6.ip6_hlim =
- ip6_defhlim;
+ if (sotoinpcb(so)->inp_flags & INP_IPV6)
+ sotoinpcb(so)->inp_ipv6.ip6_hlim = ip6_defhlim;
else
#endif /* INET6 */
- ((struct inpcb *) so->so_pcb)->inp_ip.ip_ttl = ip_defttl;
+ sotoinpcb(so)->inp_ip.ip_ttl = ip_defttl;
break;
case PRU_DETACH:
diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c
index 328351ab8c9..0beac45ea8c 100644
--- a/sys/netinet6/ip6_divert.c
+++ b/sys/netinet6/ip6_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_divert.c,v 1.9 2013/03/28 16:45:16 tedu Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.10 2013/04/02 18:27:47 bluhm Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -243,7 +243,7 @@ divert6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
error = soreserve(so, divert6_sendspace, divert6_recvspace);
if (error)
break;
- ((struct inpcb *) so->so_pcb)->inp_flags |= INP_HDRINCL;
+ sotoinpcb(so)->inp_flags |= INP_HDRINCL;
break;
case PRU_DETACH: