summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c6
-rw-r--r--sys/netinet/in_pcb.h2
-rw-r--r--sys/netinet/tcp_input.c3
-rw-r--r--sys/netinet/tcp_reass.c3
-rw-r--r--sys/netinet/tcp_subr.c17
-rw-r--r--sys/netinet/tcp_timewait.c17
6 files changed, 27 insertions, 21 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 2941dfc..212092c 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -865,6 +865,7 @@ in_pcblookup_local(struct inpcbinfo *pcbinfo, struct in_addr laddr,
u_int lport_arg, int wild_okay)
{
struct inpcb *inp;
+ struct tcptw *tw;
#ifdef INET6
int matchwild = 3 + INP_LOOKUP_MAPPED_PCB_COST;
#else
@@ -948,9 +949,10 @@ in_pcblookup_local(struct inpcbinfo *pcbinfo, struct in_addr laddr,
* are clogging up needed local ports.
*/
if ((inp->inp_vflag & INP_TIMEWAIT) != 0) {
- if (tcp_twrecycleable((struct tcptw *)inp->inp_ppcb)) {
+ tw = intotw(inp);
+ if (tcp_twrecycleable(tw)) {
INP_LOCK(inp);
- tcp_twclose((struct tcptw *)inp->inp_ppcb, 0);
+ tcp_twclose(tw, 0);
match = NULL;
goto retrylookup;
}
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 1500c18..0b754db 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -117,7 +117,7 @@ struct inpcb {
/* local and foreign ports, local and foreign addr */
struct in_conninfo inp_inc;
- caddr_t inp_ppcb; /* pointer to per-protocol pcb */
+ void *inp_ppcb; /* pointer to per-protocol pcb */
struct inpcbinfo *inp_pcbinfo; /* PCB list info */
struct socket *inp_socket; /* back pointer to socket */
/* list for this PCB's local port */
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index c1ab6fc..8662ffc 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -760,8 +760,7 @@ findpcb:
*/
if (thflags & TH_SYN)
tcp_dooptions(&to, optp, optlen, 1);
- if (tcp_timewait((struct tcptw *)inp->inp_ppcb,
- &to, th, m, tlen))
+ if (tcp_timewait(intotw(inp), &to, th, m, tlen))
goto findpcb;
/*
* tcp_timewait unlocks inp.
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c
index c1ab6fc..8662ffc 100644
--- a/sys/netinet/tcp_reass.c
+++ b/sys/netinet/tcp_reass.c
@@ -760,8 +760,7 @@ findpcb:
*/
if (thflags & TH_SYN)
tcp_dooptions(&to, optp, optlen, 1);
- if (tcp_timewait((struct tcptw *)inp->inp_ppcb,
- &to, th, m, tlen))
+ if (tcp_timewait(intotw(inp), &to, th, m, tlen))
goto findpcb;
/*
* tcp_timewait unlocks inp.
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 8601b56..055b0e0 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.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);
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