Browse Source

[tcp] Move high-frequency debug messages to DBGLVL_EXTRA

This makes it possible to leave TCP debugging enabled in order to see
interesting TCP events, without flooding the console with at least one
message per packet.
tags/v0.9.8
Michael Brown 15 years ago
parent
commit
a2f753ba64
1 changed files with 21 additions and 21 deletions
  1. 21
    21
      src/net/tcp.c

+ 21
- 21
src/net/tcp.c View File

144
 static inline __attribute__ (( always_inline )) void
144
 static inline __attribute__ (( always_inline )) void
145
 tcp_dump_flags ( struct tcp_connection *tcp, unsigned int flags ) {
145
 tcp_dump_flags ( struct tcp_connection *tcp, unsigned int flags ) {
146
 	if ( flags & TCP_RST )
146
 	if ( flags & TCP_RST )
147
-		DBGC ( tcp, " RST" );
147
+		DBGC2 ( tcp, " RST" );
148
 	if ( flags & TCP_SYN )
148
 	if ( flags & TCP_SYN )
149
-		DBGC ( tcp, " SYN" );
149
+		DBGC2 ( tcp, " SYN" );
150
 	if ( flags & TCP_PSH )
150
 	if ( flags & TCP_PSH )
151
-		DBGC ( tcp, " PSH" );
151
+		DBGC2 ( tcp, " PSH" );
152
 	if ( flags & TCP_FIN )
152
 	if ( flags & TCP_FIN )
153
-		DBGC ( tcp, " FIN" );
153
+		DBGC2 ( tcp, " FIN" );
154
 	if ( flags & TCP_ACK )
154
 	if ( flags & TCP_ACK )
155
-		DBGC ( tcp, " ACK" );
155
+		DBGC2 ( tcp, " ACK" );
156
 }
156
 }
157
 
157
 
158
 /***************************************************************************
158
 /***************************************************************************
487
 	tcphdr->csum = tcpip_chksum ( iobuf->data, iob_len ( iobuf ) );
487
 	tcphdr->csum = tcpip_chksum ( iobuf->data, iob_len ( iobuf ) );
488
 
488
 
489
 	/* Dump header */
489
 	/* Dump header */
490
-	DBGC ( tcp, "TCP %p TX %d->%d %08x..%08zx           %08x %4zd",
491
-	       tcp, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ),
492
-	       ntohl ( tcphdr->seq ), ( ntohl ( tcphdr->seq ) + seq_len ),
493
-	       ntohl ( tcphdr->ack ), len );
490
+	DBGC2 ( tcp, "TCP %p TX %d->%d %08x..%08zx           %08x %4zd",
491
+		tcp, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ),
492
+		ntohl ( tcphdr->seq ), ( ntohl ( tcphdr->seq ) + seq_len ),
493
+		ntohl ( tcphdr->ack ), len );
494
 	tcp_dump_flags ( tcp, tcphdr->flags );
494
 	tcp_dump_flags ( tcp, tcphdr->flags );
495
-	DBGC ( tcp, "\n" );
495
+	DBGC2 ( tcp, "\n" );
496
 
496
 
497
 	/* Transmit packet */
497
 	/* Transmit packet */
498
 	return tcpip_tx ( iobuf, &tcp_protocol, NULL, &tcp->peer, NULL,
498
 	return tcpip_tx ( iobuf, &tcp_protocol, NULL, &tcp->peer, NULL,
568
 	tcphdr->csum = tcpip_chksum ( iobuf->data, iob_len ( iobuf ) );
568
 	tcphdr->csum = tcpip_chksum ( iobuf->data, iob_len ( iobuf ) );
569
 
569
 
570
 	/* Dump header */
570
 	/* Dump header */
571
-	DBGC ( tcp, "TCP %p TX %d->%d %08x..%08x           %08x %4d",
572
-	       tcp, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ),
573
-	       ntohl ( tcphdr->seq ), ( ntohl ( tcphdr->seq ) ),
574
-	       ntohl ( tcphdr->ack ), 0 );
571
+	DBGC2 ( tcp, "TCP %p TX %d->%d %08x..%08x           %08x %4d",
572
+		tcp, ntohs ( tcphdr->src ), ntohs ( tcphdr->dest ),
573
+		ntohl ( tcphdr->seq ), ( ntohl ( tcphdr->seq ) ),
574
+		ntohl ( tcphdr->ack ), 0 );
575
 	tcp_dump_flags ( tcp, tcphdr->flags );
575
 	tcp_dump_flags ( tcp, tcphdr->flags );
576
-	DBGC ( tcp, "\n" );
576
+	DBGC2 ( tcp, "\n" );
577
 
577
 
578
 	/* Transmit packet */
578
 	/* Transmit packet */
579
 	return tcpip_tx ( iobuf, &tcp_protocol, NULL, st_dest,
579
 	return tcpip_tx ( iobuf, &tcp_protocol, NULL, st_dest,
913
 	len = iob_len ( iobuf );
913
 	len = iob_len ( iobuf );
914
 
914
 
915
 	/* Dump header */
915
 	/* Dump header */
916
-	DBGC ( tcp, "TCP %p RX %d<-%d           %08x %08x..%08zx %4zd",
917
-	       tcp, ntohs ( tcphdr->dest ), ntohs ( tcphdr->src ),
918
-	       ntohl ( tcphdr->ack ), ntohl ( tcphdr->seq ),
919
-	       ( ntohl ( tcphdr->seq ) + len +
920
-		 ( ( tcphdr->flags & ( TCP_SYN | TCP_FIN ) ) ? 1 : 0 ) ), len);
916
+	DBGC2 ( tcp, "TCP %p RX %d<-%d           %08x %08x..%08zx %4zd",
917
+		tcp, ntohs ( tcphdr->dest ), ntohs ( tcphdr->src ),
918
+		ntohl ( tcphdr->ack ), ntohl ( tcphdr->seq ),
919
+		( ntohl ( tcphdr->seq ) + len +
920
+		  ( ( tcphdr->flags & ( TCP_SYN | TCP_FIN ) ) ? 1 : 0 )), len);
921
 	tcp_dump_flags ( tcp, tcphdr->flags );
921
 	tcp_dump_flags ( tcp, tcphdr->flags );
922
-	DBGC ( tcp, "\n" );
922
+	DBGC2 ( tcp, "\n" );
923
 
923
 
924
 	/* If no connection was found, send RST */
924
 	/* If no connection was found, send RST */
925
 	if ( ! tcp ) {
925
 	if ( ! tcp ) {

Loading…
Cancel
Save