Date: Sun, 23 Oct 2005 04:13:33 -0700 (PDT) From: kamal kc <kamal_ckk@yahoo.com> To: Giorgos Keramidas <keramida@freebsd.org> Cc: freebsd <freebsd-hackers@freebsd.org>, freebsd <freebsd-net@freebsd.org> Subject: Re: in_cksum() for ip packets with multiple mbufs Message-ID: <20051023111333.53650.qmail@web35701.mail.mud.yahoo.com> In-Reply-To: <20051023101919.GA9957@flame.pc>
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051023111333.53650.qmail>