* TCP checksum calculation
@ 2005-01-20 20:52 Rahul Jain
2005-01-20 23:32 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Rahul Jain @ 2005-01-20 20:52 UTC (permalink / raw)
To: Kernel Traffic Mailing List
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.
Thanks,
Rahul.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: TCP checksum calculation
2005-01-20 20:52 TCP checksum calculation Rahul Jain
@ 2005-01-20 23:32 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2005-01-20 23:32 UTC (permalink / raw)
To: linux-kernel
On Thu, 20 Jan 2005 15:52:34 -0500 (EST)
Rahul Jain <rbj2@oak.njit.edu> 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 <shemminger@osdl.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-01-20 23:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-20 20:52 TCP checksum calculation Rahul Jain
2005-01-20 23:32 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®