Make tcpstates[] static, and make sure TCPSTATES is defined before

<netinet/tcp_fsm.h> is included into any compilation unit that needs
tcpstates[].  Also remove incorrect extern declarations and TCPDEBUG
conditionals.  This allows kernels both with and without TCPDEBUG to
build, and unbreaks the tinderbox.

Approved by:	re (rwatson)
This commit is contained in:
Dag-Erling Smørgrav 2007-07-30 11:06:42 +00:00
parent ef2c8992b5
commit 218cbbea9a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171656
6 changed files with 4 additions and 14 deletions

View File

@ -102,7 +102,7 @@ int tcp_acounts[TCP_NSTATES][PRU_NREQ];
#endif
#ifdef TCPSTATES
const char *tcpstates[] = {
static char const * const tcpstates[] = {
"CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD",
"ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING",
"LAST_ACK", "FIN_WAIT_2", "TIME_WAIT",

View File

@ -1573,15 +1573,9 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
KASSERT(headlocked, ("%s: trimthenstep6: tcp_close.3: head "
"not locked", __func__));
if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) {
#ifdef TCPDEBUG
log(LOG_DEBUG, "%s; %s: %s: Received data after socket "
"was closed, sending RST and removing tcpcb\n",
s, __func__, tcpstates[tp->t_state]);
#else
log(LOG_DEBUG, "%s; %s: Received data after socket "
"was closed, sending RST and removing tcpcb\n",
s, __func__);
#endif
free(s, M_TCPLOG);
}
tp = tcp_close(tp);

View File

@ -87,10 +87,6 @@
/*
* TCP protocol interface to socket abstraction.
*/
#ifdef TCPDEBUG
extern const char *tcpstates[];
#endif
static int tcp_attach(struct socket *);
static int tcp_connect(struct tcpcb *, struct sockaddr *,
struct thread *td);

View File

@ -69,6 +69,8 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/protosw.h>
#define TCPSTATES /* for logging */
#include <netinet/in_systm.h>
#include <netinet/tcp_fsm.h>

View File

@ -95,7 +95,6 @@ int spx_debx;
#ifdef _KERNEL
extern char *prurequests[];
extern char *sanames[];
extern char *tcpstates[];
void spx_trace(short act, u_char ostate, struct spxpcb *sp, struct spx *si,
int req);

View File

@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <net/route.h>
#define TCPSTATES
#include <netinet/tcp_fsm.h>
#include <netipx/ipx.h>
@ -72,8 +73,6 @@ __FBSDID("$FreeBSD$");
static char *ipx_prpr (struct ipx_addr *);
extern char *tcpstates[];
/*
* Print a summary of connections related to a Network Systems
* protocol. For SPX, also give state of connection.