explicit congestion notification

$cat /proc/sys/net/ipv4/tcp_ecn
2
$

The tcp_ecn variable turns on Explicit Congestion Notification in TCP connections. This is used to automatically tell the host when there are congestions in a route to a specific host or a network. This can be used to throttle the transmitters to send packets in a slower rate over that specific router or firewall.

The tcp_ecn variable takes a boolean value and is per default set to 0, or turned off. If you want to turn this on in your kernel, you should set this variable to 1.
text under GNU FDL

Date: Fri, 8 May 1998 13:54:39 -0400 (EDT)
From: "Jamal Hadi Salim"
To: ecn-interest@research.att.com
Subject: tcpdump patch to print ECN info
Message-ID:


against 3.4a5; feel free to change the output


-----------------------------
diff -ru tcpdump-3.4a5-orig/print-ip.c tcpdump-3.4a5/print-ip.c
--- tcpdump-3.4a5-orig/print-ip.c       Fri May  8 13:42:02 1998
+++ tcpdump-3.4a5/print-ip.c    Fri May  8 13:03:45 1998
@@ -490,7 +490,14 @@
                (void)printf(" (DF)");

        if (ip->ip_tos)
+               {
                (void)printf(" [tos 0x%x]", (int)ip->ip_tos);
+               /* ECN bits */
+               if (ip->ip_tos &0x01)
+               (void)printf(" [CE] ");
+               if (ip->ip_tos &0x02)
+               (void)printf(" [ECT] ");
+               }
        if (ip->ip_ttl ip_ttl);

diff -ru tcpdump-3.4a5-orig/print-tcp.c tcpdump-3.4a5/print-tcp.c
--- tcpdump-3.4a5-orig/print-tcp.c      Fri May  8 13:42:02 1998
+++ tcpdump-3.4a5/print-tcp.c   Fri May  8 13:32:06 1998
@@ -75,6 +75,7 @@
 #define TCPOPT_CCECHO          13      /* T/TCP CC options (rfc1644) */
 #endif

+#define ECE_ON         0x40    /* ECN notify */
 struct tha {
        struct in_addr src;
        struct in_addr dst;
@@ -143,6 +144,9 @@
                        putchar('P');
        } else
                putchar('.');
+       flags = tp->th_flags;
+       if (flags & ECE_ON)
+               printf(" [TCP-ECE]");

        if (!Sflag && (flags & TH_ACK)) {
                register struct tcp_seq_hash *th;

--------------------------------------------------

cheers,
jamal

Computing Technology Labs, Nortel