summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/lib/packet/tcp.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/ryu/lib/packet/tcp.py b/ryu/lib/packet/tcp.py
index a225847c..a7ef178c 100644
--- a/ryu/lib/packet/tcp.py
+++ b/ryu/lib/packet/tcp.py
@@ -17,7 +17,6 @@ import struct
from . import packet_base
from . import packet_utils
-import ipv4
class tcp(packet_base.PacketBase):
@@ -66,12 +65,6 @@ class tcp(packet_base.PacketBase):
if self.csum == 0:
length = self.length + len(payload)
- if prev.version == 4:
- ph = struct.pack('!IIBBH', prev.src, prev.dst, 0, 6, length)
- elif prev.version == 6:
- ph = struct.pack('!16s16sBBH', prev.src, prev.dst, 0, 6,
- length)
- f = ph + h + payload
- self.csum = packet_utils.checksum(f)
+ self.csum = packet_utils.checksum_ip(prev, length, h + payload)
struct.pack_into('!H', h, 16, self.csum)
return h