a plea for TCP bug reportes, README

David S. Miller (davem@dm.cobaltmicro.com)
Sat, 2 May 1998 03:14:14 -0700


I'd like to ask people sending me tcpdumps to assist in the tracking
down of TCP stalls, hiccups, and performance problems to apply the
following patch to tcpdump.

The problem is that the format used by older tcpdumps to output the
SACK options in the TCP header are in the wrong format, a format which
predates the real RFC specification for SACK.

This will make debugging for me so much easier, thanks. This patch
should go cleanly onto the redhat-5.0 srpm sources for tcpdump.

--- tcpdump-3.3/tcpdump-3.3/print-tcp.c.orig Tue Dec 10 23:26:08 1996
+++ tcpdump-3.3/tcpdump-3.3/print-tcp.c Thu Mar 19 23:46:33 1998
@@ -103,8 +103,8 @@
register int hlen;
register char ch;
u_short sport, dport, win, urp;
- u_int32_t seq, ack;
-
+ u_int32_t seq, ack,thseq,thack;
+ int threv;
tp = (struct tcphdr *)bp;
ip = (struct ip *)bp2;
ch = '\0';
@@ -162,7 +162,7 @@
tha.port = dport << 16 | sport;
rev = 1;
}
-
+ threv = rev;
for (th = &tcp_seq_hash[tha.port % TSEQ_HASHSIZE];
th->nxt; th = th->nxt)
if (!memcmp((char *)&tha, (char *)&th->addr,
@@ -183,6 +183,10 @@
else
th->seq = seq, th->ack = ack - 1;
} else {
+
+ thseq = th->seq;
+ thack = th->ack;
+
if (rev)
seq -= th->ack, ack -= th->seq;
else
@@ -263,18 +267,32 @@
break;

case TCPOPT_SACK:
- (void)printf("sack");
- datalen = len - 2;
- for (i = 0; i < datalen; i += 4) {
- LENCHECK(i + 4);
- /* block-size@relative-origin */
- (void)printf(" %u@%u",
- EXTRACT_16BITS(cp + i + 2),
- EXTRACT_16BITS(cp + i));
+ {
+ u_int32_t s, e;
+
+ datalen = len - 2;
+ if (datalen % 8 != 0) {
+ (void)printf(" malformed sack ");
+ } else {
+ (void)printf(" sack %d ", datalen / 8);
+ for (i = 0; i < datalen; i += 8) {
+ LENCHECK(i + 4);
+ s = EXTRACT_32BITS(cp + i);
+ LENCHECK(i + 8);
+ e = EXTRACT_32BITS(cp + i + 4);
+ if (threv) {
+ s -= thseq;
+ e -= thseq;
+ } else {
+ s -= thack;
+ e -= thack;
+ }
+ (void)printf("{%u:%u}", s, e);
}
- if (datalen % 4)
- (void)printf("[len %d]", len);
- break;
+ (void)printf(" ");
+ }
+ break;
+ }

case TCPOPT_ECHO:
(void)printf("echo");

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu