From owner-freebsd-net@FreeBSD.ORG Sun Oct 23 10:20:57 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 82D8616A41F; Sun, 23 Oct 2005 10:20:57 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from aiolos.otenet.gr (aiolos.otenet.gr [195.170.0.93]) by mx1.FreeBSD.org (Postfix) with ESMTP id BCB0743D45; Sun, 23 Oct 2005 10:20:56 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from flame.pc (aris.bedc.ondsl.gr [62.103.39.226]) by aiolos.otenet.gr (8.13.4/8.13.4/Debian-1) with SMTP id j9NAKs0T006593; Sun, 23 Oct 2005 13:20:55 +0300 Received: from flame.pc (flame [127.0.0.1]) by flame.pc (8.13.4/8.13.4) with ESMTP id j9NAJKew020145; Sun, 23 Oct 2005 13:19:20 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by flame.pc (8.13.4/8.13.4/Submit) id j9NAJKCB020118; Sun, 23 Oct 2005 13:19:20 +0300 (EEST) (envelope-from keramida@freebsd.org) Date: Sun, 23 Oct 2005 13:19:20 +0300 From: Giorgos Keramidas To: kamal kc Message-ID: <20051023101919.GA9957@flame.pc> References: <20051023083015.18292.qmail@web35705.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051023083015.18292.qmail@web35705.mail.mud.yahoo.com> Cc: freebsd , freebsd Subject: Re: in_cksum() for ip packets with multiple mbufs X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Oct 2005 10:20:57 -0000 On 2005-10-23 01:30, kamal kc wrote: > i come across this unusual problem. > > i changed the ip_tos field of the struct ip and computed the checksum > by using in_cksum(). > > when the packet uses only one mbuf the computed checksum is ok but > when the packet uses more than one mbuf then the computed checksum is > wrong. Note that the IP header contains a checksum of the IP header only. A common mistake is to calculate the checksum of data too, which results in an invalid IP header checksum. > eg. pinging with payload less than 1470 bytes is ok but with payload > greater than 1480 bytes does not work. (the error being bad checksum > --that i knew by capturing network packets by ethereal) > > is it a real problem or i have made some mistake. > > i put the code before the if_output() in the ip_output() function. Show us the diff, if possible :)