|
|
|
|
||||||
| comp.protocols.tcp-ip TCP and IP network protocols. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I'm developing my own TCP stack and I'm having a problem with calculating the TCP checksum. According to the information I gathered from the internet, the TCP checksum is calculated based on the IP pseudoheader (that is source IP, destination IP, protocol (0x06 for TCP) and overall packet length) and complete TCP header together with data to be sent. The checksum is one's complement of sum of all 16-bit words. I'm almost sure it is calculated correctly as it works ok for the IP header. Do you have any suggestions on what can I be doing wrong? Do I have to convert all header data to network byte order before calculating the checksum (I'm doing it this way now)? Thanks in advance Chris |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
In article <1192353288.702518.237280@q3g2000prf.googlegroups. com>,
autom4gician@gmail.com wrote: > Hi, > > I'm developing my own TCP stack and I'm having a problem with > calculating the TCP checksum. According to the information I gathered > from the internet, the TCP checksum is calculated based on the IP > pseudoheader (that is source IP, destination IP, protocol (0x06 for > TCP) and overall packet length) and complete TCP header together with > data to be sent. The checksum is one's complement of sum of all 16-bit > words. I'm almost sure it is calculated correctly as it works ok for > the IP header. Do you have any suggestions on what can I be doing > wrong? Do I have to convert all header data to network byte order > before calculating the checksum (I'm doing it this way now)? Have you read RFC 1071, "Computing the Internet Checksum"? -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 14 Pa , 19:20, Barry Margolin <bar...@alum.mit.edu> wrote:
> In article <1192353288.702518.237...@q3g2000prf.googlegroups. com>, > > autom4gic...@gmail.com wrote: > > Hi, > > > I'm developing my own TCP stack and I'm having a problem with > > calculating the TCP checksum. According to the information I gathered > > from the internet, the TCP checksum is calculated based on the IP > > pseudoheader (that is source IP, destination IP, protocol (0x06 for > > TCP) and overall packet length) and complete TCP header together with > > data to be sent. The checksum is one's complement of sum of all 16-bit > > words. I'm almost sure it is calculated correctly as it works ok for > > the IP header. Do you have any suggestions on what can I be doing > > wrong? Do I have to convert all header data to network byte order > > before calculating the checksum (I'm doing it this way now)? > > Have you read RFC 1071, "Computing the Internet Checksum"? > > -- > Barry Margolin, bar...@alum.mit.edu > Arlington, MA > *** PLEASE post questions in newsgroups, not directly to me *** > *** PLEASE don't copy me on replies, I'll read them in the group *** I read that RFC, and my algorithm was correct. The problem was with the data - I failed to convert one of the header fields to networkbyte order. I managed to solve my problem, but thanks anyway for your . A calculator seems the best tool in cases like this ![]() Chris |
|
![]() |
| Outils de la discussion | |
|
|