summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2013-03-29 12:51:00 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-03-31 18:21:01 +0900
commit3f72ee659de9e5ae82be14b6ef7f6830e02b14a7 (patch)
tree2afd641e5795d973cf5c4f6ecad110bcfdde3763
parent2195ba0e4dea9c6447af646c98c2d1b3a9805130 (diff)
lib/packet/icmpv6: 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/icmpv6.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/ryu/lib/packet/icmpv6.py b/ryu/lib/packet/icmpv6.py
index bcad8841..e3bd7814 100644
--- a/ryu/lib/packet/icmpv6.py
+++ b/ryu/lib/packet/icmpv6.py
@@ -17,6 +17,7 @@ import struct
import sys
import array
import binascii
+
from . import packet_base
from . import packet_utils
from ryu.lib.mac import haddr_to_bin, haddr_to_str
@@ -98,15 +99,8 @@ class icmpv6(packet_base.PacketBase):
hdr += self.data.serialize()
else:
hdr += self.data
- src = prev.src
- dst = prev.dst
- nxt = prev.nxt
if self.csum == 0:
- length = len(str(hdr))
- ph = struct.pack('!16s16sBBH', prev.src, prev.dst, 0, prev.nxt,
- length)
- f = ph + hdr + payload
- self.csum = packet_utils.checksum(f)
+ self.csum = packet_utils.checksum_ip(prev, len(hdr), hdr + payload)
struct.pack_into('!H', hdr, 2, self.csum)
return hdr