From aeadbd9e1931ef560a74e79561dff3f0108eeb7d Mon Sep 17 00:00:00 2001 From: zyxwvu Shi Date: Mon, 8 Feb 2021 20:09:02 +0800 Subject: [PATCH] bgpd: Do not compare attr again. `same_attr` has been computed and `hook_call(bgp_process)` (calling BMP module) would not change it. We could reuse the value to filter same attribute updates, avoiding an extra comparison. Signed-off-by: zyxwvu Shi --- bgpd/bgp_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 0ac9a42dc5..7f05dcc167 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3799,7 +3799,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, /* Same attribute comes in. */ if (!CHECK_FLAG(pi->flags, BGP_PATH_REMOVED) - && attrhash_cmp(pi->attr, attr_new) + && same_attr && (!has_valid_label || memcmp(&(bgp_path_info_extra_get(pi))->label, label, num_labels * sizeof(mpls_label_t))