From 77f3d6e5208fc6ea8a93ab69086165298a1f4bb7 Mon Sep 17 00:00:00 2001 From: Valerian_He <1826906282@qq.com> Date: Wed, 23 Aug 2023 10:17:08 +0000 Subject: [PATCH] bgpd: fix bug in a place about label validation Shouldn't validate the label after 'decode_label'. If we validate the label after 'decode_label', even the 'MPLS_INVALID_LABEL' will be valid then. Signed-off-by: Valerian_He <1826906282@qq.com> --- bgpd/bgp_route.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index a91292d971..dce8859bc8 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9672,9 +9672,8 @@ void route_vty_out_tag(struct vty *vty, const struct prefix *p, } } - label = decode_label(&path->extra->label[0]); - - if (bgp_is_valid_label(&label)) { + if (bgp_is_valid_label(&path->extra->label[0])) { + label = decode_label(&path->extra->label[0]); if (json) { json_object_int_add(json_out, "notag", label); json_object_array_add(json, json_out); -- 2.39.5