From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 23 11:13:34 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9EF4F16A420 for ; Sun, 23 Oct 2005 11:13:34 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: from web35701.mail.mud.yahoo.com (web35701.mail.mud.yahoo.com [66.163.179.155]) by mx1.FreeBSD.org (Postfix) with SMTP id B295243D49 for ; Sun, 23 Oct 2005 11:13:33 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: (qmail 53652 invoked by uid 60001); 23 Oct 2005 11:13:33 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=cavUSpZcLCp8U/AE3PuwW3MRUTseWCcLMnpUtPw0VFKE6OK51hLs/+wHN1Hmb1W3uV65VHAmntmvs76nFuKoHrISw3uw55EGJT13ZlkwENUQk8sEaH+PD5JeQfPiDXM9fZq6KFzBub3HDoWWsvhxPzAqVHpE6qV/eeVyt+VKv/c= ; Message-ID: <20051023111333.53650.qmail@web35701.mail.mud.yahoo.com> Received: from [202.79.62.15] by web35701.mail.mud.yahoo.com via HTTP; Sun, 23 Oct 2005 04:13:33 PDT Date: Sun, 23 Oct 2005 04:13:33 -0700 (PDT) From: kamal kc To: Giorgos Keramidas In-Reply-To: <20051023101919.GA9957@flame.pc> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: freebsd , freebsd Subject: Re: in_cksum() for ip packets with multiple mbufs X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Oct 2005 11:13:34 -0000 > > 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. ok i made this mistake to calculate the checksum over the entire IP payload. i corrected this and used the ip_hl field ::: /* the argument m is the (struct mbuf *) that * contains the packet data */ void copy_the_memorybuffer(struct mbuf **m) { struct mbuf *mbuf_pointer=*m; struct mbuf **next_packet; next_packet=&mbuf_pointer; struct ip *my_ip_hdr; my_ip_hdr=mtod((*next_packet),struct ip *); my_ip_hdr->ip_tos=64; my_ip_hdr->ip_sum=0; my_ip_hdr->ip_sum= in_cksum((*next_packet),(my_ip_hdr->ip_hl<<2)); ....... } but still it doesn't seem to work. and the problem is still there. i am really confused .. > > 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 :) sorry i did not understand what to show here. does it mean to show the packet data captured by the ethereal.. thanks kamal __________________________________ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com