the length of opt_header has to be a multiple of 8.

wrong:
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | nxt             | size          | (opt)type=1   | (opt)len=6  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | (opt)data='\x00\x00\x00\x00\x00\x00' (6 octet)                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

right:
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | nxt             | size          | (opt)type=1   | (opt)len=4  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | (opt)data='\x00\x00\x00\x00' (4 octet)                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Signed-off-by: Yuichi Ito <ito.yuic...@gmail.com>
---
 ryu/lib/packet/ipv6.py             |    4 ++--
 ryu/tests/unit/packet/test_ipv6.py |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ryu/lib/packet/ipv6.py b/ryu/lib/packet/ipv6.py
index f5ee038..f70ab58 100644
--- a/ryu/lib/packet/ipv6.py
+++ b/ryu/lib/packet/ipv6.py
@@ -202,8 +202,8 @@ class opt_header(header):
         buf = struct.pack(self._PACK_STR, self.nxt, self.size)
         buf = bytearray(buf)
         if self.data is None:
-            self.data = [option(type_=1, len_=6,
-                                data='\x00\x00\x00\x00\x00\x00')]
+            self.data = [option(type_=1, len_=4,
+                                data='\x00\x00\x00\x00')]
         for opt in self.data:
             buf.extend(opt.serialize())
         return buf
diff --git a/ryu/tests/unit/packet/test_ipv6.py 
b/ryu/tests/unit/packet/test_ipv6.py
index bf4184d..97056f1 100644
--- a/ryu/tests/unit/packet/test_ipv6.py
+++ b/ryu/tests/unit/packet/test_ipv6.py
@@ -503,7 +503,7 @@ class Test_hop_opts(unittest.TestCase):

         eq_(res[0], 6)
         eq_(res[1], 0)
-        opt = ipv6.option(type_=1, len_=6, data='\x00\x00\x00\x00\x00\x00')
+        opt = ipv6.option(type_=1, len_=4, data='\x00\x00\x00\x00')
         eq_(str(buf[2:]), opt.serialize())


@@ -584,7 +584,7 @@ class Test_dst_opts(unittest.TestCase):

         eq_(res[0], 6)
         eq_(res[1], 0)
-        opt = ipv6.option(type_=1, len_=6, data='\x00\x00\x00\x00\x00\x00')
+        opt = ipv6.option(type_=1, len_=4, data='\x00\x00\x00\x00')
         eq_(str(buf[2:]), opt.serialize())


-- 
1.7.10.4


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to