• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: tcp checksum calculation incorrect - off by 2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tcp checksum calculation incorrect - off by 2


  • Subject: Re: tcp checksum calculation incorrect - off by 2
  • From: Stephane Sudre <email@hidden>
  • Date: Tue, 17 Jul 2007 13:14:10 +0200


On 16 juil. 07, at 15:46, Raj Hariginadoni wrote:

Hi Folks,

I am looking at a driver code for OS X 10.3 where the checksum is
being calculated on an inbound syn-ack. First by zeroing out the
checksum, then calculating the checksum of the pseudo header and
finally calculating the checksum. The checksum functions  used are
available in the xnu sources.
Here is the snippet

[...]

tcplen=26
checksum before =7182
final checksum=7180
tcplen=26
checksum before =2d87
final checksum=2d85
tcplen=26
checksum before =5ab0
final checksum=5aae

I have also observed that the checksum is calculated correctly when
the length of the tcp segment in the packet is 40.

tcplen=40
checksum before =d1cf
final checksum=d1cf
tcplen=40
checksum before =e237
final checksum=e237

Can someone guide me in solving this problem?

Don't take my word for it, but a quick search on google shows that most of the sample codes do something like this:


tcph->th_sum = in_pseudo(iph->ip_src.s_addr, iph->ip_dst.s_addr,htons(IPPROTO_TCP + tcplen));

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >tcp checksum calculation incorrect - off by 2 (From: "Raj Hariginadoni" <email@hidden>)

  • Prev by Date: tcp checksum calculation incorrect - off by 2
  • Next by Date: Problem making a RPC server
  • Previous by thread: tcp checksum calculation incorrect - off by 2
  • Next by thread: Problem making a RPC server
  • Index(es):
    • Date
    • Thread