mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 13:56:09 +02:00
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>
This commit is contained in:
parent
9606784f68
commit
7a06df454b
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user