summaryrefslogtreecommitdiff
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2024-08-27 17:49:55 -0400
committerGitHub <noreply@github.com>2024-08-27 17:49:55 -0400
commit0bad64e9ddb6813bc34e2e03f97990e37a0b64b0 (patch)
tree6b9ad8ebfd7c77345866c4f53f64fc6dab51919a /bgpd/bgp_route.c
parent70a43de7568ef6ffa6e068ed0532af0157585f0d (diff)
parent7000f344b30b9a2e3906a661e8a70df2d374eca1 (diff)
Merge pull request #16671 from opensourcerouting/fix/a152692f5ac207b5f55104b18ddc3146089db474_10.1
bgpd: fix labels static-analyser (backport #16655)
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r--bgpd/bgp_route.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 714216c1f8..30698f53a3 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -327,7 +327,7 @@ struct bgp_path_info_extra *bgp_path_info_extra_get(struct bgp_path_info *pi)
bool bgp_path_info_has_valid_label(const struct bgp_path_info *path)
{
- if (!bgp_path_info_num_labels(path))
+ if (!BGP_PATH_INFO_NUM_LABELS(path))
return false;
return bgp_is_valid_label(&path->extra->labels->label[0]);
@@ -339,27 +339,13 @@ bool bgp_path_info_labels_same(const struct bgp_path_info *bpi,
uint8_t bpi_num_labels;
const mpls_label_t *bpi_label;
- bpi_num_labels = bgp_path_info_num_labels(bpi);
+ bpi_num_labels = BGP_PATH_INFO_NUM_LABELS(bpi);
bpi_label = bpi_num_labels ? bpi->extra->labels->label : NULL;
return bgp_labels_same(bpi_label, bpi_num_labels,
(const mpls_label_t *)label, n);
}
-uint8_t bgp_path_info_num_labels(const struct bgp_path_info *pi)
-{
- if (!pi)
- return 0;
-
- if (!pi->extra)
- return 0;
-
- if (!pi->extra->labels)
- return 0;
-
- return pi->extra->labels->num_labels;
-}
-
/* Free bgp route information. */
void bgp_path_info_free_with_caller(const char *name,
struct bgp_path_info *path)
@@ -2249,7 +2235,7 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
* off box as that the RT and RD created are localy
* significant and globaly useless.
*/
- if (safi == SAFI_MPLS_VPN && bgp_path_info_num_labels(pi) &&
+ if (safi == SAFI_MPLS_VPN && BGP_PATH_INFO_NUM_LABELS(pi) &&
pi->extra->labels->label[0] == BGP_PREVENT_VRF_2_VRF_LEAK)
return false;
@@ -6842,7 +6828,7 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p,
bgp, p, pi);
}
} else {
- if (bgp_path_info_num_labels(pi))
+ if (BGP_PATH_INFO_NUM_LABELS(pi))
label = decode_label(
&pi->extra->labels->label[0]);
}
@@ -10514,7 +10500,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
json_nexthop_global = json_object_new_object();
}
- if (bgp_path_info_num_labels(path)) {
+ if (BGP_PATH_INFO_NUM_LABELS(path)) {
bgp_evpn_label2str(path->extra->labels->label,
path->extra->labels->num_labels, vni_buf,
sizeof(vni_buf));