Skip to content

Commit 6ba0e55

Browse files
committed
Code cleanup.
1 parent 8eac5f5 commit 6ba0e55

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

pytcp/protocols/raw/raw__base.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,6 @@ def __bytes__(self) -> bytes:
101101
_payload[2:4] = inet_cksum(_payload).to_bytes(2)
102102
return bytes(_payload)
103103

104-
# Automatically calculate checksum if IpProto is ICMPv4 or ICMPv6 packet and checksum is not set.
105-
if self._ip_proto == IpProto.UDP and self._payload[6:8] == b"\x00\x00":
106-
_payload = bytearray(self._payload)
107-
_payload[6:8] = inet_cksum(_payload, self.pshdr_sum).to_bytes(2)
108-
return bytes(_payload)
109-
110-
# Automatically calculate checksum if IpProto is TCP packet and checksum is not set.
111-
if (
112-
self._ip_proto == IpProto.TCP
113-
and self._payload[16:18] == b"\x00\x00"
114-
):
115-
_payload = bytearray(self._payload)
116-
_payload[16:18] = inet_cksum(_payload, self.pshdr_sum).to_bytes(2)
117-
return bytes(_payload)
118-
119104
return self._payload
120105

121106
@property

0 commit comments

Comments
 (0)