LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-31-2009, 03:34 PM   #1
qnguyendang
LQ Newbie
 
Registered: Jan 2003
Posts: 10

Rep: Reputation: 0
Howto update tcp checksum after modifying IP address


Hi everybody,

I am writing a program which modifies source IP address of packet before writing this packet to tap interface. I face only one problem with tcp checksum. I have current checksum, to get new checksum, I add new source IP address and add one complement of old source IP address. That is, I update checksum with difference of old and new source IP address. It sounds not bad but does not work.

Could anybody help me?
Thank in advance.

Nguyen.
 
Old 02-02-2009, 01:46 AM   #2
curos
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 72

Rep: Reputation: 15
I don't know too much about this, but shouldn't you be computing the checksum on the whole TCP header?

From what I can remember, you have to:
1) zero out the checksum field
2) compute the TCP checksum over the whole tcp header
3) put the computed value back into the checksum field.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TCP checksum doubt arun4will Programming 1 05-17-2007 08:53 AM
TCP checksum error mshenbagaraj Programming 3 05-16-2007 02:43 PM
tcp checksum incorrect x1228 Programming 1 09-11-2006 03:53 AM
TCP header checksum live_dont_exist Programming 16 04-13-2005 12:45 PM
anyone can help me with the TCP checksum? vaaub Programming 1 02-10-2004 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration