summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/lib/packet/ipv6.py4
-rw-r--r--ryu/tests/unit/packet/test_ipv6.py11
2 files changed, 11 insertions, 4 deletions
diff --git a/ryu/lib/packet/ipv6.py b/ryu/lib/packet/ipv6.py
index 960f1acb..b02ca51c 100644
--- a/ryu/lib/packet/ipv6.py
+++ b/ryu/lib/packet/ipv6.py
@@ -409,7 +409,7 @@ class auth(header):
_PACK_STR = '!BB2xII'
_MIN_LEN = struct.calcsize(_PACK_STR)
- def __init__(self, nxt=inet.IPPROTO_TCP, size=3, spi=0, seq=0,
+ def __init__(self, nxt=inet.IPPROTO_TCP, size=2, spi=0, seq=0,
data='\x00\x00\x00\x00'):
super(auth, self).__init__(nxt)
assert data is not None
@@ -420,7 +420,7 @@ class auth(header):
@classmethod
def _get_size(cls, size):
- return (int(size) - 1) * 8
+ return (int(size) + 2) * 4
@classmethod
def parser(cls, buf):
diff --git a/ryu/tests/unit/packet/test_ipv6.py b/ryu/tests/unit/packet/test_ipv6.py
index a2a13433..4229b18c 100644
--- a/ryu/tests/unit/packet/test_ipv6.py
+++ b/ryu/tests/unit/packet/test_ipv6.py
@@ -786,7 +786,14 @@ class Test_auth(unittest.TestCase):
eq_(self.data, res[4])
def test_len(self):
- eq_((4 - 1) * 8, len(self.auth))
+ eq_((4 + 2) * 4, len(self.auth))
+
+ def test_len_re(self):
+ size = 5
+ auth = ipv6.auth(
+ 0, size, 256, 1,
+ '\x21\xd3\xa9\x5c\x5f\xfd\x4d\x18\x46\x22\xb9\xf8\xf8\xf8\xf8\xf8')
+ eq_((size + 2) * 4, len(auth))
def test_default_args(self):
hdr = ipv6.auth()
@@ -796,7 +803,7 @@ class Test_auth(unittest.TestCase):
LOG.info(res)
eq_(res[0], 6)
- eq_(res[1], 3)
+ eq_(res[1], 2)
eq_(res[2], 0)
eq_(res[3], 0)
eq_(buf[ipv6.auth._MIN_LEN:], '\x00\x00\x00\x00')