summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_timewait.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-04-03 13:33:55 +0000
committerrwatson <rwatson@FreeBSD.org>2006-04-03 13:33:55 +0000
commitd67aff8ec432c4f2d1e0c1acf831f238931c2429 (patch)
tree0e7eebbe527dc5fd1f35a85c1b0904a72115d6b2 /sys/netinet/tcp_timewait.c
parent4586157b3a5cbeff0a6e0878ab9a029cdd7f0704 (diff)
downloadFreeBSD-src-d67aff8ec432c4f2d1e0c1acf831f238931c2429.zip
FreeBSD-src-d67aff8ec432c4f2d1e0c1acf831f238931c2429.tar.gz
Change inp_ppcb from caddr_t to void *, fix/remove associated related
casts. Consistently use intotw() to cast inp_ppcb pointers to struct tcptw * pointers. Consistently use intotcpcb() to cast inp_ppcb pointers to struct tcpcb * pointers. Don't assign tp to the results to intotcpcb() during variable declation at the top of functions, as that is before the asserts relating to locking have been performed. Do this later in the function after appropriate assertions have run to allow that operation to be conisdered safe. MFC after: 3 months
Diffstat (limited to 'sys/netinet/tcp_timewait.c')
-rw-r--r--sys/netinet/tcp_timewait.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index 8601b56..055b0e0 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -622,7 +622,7 @@ tcp_newtcpcb(struct inpcb *inp)
* which may match an IPv4-mapped IPv6 address.
*/
inp->inp_ip_ttl = ip_defttl;
- inp->inp_ppcb = (caddr_t)tp;
+ inp->inp_ppcb = tp;
return (tp); /* XXX */
}
@@ -848,10 +848,11 @@ tcp_drain(void)
static struct inpcb *
tcp_notify(struct inpcb *inp, int error)
{
- struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb;
+ struct tcpcb *tp;
INP_INFO_WLOCK_ASSERT(&tcbinfo);
INP_LOCK_ASSERT(inp);
+ tp = intotcpcb(inp);
/*
* Ignore some errors if we are hooked up.
@@ -958,7 +959,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
inp = inp_list[i];
if (inp->inp_gencnt <= gencnt) {
struct xtcpcb xt;
- caddr_t inp_ppcb;
+ void *inp_ppcb;
bzero(&xt, sizeof(xt));
xt.xt_len = sizeof xt;
@@ -1429,10 +1430,11 @@ tcp_isn_tick(void *xtp)
struct inpcb *
tcp_drop_syn_sent(struct inpcb *inp, int errno)
{
- struct tcpcb *tp = intotcpcb(inp);
+ struct tcpcb *tp;
INP_INFO_WLOCK_ASSERT(&tcbinfo);
INP_LOCK_ASSERT(inp);
+ tp = intotcpcb(inp);
if (tp != NULL && tp->t_state == TCPS_SYN_SENT) {
tp = tcp_drop(tp, errno);
@@ -1453,7 +1455,7 @@ tcp_drop_syn_sent(struct inpcb *inp, int errno)
struct inpcb *
tcp_mtudisc(struct inpcb *inp, int errno)
{
- struct tcpcb *tp = intotcpcb(inp);
+ struct tcpcb *tp;
struct socket *so = inp->inp_socket;
u_int maxmtu;
u_int romtu;
@@ -1463,6 +1465,7 @@ tcp_mtudisc(struct inpcb *inp, int errno)
#endif /* INET6 */
INP_LOCK_ASSERT(inp);
+ tp = intotcpcb(inp);
if (tp != NULL) {
#ifdef INET6
isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) != 0;
@@ -1720,7 +1723,7 @@ tcp_twstart(struct tcpcb *tp)
SOCK_UNLOCK(so);
if (acknow)
tcp_twrespond(tw, TH_ACK);
- inp->inp_ppcb = (caddr_t)tw;
+ inp->inp_ppcb = tw;
inp->inp_vflag |= INP_TIMEWAIT;
tcp_timer_2msl_reset(tw, tw_time);
@@ -1799,7 +1802,7 @@ tcp_twclose(struct tcptw *tw, int reuse)
*/
inp = tw->tw_inpcb;
KASSERT((inp->inp_vflag & INP_TIMEWAIT), ("tcp_twclose: !timewait"));
- KASSERT(inp->inp_ppcb == (void *)tw, ("tcp_twclose: inp_ppcb != tw"));
+ KASSERT(intotw(inp) == tw, ("tcp_twclose: inp_ppcb != tw"));
INP_INFO_WLOCK_ASSERT(&tcbinfo); /* tcp_timer_2msl_stop(). */
INP_LOCK_ASSERT(inp);
OpenPOWER on IntegriCloud