[lkml]   [2005]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: TCP checksum calculation
On Thu, 20 Jan 2005 15:52:34 -0500 (EST)
Rahul Jain <> wrote:

> Hi,
> I have written a module that changes IP addrs and TCP port values. After
> changing these fields, I am able to recalculate the IP checksum within
> the module. To recalculate the TCP checksum, I wrote a new function in
> tcp_ipv4.c which is very similar to tcp_v4_send_check(). The only
> difference is that, my function does not use the sock parameter and gets
> the saddr and daddr from sk_buff. I call this function before the
> following piece of code in tcp_v4_rcv()
> if ((skb->ip_summed != CHECKSUM_UNNECESSARY &&
> tcp_v4_checksum_init(skb) < 0))
> goto bad_packet;
> However I am still getting a bad tcp checksum error. Does anyone know what
> I am missing and point me in the right direction.

Look at the netfilter code, in fact if you are changing values there may already
be a netfilter module to do what you want, and you could have saved the effort.

Stephen Hemminger <>
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:09    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean