summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2013-03-29 12:51:02 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-03-31 18:21:01 +0900
commite1414b7fbe2d8d6a20aa4654860453a0ed7bff71 (patch)
treeb227ad8096f608dc3499f73e1730bf48eaf23e3b
parent4053cda285fab0f896be55d75e11bf0e4283188c (diff)
lib/packet/tcp: use checksum_ip()
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-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