Ethereal-dev: Re: [ethereal-dev] ECN = Explicit Congestion Notification

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulrich Kiermayr <kie@xxxxxxxxxxxxxxxx>
Date: Thu, 14 Sep 2000 22:12:05 +0200 (CEST)
On Thu, 14 Sep 2000, Dax Kelson wrote:

> RFC 2481 describes ECN:
> 
> [...]
> 
> It would be great if Ethereal could decode and display ECN.  The Linux
> kernel 2.4.0-test8 and up support and use ECN.

We also needed this for debugging our firewall recently, so I did a little
hacking, and I _think_ this should take care of the ECN-Bits in the
TCP-Header. (And hopefully does not break anything else)

LL&P Ulrich
-- 
,-,  .-.,----,---------------------------------------------------------------
| | / / |,---' Ulrich Kiermayr    Inst. for Theoret. Physics, Univ. of Vienna
| |/ /| ||_     eMail: kie@xxxxxxxxxxxxxxxx            PGP Key ID: 0xA8D764D8 
|   ( | | _:    ICQ: 17858333           Web: http://www.thp.univie.ac.at/~kie
| |\ \| ||     @Home: Dampierrestr. 4/5, A-1140 Vienna;      +43(699)19671909
| | \ \ |`---, @Work: Boltzmanngasse 5, A-1090 Vienna;       +43(1)4277/51555
`-'  `-''----'---------------------------------------------------------------

The disks are getting full; purge a file today.
Index: packet-tcp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-tcp.c,v
retrieving revision 1.82
diff -u -1 -b -p -r1.82 packet-tcp.c
--- packet-tcp.c	2000/09/11 16:16:10	1.82
+++ packet-tcp.c	2000/09/14 19:26:49
@@ -72,2 +72,4 @@ static int hf_tcp_hdr_len = -1;
 static int hf_tcp_flags = -1;
+static int hf_tcp_flags_cwr = -1;
+static int hf_tcp_flags_ecn = -1;
 static int hf_tcp_flags_urg = -1;
@@ -109,2 +111,4 @@ typedef struct _e_tcphdr {
 #define TH_URG  0x20
+#define TH_ECN  0x40
+#define TH_CWR  0x80
   guint16 th_win;
@@ -488,2 +492,4 @@ dissect_tcp(const u_char *pd, int offset
     field_tree = proto_item_add_subtree(tf, ett_tcp_flags);
+    proto_tree_add_boolean(field_tree, hf_tcp_flags_cwr, NullTVB, offset + 13, 1, th.th_flags);
+    proto_tree_add_boolean(field_tree, hf_tcp_flags_ecn, NullTVB, offset + 13, 1, th.th_flags);
     proto_tree_add_boolean(field_tree, hf_tcp_flags_urg, NullTVB, offset + 13, 1, th.th_flags);
@@ -592,2 +598,10 @@ proto_register_tcp(void)
 		{ "Flags",			"tcp.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
+			"" }},
+
+		{ &hf_tcp_flags_cwr,
+		{ "Congestion Window Reduced (CWR)",			"tcp.flags.cwr", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_CWR,
+			"" }},
+
+		{ &hf_tcp_flags_ecn,
+		{ "ECN-Echo",			"tcp.flags.ecn", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_ECN,
 			"" }},