mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-11 15:26:11 +02:00
packet lib: ipv6: correct a default parameter of opt_header
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.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
f7118a89c1
commit
31c0941fb8
@ -203,8 +203,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
|
||||
|
||||
@ -528,7 +528,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())
|
||||
|
||||
|
||||
@ -609,7 +609,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())
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user