From: John Que <qwejohn@gmail.com>
To: netfilter-devel@lists.netfilter.org
Subject: Checksum of IP header
Date: Sun, 26 Jun 2005 07:18:35 -0400 [thread overview]
Message-ID: <ada605fb050626041856c71794@mail.gmail.com> (raw)
Hello,
I have the following problem
I am developing a server with filtering capabilities.
I had written a driver an I am using the netfilter API,
using the nf_register_hook() and nf_unregister_hook() methods.
In certain occasions , when getting UDP packets on certain ports,
I change the IP address of the destination in the iphdr of the socket
buffer. (sk_buff)
Namely, what I change is :
skb->nh.iph->daddr = newIPAddress (in u32 ).
Everything works OK and the packets are sent to the new
destination as I can see with the sniffer; except foo the csum.
I see in the sniffer that the csum of the ip header is wrong.
I tried to look in the /net/core and /net/ipv4/netfilter
folders to see which
csum methods to use.
There are plenty of methods: just for example , in skbuff.c there is
skb_checksum(),
skb_copy_and_csum_bits(),skb_copy_and_csum_dev(),
and more; in ip_nat_core there is
ip_fast_csum(),csum_partial(),ip_compute_csum(),
and more. So I am quite confused.
I am not an expert on csum and nat , but this seems to me a task
that had been
done somewhere in the nat code (because as I understand part of what nat
does is change the source ip addresses).
I made some tries but did not find a solution - all my tries ended in seeing a
wrong csum in the ip header with the sniffer.
(I know that I can set the csum to 0 but I don't want to do it ).
Any ideas ?
Regards,
John
ReplyForward
YOSHIFUJI Hideaki / 吉藤英明
: > I see in the sniffer that the csum of the ip header is wrong. : > I made ...
4:59 am (2 hours ago)
John Que
to YOSHIFUJI Hide., netdev
More options 5:55 am (1 hour ago)
Thnks;
As I said I am sure that in the code somewhere there is
a method which does this but I cannot locate it because there
are many csum methods.
If anybody knows a scenario like mine and can advice me
as to which methods to use it will be helpful.
John
next reply other threads:[~2005-06-26 11:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-26 11:18 John Que [this message]
2005-06-26 18:13 ` Checksum of IP header Marcus Sundberg
2005-06-27 14:43 ` Kirk
2005-06-28 11:40 ` Nagy Zoltan
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=ada605fb050626041856c71794@mail.gmail.com \
--to=qwejohn@gmail.com \
--cc=netfilter-devel@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.