summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2014-08-18 09:19:10 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-08-18 14:14:55 +0900
commit7a06df454b89a33472925121d71e71d213238989 (patch)
tree21628325af07e771e165e6a632c1c7894a1dd90f
parent9606784f68cf6092c23f3833a108325b2e3b085b (diff)
bgp: make reserved private variable
reserved field must be 0. this patch add an assertion and make reserved field invisible when stringified Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/packet/bgp.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py
index ff6fdd0c..60e3b49c 100644
--- a/ryu/lib/packet/bgp.py
+++ b/ryu/lib/packet/bgp.py
@@ -1982,7 +1982,7 @@ class BGPPathAttributeMpReachNLRI(_PathAttribute):
self._next_hop_bin = addrconv.ipv6.text_to_bin(next_hop)
else:
raise ValueError('Invalid address familly(%d)' % afi)
- self.reserved = reserved
+ self._reserved = reserved
self.nlri = nlri
addr_cls = _get_addr_class(afi, safi)
for i in nlri:
@@ -1996,6 +1996,7 @@ class BGPPathAttributeMpReachNLRI(_PathAttribute):
next_hop_bin = rest[:next_hop_len]
rest = rest[next_hop_len:]
reserved = rest[:1]
+ assert reserved == '\0'
binnlri = rest[1:]
addr_cls = _get_addr_class(afi, safi)
nlri = []
@@ -2039,13 +2040,13 @@ class BGPPathAttributeMpReachNLRI(_PathAttribute):
next_hop_len = self.next_hop_len
next_hop_bin = self._next_hop_bin
- self.reserved = '\0'
+ self._reserved = '\0'
buf = bytearray()
msg_pack_into(self._VALUE_PACK_STR, buf, 0, self.afi,
self.safi, next_hop_len)
buf += next_hop_bin
- buf += self.reserved
+ buf += self._reserved
binnlri = bytearray()
for n in self.nlri:
binnlri += n.serialize()