The commit fba7213 is incomplete; doesn't parse properly so crashes when serializing.
Reported-by: Toshiki Tsuboi <[email protected]> Signed-off-by: FUJITA Tomonori <[email protected]> Tested-by: Toshiki Tsuboi <[email protected]> --- ryu/lib/packet/bgp.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py index bd3304f..6563ace 100644 --- a/ryu/lib/packet/bgp.py +++ b/ryu/lib/packet/bgp.py @@ -817,7 +817,7 @@ class _LabelledAddrPrefix(_AddrPrefix): labels = addr[0] rest = addr[1:] labels = [x << 4 for x in labels] - if labels: + if labels and labels[-1] != cls._WITHDRAW_LABEL: labels[-1] |= 1 # bottom of stack bin_labels = list(map(cls._label_to_bin, labels)) return bytes(reduce(lambda x, y: x + y, bin_labels, @@ -831,7 +831,7 @@ class _LabelledAddrPrefix(_AddrPrefix): while True: (label, bin_) = cls._label_from_bin(bin_) labels.append(label) - if label & 1: # bottom of stack + if label & 1 or label == cls._WITHDRAW_LABEL: break assert length > struct.calcsize(cls._LABEL_PACK_STR) * len(labels) except struct.error: @@ -850,10 +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 + if label & 1 or label == cls._WITHDRAW_LABEL: break return (labels,) + cls._prefix_from_bin(rest) -- 1.9.5 (Apple Git-50.3) ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
