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: Fri, 15 Sep 2000 09:24:09 +0200 (CEST)
On Thu, 14 Sep 2000, Dax Kelson wrote:

> 	ECN also uses two bits in the IP header, those bits aren't
> decoded yet.

I think this patch does decode them, but since i do not have an
ECN-capable router, i am not able to test this. can anyone please?

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

I came, I saw, I deleted all your files.
Index: packet-ip.c
===================================================================
RCS file: /cvsroot/ethereal/packet-ip.c,v
retrieving revision 1.102
diff -u -1 -b -p -r1.102 packet-ip.c
--- packet-ip.c	2000/08/13 14:08:16	1.102
+++ packet-ip.c	2000/09/15 07:18:48
@@ -65,3 +65,4 @@ static int hf_ip_dsfield = -1;
 static int hf_ip_dsfield_dscp = -1;
-static int hf_ip_dsfield_cu = -1;
+static int hf_ip_dsfield_ect = -1;
+static int hf_ip_dsfield_ce = -1;
 static int hf_ip_tos = -1;
@@ -227,4 +228,6 @@ typedef struct _e_ip 
 #define IPDSFIELD_DSCP_MASK     0xFC
+#define IPDSFIELD_ECN_MASK     0x03
 #define IPDSFIELD_DSCP_SHIFT	2
 #define IPDSFIELD_DSCP(dsfield)	(((dsfield)&IPDSFIELD_DSCP_MASK)>>IPDSFIELD_DSCP_SHIFT)
+#define IPDSFIELD_ECN(dsfield)	((dsfield)&IPDSFIELD_ECN_MASK)
 #define IPDSFIELD_DSCP_DEFAULT  0x00
@@ -250,3 +253,4 @@ typedef struct _e_ip 
 #define IPDSFIELD_DSCP_EF       0x2E
-#define IPDSFIELD_CU_MASK	0x03
+#define IPDSFIELD_ECT_MASK	0x02
+#define IPDSFIELD_CE_MASK	0x01
 
@@ -868,5 +872,5 @@ dissect_ip(const u_char *pd, int offset,
       tf = proto_tree_add_uint_format(ip_tree, hf_ip_dsfield, NullTVB, offset + 1, 1, iph.ip_tos,
-	   "Differentiated Services Field: 0x%02x (DSCP 0x%02x: %s)", iph.ip_tos,
+	   "Differentiated Services Field: 0x%02x (DSCP 0x%02x: %s; ECN: 0x%02x)", iph.ip_tos,
 	   IPDSFIELD_DSCP(iph.ip_tos), val_to_str(IPDSFIELD_DSCP(iph.ip_tos), dscp_vals,
-	   "Unknown DSCP"));
+	   "Unknown DSCP"),IPDSFIELD_ECN(iph.ip_tos));
 
@@ -874,3 +878,4 @@ dissect_ip(const u_char *pd, int offset,
       proto_tree_add_uint(field_tree, hf_ip_dsfield_dscp, NullTVB, offset + 1, 1, iph.ip_tos);
-      proto_tree_add_uint(field_tree, hf_ip_dsfield_cu, NullTVB, offset + 1, 1, iph.ip_tos);
+      proto_tree_add_uint(field_tree, hf_ip_dsfield_ect, NullTVB, offset + 1, 1, iph.ip_tos);
+      proto_tree_add_uint(field_tree, hf_ip_dsfield_ce, NullTVB, offset + 1, 1, iph.ip_tos);
     } else {
@@ -1331,5 +1336,10 @@ proto_register_ip(void)
 
-		{ &hf_ip_dsfield_cu,
-		{ "Currently Unused",	"ip.dsfield.cu", FT_UINT8, BASE_DEC, NULL,
-			IPDSFIELD_CU_MASK,
+		{ &hf_ip_dsfield_ect,
+		{ "ECN-Capable Transport (ECT)",	"ip.dsfield.ect", FT_UINT8, BASE_DEC, NULL,
+			IPDSFIELD_ECT_MASK,
+			"" }},
+
+		{ &hf_ip_dsfield_ce,
+		{ "ECN-CE",	"ip.dsfield.ce", FT_UINT8, BASE_DEC, NULL,
+			IPDSFIELD_CE_MASK,
 			"" }},