Skip to content

Commit

Permalink
Endians problem in TCP checksum field . last 2 byte get swaped .
Browse files Browse the repository at this point in the history
  • Loading branch information
g-ranjan143 committed Aug 22, 2011
1 parent f56752f commit 84a7f24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion umit/umpa/protocols/TCP.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,8 @@ def _post_raw(self, raw_value, bit, protocol_container, protocol_bits):
pheader_raw = pheader.get_raw(protocol_container, protocol_bits)[0]
cksum |= pheader_raw << offset
raw_cksum = _net.in_cksum(cksum)
cksum_cal = ((raw_cksum << 8) | (raw_cksum >> 8)) & 0xFFFF
#cksum_cal = ((raw_cksum << 8) | (raw_cksum >> 8)) & 0xFFFF
cksum_cal = raw_cksum
raw_value |= cksum_cal << cksum_rev_offset
elif isinstance(proto, IP):
pheader = _layer4.PseudoHeader(self.protocol_id, total_length)
Expand Down
3 changes: 2 additions & 1 deletion umit/umpa/protocols/UDP.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ def _post_raw(self, raw_value, bit, protocol_container, protocol_bits):
pheader_raw = pheader.get_raw(protocol_container, protocol_bits)[0]
cksum |= pheader_raw << offset
raw_cksum = _net.in_cksum(cksum)
cksum_cal = ((raw_cksum << 8) | (raw_cksum >> 8)) & 0xFFFF
#cksum_cal = ((raw_cksum << 8) | (raw_cksum >> 8)) & 0xFFFF
cksum_cal = raw_cksum
raw_value |= cksum_cal << cksum_rev_offset
elif isinstance(proto, IP):
pheader = _layer4.PseudoHeader(self.protocol_id,self.get_field('_length').fillout())
Expand Down

0 comments on commit 84a7f24

Please sign in to comment.