ECN and IPv4 Header Checksum Recalculation: ---------------------------------------------------------------------------- Note from Sally, 2/13/98: The current plan is for the ECN bit to be at bit 7 of the IPv4 TOS octet, and for the ECN-capable bit to be located at bit 6. ---------------------------------------------------------------------------- The following is from email sent by Steven Blake, slblake@raleigh.ibm.com, on 12 Feb 1998. Sally Floyd and Kevin Fall have made a slight modification to the header checksum recalculation for one's complement subtraction. ------------ Subject: ECN field in Diffserv ... In DC I mentioned to you in the hallway that I was going to look at the implications of IPv4 header checksum recalculation when the ECN bit was set (where it had previously been 0). As I mentioned, this is a potential problem with some high-end router architectures using an output-buffered switch, since most if not all of the header manipulation is performed on the input side of the switch, while the ECN decision would need to made local to the output buffer. It turns out that the IPv4 TOS octet is the last byte of a 16-bit half-word. I did a quick analysis and this is what I found: HC: original header checksum HC': new header checksum (after ECN bit is set) For ECN bit at bit 7, One's complement subtraction: HC' = { HC - 1 HC > 1 { 0x0000 HC = 1 For ECN bit at bit 6, One's complement subtraction: HC' = { HC - 2 HC > 2 or HC = 1 { 0x0000 HC = 2 The more interesting problem occurs when two's complement subtraction is implemented. In this case, there are special conditions: For ECN bit at bit 7: HC' = { HC - 1 HC > 0 { 0xFFFE HC = 0 For ECN bit at bit 6: HC' = { HC - 2 HC > 1 { 0xFFFD HC = 0 { 0xFFFE HC = 1 Two's complement subtraction would cause the exception cases to be off by +1. Based on this brief analysis ..., I would recommend that the ECN bit be located at bit 7 (the last bit of the TOS/Class octet). The ECN-capable bit could be located at bit 6. This is of course not a problem for IPv6, since there is no IPv6 header checksum. If ECN is never standardized for IPv4 then the bit locations don't matter. ... Steven L. Blake ---------------------------------------------------------------------------- Date: Fri, 13 Feb 1998 10:29:27 EST From: "Steven L. Blake" To: Sally Floyd Subject: Re: ECN field in Diffserv ... Please add that the results were derived from Eqs. 3 & 4 in RFC 1624, and that all references to one's complement addition/subtraction are 16-bit (I should have clarified this in my note). ... ----------------------------------------------------------------------------