From: Valerian_He <1826906282@qq.com> Date: Wed, 23 Aug 2023 10:17:08 +0000 (+0000) Subject: bgpd: fix bug in a place about label validation X-Git-Tag: base_9.1~127^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=77f3d6e5208fc6ea8a93ab69086165298a1f4bb7;p=matthieu%2Ffrr.git 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> --- 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);