Dear Maintainer;

        Here is a small patch to tcpdump-3.4, to print-tcp.c. It corrects the
printing of SACK option values (either relative or original) according to 
RFC-2018.
        I am CC'ing linux-net because I previously posted about my experiences
with SACK, and because there was some discussion about where to send patches
to tcpdump. If there is a more appropriate place to send this, please
let me know.
        Of course, if Ive screwed something up, I would like to know as well.

Paul
[EMAIL PROTECTED]

        
--- print-tcp.c.orig    Tue Oct 12 16:26:50 1999
+++ print-tcp.c Sun Oct 24 17:06:57 1999
@@ -107,6 +107,8 @@
        register char ch;
        u_short sport, dport, win, urp;
        u_int32_t seq, ack;
+       u_int32_t ack_off = 0;
+       u_int32_t seq_off = 0;
 
        tp = (struct tcphdr *)bp;
        ip = (struct ip *)bp2;
@@ -187,9 +189,12 @@
                                th->seq = seq, th->ack = ack - 1;
                } else {
                        if (rev)
-                               seq -= th->ack, ack -= th->seq;
+                               ack_off = th->seq, seq_off = th->ack;
                        else
-                               seq -= th->seq, ack -= th->ack;
+                               ack_off = th->ack, seq_off = th->seq;
+
+                       seq -= seq_off;
+                       ack -= ack_off;
                }
        }
        hlen = tp->th_off * 4;
@@ -270,10 +275,13 @@
                                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));
+                                       /* pair of 32bit sequence numbers. RFC-2018 */
+                                       (void)printf(" %u:", 
+                                               EXTRACT_32BITS(cp + i) - ack_off);
+                                       i += 4;
+                                       LENCHECK(i + 4);
+                                       (void)printf("%u", 
+                                               EXTRACT_32BITS(cp + i) - ack_off );
                                }
                                if (datalen % 4)
                                        (void)printf("[len %d]", len);

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to