diff options
author | Yuichi Ito <ito.yuichi0@gmail.com> | 2013-10-29 18:50:56 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-10-29 21:51:28 +0900 |
commit | 0ced2d9fbca2e4ce1790b7a5c9989a810c13aa55 (patch) | |
tree | 14373d6105745d3367d42243a7b11ae25ea5330c | |
parent | 0dca4fda4ce6f4fd5f7235b73da6237df22c9dca (diff) |
packet lib: sctp: change the timing of the auto calculation
As well as 'length', calculate 'num' automatically at 'serialize()'.
Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/packet/sctp.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ryu/lib/packet/sctp.py b/ryu/lib/packet/sctp.py index 89b57a0d..6ecefd03 100644 --- a/ryu/lib/packet/sctp.py +++ b/ryu/lib/packet/sctp.py @@ -1319,8 +1319,6 @@ class cause_missing_param(cause): for one in types: assert isinstance(one, int) self.types = types - if 0 == num: - num = len(self.types) self.num = num @classmethod @@ -1339,6 +1337,9 @@ class cause_missing_param(cause): self._PACK_STR, self.cause_code(), self.length, self.num)) for one in self.types: buf.extend(struct.pack('!H', one)) + if 0 == self.num: + self.num = len(self.types) + struct.pack_into('!I', buf, 4, self.num) if 0 == self.length: self.length = len(buf) struct.pack_into('!H', buf, 2, self.length) |