1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Explicitly assert socket pointer is non-NULL in tcp_input() so as to

provide better debugging information.

Prefer explicit comparison to NULL for tcpcb pointers rather than
treating them as booleans.

MFC after:	1 month
This commit is contained in:
Robert Watson 2006-03-26 01:33:41 +00:00
parent d7fad9f651
commit 1c53f80637
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157136
3 changed files with 16 additions and 14 deletions

View File

@ -784,6 +784,7 @@ tcp_input(m, off0)
goto drop;
#endif
so = inp->inp_socket;
KASSERT(so != NULL, ("tcp_input: so == NULL"));
#ifdef TCPDEBUG
if (so->so_options & SO_DEBUG) {
ostate = tp->t_state;
@ -2552,7 +2553,7 @@ tcp_input(m, off0)
(tcp_seq)0, TH_RST|TH_ACK);
}
if (tp)
if (tp != NULL)
INP_UNLOCK(inp);
if (headlocked)
INP_INFO_WUNLOCK(&tcbinfo);
@ -2563,11 +2564,11 @@ tcp_input(m, off0)
* Drop space held by incoming segment and return.
*/
#ifdef TCPDEBUG
if (tp == 0 || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
if (tp == NULL || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
if (tp)
if (tp != NULL)
INP_UNLOCK(inp);
if (headlocked)
INP_INFO_WUNLOCK(&tcbinfo);

View File

@ -784,6 +784,7 @@ tcp_input(m, off0)
goto drop;
#endif
so = inp->inp_socket;
KASSERT(so != NULL, ("tcp_input: so == NULL"));
#ifdef TCPDEBUG
if (so->so_options & SO_DEBUG) {
ostate = tp->t_state;
@ -2552,7 +2553,7 @@ tcp_input(m, off0)
(tcp_seq)0, TH_RST|TH_ACK);
}
if (tp)
if (tp != NULL)
INP_UNLOCK(inp);
if (headlocked)
INP_INFO_WUNLOCK(&tcbinfo);
@ -2563,11 +2564,11 @@ tcp_input(m, off0)
* Drop space held by incoming segment and return.
*/
#ifdef TCPDEBUG
if (tp == 0 || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
if (tp == NULL || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
if (tp)
if (tp != NULL)
INP_UNLOCK(inp);
if (headlocked)
INP_INFO_WUNLOCK(&tcbinfo);

View File

@ -195,11 +195,11 @@ tcp_timer_2msl(xtp)
tp = tcp_close(tp);
#ifdef TCPDEBUG
if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
PRU_SLOWTIMO);
#endif
if (tp)
if (tp != NULL)
INP_UNLOCK(inp);
INP_INFO_WUNLOCK(&tcbinfo);
}
@ -353,11 +353,11 @@ tcp_timer_keep(xtp)
tp = tcp_drop(tp, ETIMEDOUT);
#ifdef TCPDEBUG
if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
PRU_SLOWTIMO);
#endif
if (tp)
if (tp != NULL)
INP_UNLOCK(tp->t_inpcb);
INP_INFO_WUNLOCK(&tcbinfo);
}
@ -412,11 +412,11 @@ tcp_timer_persist(xtp)
out:
#ifdef TCPDEBUG
if (tp && tp->t_inpcb->inp_socket->so_options & SO_DEBUG)
if (tp != NULL && tp->t_inpcb->inp_socket->so_options & SO_DEBUG)
tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
PRU_SLOWTIMO);
#endif
if (tp)
if (tp != NULL)
INP_UNLOCK(inp);
INP_INFO_WUNLOCK(&tcbinfo);
}
@ -560,11 +560,11 @@ tcp_timer_rexmt(xtp)
out:
#ifdef TCPDEBUG
if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
PRU_SLOWTIMO);
#endif
if (tp)
if (tp != NULL)
INP_UNLOCK(inp);
if (headlocked)
INP_INFO_WUNLOCK(&tcbinfo);