diff options
author | Isaku Yamahata <yamahata@valinux.co.jp> | 2013-03-29 12:51:01 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-03-31 18:21:01 +0900 |
commit | 4053cda285fab0f896be55d75e11bf0e4283188c (patch) | |
tree | fc9070b866849a1047ce2ee2a47ca1b8b88f79bb | |
parent | 3f72ee659de9e5ae82be14b6ef7f6830e02b14a7 (diff) |
lib/packet/udp: use checksum_ip()
As side effect, IPv6 is also supported.
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/udp.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/ryu/lib/packet/udp.py b/ryu/lib/packet/udp.py index 2944f8a4..518f4fc3 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 |