From ed165abf905e10b7d8b9b9989c52d9a405c513f1 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 25 Jan 2017 22:33:29 +0100 Subject: [PATCH] bgpd: lcommunity: fix minor issues - route_set_lcommunity would do nothing (and leak memory) if attr->extra wasn't up yet - an if() arch in bgp_show_table() was duplicated (with no effect) Signed-off-by: David Lamparter --- bgpd/bgp_route.c | 5 ----- bgpd/bgp_routemap.c | 5 ++--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index afcf05d2b3..06584cf681 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7426,11 +7426,6 @@ bgp_show_table (struct vty *vty, struct bgp *bgp, struct bgp_table *table, if (! community_list_exact_match (ri->attr->community, list)) continue; } - if (type == bgp_show_type_community_all) - { - if (! ri->attr->community) - continue; - } if (type == bgp_show_type_lcommunity) { struct lcommunity *lcom = output_arg; diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 58d9b20f90..a3c61e2155 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1676,9 +1676,8 @@ route_set_lcommunity (void *rule, struct prefix *prefix, else new = lcommunity_dup (rcs->lcom); - /* will be interned by caller if required */ - if (attr->extra) - attr->extra->lcommunity = new; + /* will be intern()'d or attr_flush()'d by bgp_update_main() */ + (bgp_attr_extra_get (attr))->lcommunity = new; attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_LARGE_COMMUNITIES); } -- 2.39.5