mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 22:06:10 +02:00
packet/bgp: Enable Extended Length flags if specified
Currently, the Extended Length flag in path attributes is evaluated only when the length exceeds 1 byte (max 255) field. This patch enables this flags if explicitly specified. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
b9e4345d5d
commit
31364ba91d
@ -2248,12 +2248,15 @@ class _PathAttribute(StringifyMixin, _TypeDisp, _Value):
|
||||
def serialize(self):
|
||||
# fixup
|
||||
if self._ATTR_FLAGS is not None:
|
||||
self.flags = self.flags \
|
||||
& ~(BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANSITIVE) \
|
||||
| self._ATTR_FLAGS
|
||||
self.flags = (
|
||||
self.flags
|
||||
& ~(BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANSITIVE)
|
||||
| self._ATTR_FLAGS)
|
||||
value = self.serialize_value()
|
||||
self.length = len(value)
|
||||
if self.length > 255:
|
||||
if self.flags & BGP_ATTR_FLAG_EXTENDED_LENGTH:
|
||||
len_pack_str = self._PACK_STR_EXT_LEN
|
||||
elif self.length > 255:
|
||||
self.flags |= BGP_ATTR_FLAG_EXTENDED_LENGTH
|
||||
len_pack_str = self._PACK_STR_EXT_LEN
|
||||
else:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user