From owner-freebsd-net Wed Nov 15 0: 6:47 2000 Delivered-To: freebsd-net@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 04A4E37B4C5 for ; Wed, 15 Nov 2000 00:06:42 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.0/8.11.0) id eAF847L38221; Wed, 15 Nov 2000 10:04:07 +0200 (EET) (envelope-from ru) Date: Wed, 15 Nov 2000 10:04:07 +0200 From: Ruslan Ermilov To: "Louis A. Mamakos" Cc: Charles Mott , Archie Cobbs , net@FreeBSD.ORG, Ari Suutari Subject: Re: libalias: Incremental Update of Internet Checksum Message-ID: <20001115100407.D36400@sunbay.com> Mail-Followup-To: "Louis A. Mamakos" , Charles Mott , Archie Cobbs , net@FreeBSD.ORG, Ari Suutari References: <200011150315.eAF3FIG60231@whizzo.transsys.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200011150315.eAF3FIG60231@whizzo.transsys.com>; from louie@TransSys.COM on Tue, Nov 14, 2000 at 10:15:18PM -0500 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Tue, Nov 14, 2000 at 10:15:18PM -0500, Louis A. Mamakos wrote: > > Arithmetically, a value of 0xffff is identical to 0x0000 since they > both represent the value of zero when using a one's complement binary > representation of values. > Except you can't actually receive the value of 0xffff in a checksum field. One's complement sum is guaranteed to be non-zero except if all items are zeroes. Since IP Protocol field is a non-zero value that participates in all checksums (IP, TCP, UDP, ICMP), the checksum value (which is a one's complement of a one's complement sum) is guaranteed to be non-0xffff. > It turns that this property is used in some network protocols (e.g., UDP) > to distinguish between a checksum value that's computed as zero (represented > as 0xffff in the packet) from a packet which has no computed checksum at all. > This was done in the dark ages when it was deemed "too expensive" to > compute a checksum. > From the above it follows that UDP should better be using 0xffff rather than 0x0 to indicate that a packet has no computed checksum. It is quite possible that the computed checksum will have a zero value, in which case the receiving UDP module will consider such a packet as with no computed checksum, which is wrong. -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message