in_cksum() for ip packets with multiple mbufs

Giorgos Keramidas keramida at freebsd.org
Sun Oct 23 03:20:57 PDT 2005


On 2005-10-23 01:30, kamal kc <kamal_ckk at yahoo.com> 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 :)



More information about the freebsd-net mailing list