diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-07-06 15:25:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-07-06 15:48:58 +0900 |
commit | fba7213421bc34430003f770b425f12b6c669a7e (patch) | |
tree | 9e1001d889ab1ad604d78b3208fe16c53bbd9726 | |
parent | 625aefffa2686b138d20ce629a6939aad27a1976 (diff) |
bgp: fix bug of not taking care of withdrawn label
Reported-by: Toshiki Tsuboi <t.tsubo2000@gmail.com>
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.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py index b5d85d28..bd3304ff 100644 --- a/ryu/lib/packet/bgp.py +++ b/ryu/lib/packet/bgp.py @@ -772,6 +772,13 @@ class _BinAddrPrefix(_AddrPrefix): class _LabelledAddrPrefix(_AddrPrefix): _LABEL_PACK_STR = '!3B' + # RFC3107 + # 3. Carrying Label Mapping Information + # The label information carried (as part of NLRI) in the Withdrawn + # Routes field should be set to 0x800000. (Of course, terminating the + # BGP session also withdraws all the previously advertised routes.) + # + _WITHDRAW_LABEL = 0x800000 def __init__(self, length, addr, labels=[], **kwargs): assert isinstance(labels, list) @@ -843,6 +850,8 @@ class _LabelledAddrPrefix(_AddrPrefix): while True: (label, rest) = cls._label_from_bin(rest) + if label == cls._WITHDRAW_LABEL: + break labels.append(label >> 4) if label & 1: # bottom of stack break |