As side effect, IPv6 is also supported.

Signed-off-by: Isaku Yamahata <[email protected]>
---
 ryu/lib/packet/udp.py |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/ryu/lib/packet/udp.py b/ryu/lib/packet/udp.py
index 2944f8a..518f4fc 100644
--- a/ryu/lib/packet/udp.py
+++ b/ryu/lib/packet/udp.py
@@ -17,7 +17,6 @@ import struct
 
 from . import packet_base
 from . import packet_utils
-import ipv4
 
 
 class udp(packet_base.PacketBase):
@@ -45,10 +44,8 @@ class udp(packet_base.PacketBase):
         h = struct.pack(udp._PACK_STR, self.src_port, self.dst_port,
                         self.total_length, self.csum)
         if self.csum == 0:
-            ph = struct.pack('!IIBBH', prev.src, prev.dst, 0, 17,
-                             self.total_length)
-            f = ph + h + payload
-            self.csum = packet_utils.checksum(f)
+            self.csum = packet_utils.checksum_ip(
+                prev, self.total_length, h + payload)
             h = struct.pack(udp._PACK_STR, self.src_port, self.dst_port,
                             self.total_length, 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to