aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2008-11-27 12:04:35 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2008-11-27 12:04:35 +0000
commit6aee2fc550d27a19446cf586f4aec7f7eb6743b2 (patch)
treee1f15662baedc4c9181ee6f9e4cd9ced42b3fbba /sys/netinet
parentcb5c4b10ba7c6d9f83b961c24be8f766ea6156c0 (diff)
Notes
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c9
-rw-r--r--sys/netinet/tcp_timewait.c10
-rw-r--r--sys/netinet/tcp_usrreq.c29
3 files changed, 15 insertions, 33 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 67d609cbb086..f611e73aa478 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -899,10 +899,17 @@ in_pcbfree(struct inpcb *inp)
INP_WLOCK_ASSERT(inp);
#ifdef IPSEC
- ipsec_delete_pcbpolicy(inp);
+ if (inp->inp_sp != NULL)
+ ipsec_delete_pcbpolicy(inp);
#endif /* IPSEC */
inp->inp_gencnt = ++ipi->ipi_gencnt;
in_pcbremlists(inp);
+#ifdef INET6
+ if (inp->inp_vflag & INP_IPV6PROTO) {
+ ip6_freepcbopts(inp->in6p_outputopts);
+ ip6_freemoptions(inp->in6p_moptions);
+ }
+#endif
if (inp->inp_options)
(void)m_free(inp->inp_options);
if (inp->inp_moptions != NULL)
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index d3a582c49214..7b06de4b77bb 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -514,14 +514,8 @@ tcp_twclose(struct tcptw *tw, int reuse)
*/
INP_WUNLOCK(inp);
}
- } else {
-#ifdef INET6
- if (inp->inp_vflag & INP_IPV6PROTO)
- in6_pcbfree(inp);
- else
-#endif
- in_pcbfree(inp);
- }
+ } else
+ in_pcbfree(inp);
V_tcpstat.tcps_closed++;
crfree(tw->tw_cred);
tw->tw_cred = NULL;
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 3127c863c82b..9661a977b9ab 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -156,9 +156,6 @@ static void
tcp_detach(struct socket *so, struct inpcb *inp)
{
struct tcpcb *tp;
-#ifdef INET6
- int isipv6 = INP_CHECK_SOCKAF(so, AF_INET6) != 0;
-#endif
#ifdef INVARIANTS
INIT_VNET_INET(so->so_vnet);
#endif
@@ -188,12 +185,7 @@ tcp_detach(struct socket *so, struct inpcb *inp)
KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && "
"INP_DROPPED && tp != NULL"));
in_pcbdetach(inp);
-#ifdef INET6
- if (isipv6)
- in6_pcbfree(inp);
- else
-#endif
- in_pcbfree(inp);
+ in_pcbfree(inp);
} else {
in_pcbdetach(inp);
INP_WUNLOCK(inp);
@@ -212,15 +204,9 @@ tcp_detach(struct socket *so, struct inpcb *inp)
tp->t_state < TCPS_SYN_SENT) {
tcp_discardcb(tp);
in_pcbdetach(inp);
-#ifdef INET6
- if (isipv6)
- in6_pcbfree(inp);
- else
-#endif
- in_pcbfree(inp);
- } else {
- in_pcbdetach(inp);
- }
+ in_pcbfree(inp);
+ } else
+ in_pcbdetach(inp);
}
}
@@ -1479,12 +1465,7 @@ tcp_attach(struct socket *so)
tp = tcp_newtcpcb(inp);
if (tp == NULL) {
in_pcbdetach(inp);
-#ifdef INET6
- if (isipv6)
- in6_pcbfree(inp);
- else
-#endif
- in_pcbfree(inp);
+ in_pcbfree(inp);
INP_INFO_WUNLOCK(&V_tcbinfo);
return (ENOBUFS);
}