From 9327ee33bf3a26b3256724d79f974d4c96c13700 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Tue, 25 Feb 2003 14:08:41 +0000 Subject: [PATCH] When generating a TCP response to a connection, not only test if the tcpcb is NULL, but also its connected inpcb, since we now allow elements of a TCP connection to hang around after other state, such as the socket, has been recycled. Tested by: dcs Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories --- sys/netinet/tcp_subr.c | 2 +- sys/netinet/tcp_timewait.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index f6708b3579af..d92cbf54a31d 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -484,7 +484,7 @@ tcp_respond(tp, ipgen, th, m, ack, seq, flags) m->m_pkthdr.len = tlen; m->m_pkthdr.rcvif = (struct ifnet *) 0; #ifdef MAC - if (tp != NULL) { + if (tp != NULL && tp->t_inpcb != NULL) { /* * Packet is associated with a socket, so allow the * label of the response to reflect the socket label. diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index f6708b3579af..d92cbf54a31d 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -484,7 +484,7 @@ tcp_respond(tp, ipgen, th, m, ack, seq, flags) m->m_pkthdr.len = tlen; m->m_pkthdr.rcvif = (struct ifnet *) 0; #ifdef MAC - if (tp != NULL) { + if (tp != NULL && tp->t_inpcb != NULL) { /* * Packet is associated with a socket, so allow the * label of the response to reflect the socket label.