mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: linux-kernel@vger.kernel.org
Subject: Re: TCP checksum calculation
Date: Thu, 20 Jan 2005 15:32:27 -0800	[thread overview]
Message-ID: <20050120153227.69fd1d55@dxpl.pdx.osdl.net> (raw)
In-Reply-To: <Pine.GSO.4.58.0501201541510.13444@chrome.njit.edu>

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>

      reply	other threads:[~2005-01-20 23:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-20 20:52 Rahul Jain
2005-01-20 23:32 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050120153227.69fd1d55@dxpl.pdx.osdl.net \
    --to=shemminger@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®