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 23:42:00 +0200 (CEST)
Hello

Sorry for posting a second time, but here is the improved version of my
ECN-Patch, which now shows them in the header too.

as i said before i am no etherreal-programming-expert and therefore i am
not sure if this thing breaks anything, but it works fine for me!

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
`-'  `-''----'---------------------------------------------------------------

Security check: INTRUDER ALERT!
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 21:37:01
@@ -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;
@@ -407,3 +411,3 @@ dissect_tcp(const u_char *pd, int offset
   gchar      flags[64] = "<None>";
-  gchar     *fstr[] = {"FIN", "SYN", "RST", "PSH", "ACK", "URG"};
+  gchar     *fstr[] = {"FIN", "SYN", "RST", "PSH", "ACK", "URG", "ECN", "CWR" };
   gint       fpos = 0, i;
@@ -434,3 +438,3 @@ dissect_tcp(const u_char *pd, int offset
   if (check_col(fd, COL_PROTOCOL) || tree) {  
-    for (i = 0; i < 6; i++) {
+    for (i = 0; i < 8; i++) {
       bpos = 1 << i;
@@ -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,
 			"" }},