Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp>
---
 ryu/lib/packet/tcp.py |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/ryu/lib/packet/tcp.py b/ryu/lib/packet/tcp.py
index a225847..a7ef178 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
-- 
1.7.10.4


------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to