diff -c ./CHANGES ../tcpdump-psc-3.4/CHANGES *** ./CHANGES Sat Jul 25 15:41:19 1998 --- ../tcpdump-psc-3.4/CHANGES Thu Nov 12 15:38:17 1998 *************** *** 1,5 **** --- 1,11 ---- @(#) $Header: CHANGES,v 1.54 98/07/25 12:41:06 leres Exp $ (LBL) + PSC modifications(jes) Thu Nov 12 15:34:50 EST 1998 + + - Adds RFC2018 SACK block interpreting + + - Adds ECN bits to TCP and IP headers + v3.4 Sat Jul 25 12:40:55 PDT 1998 - Hardwire Linux slip support since it's too hard to detect. Common subdirectories: ./lbl and ../tcpdump-psc-3.4/lbl Common subdirectories: ./linux-include and ../tcpdump-psc-3.4/linux-include diff -c ./print-ip.c ../tcpdump-psc-3.4/print-ip.c *** ./print-ip.c Wed May 28 15:51:45 1997 --- ../tcpdump-psc-3.4/print-ip.c Thu Nov 12 15:22:45 1998 *************** *** 58,63 **** --- 58,74 ---- #define IN_CLASSD(i) (((int32_t)(i) & 0xf0000000) == 0xe0000000) #endif + /* Definitions required for ECN + for use if the OS running tcpdump does not have ECN */ + + #ifndef IPTOS_ECT + #define IPTOS_ECT 0x02 /* ECN Capable Transport in IP header*/ + #endif + + #ifndef IPTOS_CE + #define IPTOS_CE 0x01 /* ECN Cong. Experienced in IP header*/ + #endif + /* (following from ipmulti/mrouted/prune.h) */ /* *************** *** 489,496 **** } else if (off & IP_DF) (void)printf(" (DF)"); ! if (ip->ip_tos) ! (void)printf(" [tos 0x%x]", (int)ip->ip_tos); if (ip->ip_ttl <= 1) (void)printf(" [ttl %d]", (int)ip->ip_ttl); --- 500,518 ---- } else if (off & IP_DF) (void)printf(" (DF)"); ! if (ip->ip_tos) { ! (void)printf(" [tos 0x%x", (int)ip->ip_tos); ! if (ip->ip_tos & (IPTOS_CE|IPTOS_ECT)) { ! (void)printf(" ("); ! if (ip->ip_tos & IPTOS_ECT) ! putchar('E'); /* ECN-capable transport */ ! if (ip->ip_tos & IPTOS_CE) ! putchar('C'); /* _C_ongestion experienced (ECN) */ ! (void)printf(")"); ! ! } ! (void)printf("]"); ! } if (ip->ip_ttl <= 1) (void)printf(" [ttl %d]", (int)ip->ip_ttl); diff -c ./print-tcp.c ../tcpdump-psc-3.4/print-tcp.c *** ./print-tcp.c Sun Jun 15 16:20:28 1997 --- ../tcpdump-psc-3.4/print-tcp.c Thu Nov 12 15:22:16 1998 *************** *** 75,80 **** --- 75,91 ---- #define TCPOPT_CCECHO 13 /* T/TCP CC options (rfc1644) */ #endif + /* Definitions required for ECN + for use if the OS running tcpdump does not have ECN */ + + #ifndef TH_ECNECHO + #define TH_ECNECHO 0x40 /* ECN Echo in tcp header */ + #endif + + #ifndef TH_CWR + #define TH_CWR 0x80 /* ECN Cwnd Reduced in tcp header*/ + #endif + struct tha { struct in_addr src; struct in_addr dst; *************** *** 103,112 **** register const struct tcphdr *tp; register const struct ip *ip; register u_char flags; register int hlen; register char ch; u_short sport, dport, win, urp; ! u_int32_t seq, ack; tp = (struct tcphdr *)bp; ip = (struct ip *)bp2; --- 114,125 ---- register const struct tcphdr *tp; register const struct ip *ip; register u_char flags; + register u_char tos; register int hlen; register char ch; u_short sport, dport, win, urp; ! u_int32_t seq, ack, sackstart, sackend; ! tcp_seq sackadjust; tp = (struct tcphdr *)bp; ip = (struct ip *)bp2; *************** *** 132,138 **** (void)printf("tcp %d", length - tp->th_off * 4); return; } ! if ((flags = tp->th_flags) & (TH_SYN|TH_FIN|TH_RST|TH_PUSH)) { if (flags & TH_SYN) putchar('S'); if (flags & TH_FIN) --- 145,152 ---- (void)printf("tcp %d", length - tp->th_off * 4); return; } ! if ((flags = tp->th_flags) & (TH_SYN|TH_FIN|TH_RST|TH_PUSH| ! TH_ECNECHO|TH_CWR)) { if (flags & TH_SYN) putchar('S'); if (flags & TH_FIN) *************** *** 141,146 **** --- 155,164 ---- putchar('R'); if (flags & TH_PUSH) putchar('P'); + if (flags & TH_CWR) + putchar('W'); /* congestion _W_indow reduced (ECN) */ + if (flags & TH_ECNECHO) + putchar('E'); /* ecn _E_cho sent (ECN) */ } else putchar('.'); *************** *** 187,195 **** th->seq = seq, th->ack = ack - 1; } else { if (rev) ! seq -= th->ack, ack -= th->seq; else ! seq -= th->seq, ack -= th->ack; } } hlen = tp->th_off * 4; --- 205,215 ---- th->seq = seq, th->ack = ack - 1; } else { if (rev) ! seq -= th->ack, ack -= th->seq, ! sackadjust = th->seq; else ! seq -= th->seq, ack -= th->ack, ! sackadjust = th->ack; } } hlen = tp->th_off * 4; *************** *** 268,281 **** 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)); } ! if (datalen % 4) (void)printf("[len %d]", len); break; --- 288,307 ---- case TCPOPT_SACK: (void)printf("sack"); datalen = len - 2; ! for (i = 0; i < datalen; i += 8) { ! LENCHECK(i + 8); /* block-size@relative-origin */ + sackstart = EXTRACT_32BITS(cp + i); + sackend = EXTRACT_32BITS(cp + i + 4); + if (!Sflag) { + sackstart -= sackadjust; + sackend -= sackadjust; + } (void)printf(" %u@%u", ! sackstart, ! sackend); } ! if (datalen % 8) (void)printf("[len %d]", len); break; diff -c ./tcpdump.1 ../tcpdump-psc-3.4/tcpdump.1 *** ./tcpdump.1 Mon Jun 30 19:32:09 1997 --- ../tcpdump-psc-3.4/tcpdump.1 Thu Nov 12 15:27:33 1998 *************** *** 752,758 **** .RE \fISrc\fP and \fIdst\fP are the source and destination IP addresses and ports. \fIFlags\fP are some combination of S (SYN), ! F (FIN), P (PUSH) or R (RST) or a single `.' (no flags). \fIData-seqno\fP describes the portion of sequence space covered by the data in this packet (see example below). \fIAck\fP is sequence number of the next data expected the other --- 752,759 ---- .RE \fISrc\fP and \fIdst\fP are the source and destination IP addresses and ports. \fIFlags\fP are some combination of S (SYN), ! F (FIN), P (PUSH), R (RST), W (congestion Window reduced) or ! E (ecn ECHO) or a single `.' (no flags). \fIData-seqno\fP describes the portion of sequence space covered by the data in this packet (see example below). \fIAck\fP is sequence number of the next data expected the other Only in ../tcpdump-psc-3.4: tcpdump.1~