mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 10:37:29 +00:00
bgpd: remove bgp_attr_undup
bgp_attr_undup does the same thing as bgp_attr_flush – frees the temporary data that might be allocated when applying a route-map. There is no need to have two separate functions for that. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
8aa03a655e
commit
d498917efd
@ -1149,43 +1149,6 @@ void bgp_attr_unintern_sub(struct attr *attr)
|
||||
srv6_vpn_unintern(&attr->srv6_vpn);
|
||||
}
|
||||
|
||||
/*
|
||||
* We have some show commands that let you experimentally
|
||||
* apply a route-map. When we apply the route-map
|
||||
* we are reseting values but not saving them for
|
||||
* posterity via intern'ing( because route-maps don't
|
||||
* do that) but at this point in time we need
|
||||
* to compare the new attr to the old and if the
|
||||
* routemap has changed it we need to, as Snoop Dog says,
|
||||
* Drop it like it's hot
|
||||
*/
|
||||
void bgp_attr_undup(struct attr *new, struct attr *old)
|
||||
{
|
||||
struct ecommunity *ecomm = bgp_attr_get_ecommunity(new);
|
||||
|
||||
if (new->aspath != old->aspath)
|
||||
aspath_free(new->aspath);
|
||||
|
||||
if (new->community != old->community)
|
||||
community_free(&new->community);
|
||||
|
||||
if (ecomm != bgp_attr_get_ecommunity(old))
|
||||
ecommunity_free(&ecomm);
|
||||
|
||||
if (new->lcommunity != old->lcommunity)
|
||||
lcommunity_free(&new->lcommunity);
|
||||
|
||||
if (new->srv6_l3vpn != old->srv6_l3vpn) {
|
||||
srv6_l3vpn_free(new->srv6_l3vpn);
|
||||
new->srv6_l3vpn = NULL;
|
||||
}
|
||||
|
||||
if (new->srv6_vpn != old->srv6_vpn) {
|
||||
srv6_vpn_free(new->srv6_vpn);
|
||||
new->srv6_vpn = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Free bgp attribute and aspath. */
|
||||
void bgp_attr_unintern(struct attr **pattr)
|
||||
{
|
||||
|
@ -394,7 +394,6 @@ extern void bgp_attr_finish(void);
|
||||
extern bgp_attr_parse_ret_t bgp_attr_parse(struct peer *, struct attr *,
|
||||
bgp_size_t, struct bgp_nlri *,
|
||||
struct bgp_nlri *);
|
||||
extern void bgp_attr_undup(struct attr *new, struct attr *old);
|
||||
extern struct attr *bgp_attr_intern(struct attr *attr);
|
||||
extern void bgp_attr_unintern_sub(struct attr *);
|
||||
extern void bgp_attr_unintern(struct attr **);
|
||||
|
@ -3386,7 +3386,7 @@ static uint32_t bgp_filtered_routes_count(struct peer *peer, afi_t afi,
|
||||
if (filtered)
|
||||
count++;
|
||||
|
||||
bgp_attr_undup(&attr, ain->attr);
|
||||
bgp_attr_flush(&attr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13590,7 +13590,7 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
|
||||
|
||||
if (type == bgp_show_adj_route_filtered &&
|
||||
!route_filtered && ret != RMAP_DENY) {
|
||||
bgp_attr_undup(&attr, ain->attr);
|
||||
bgp_attr_flush(&attr);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -13600,7 +13600,7 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
|
||||
|
||||
route_vty_out_tmp(vty, dest, rn_p, &attr, safi,
|
||||
use_json, json_ar, wide);
|
||||
bgp_attr_undup(&attr, ain->attr);
|
||||
bgp_attr_flush(&attr);
|
||||
(*output_count)++;
|
||||
}
|
||||
} else if (type == bgp_show_adj_route_advertised) {
|
||||
@ -13648,7 +13648,7 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
|
||||
(*filtered_count)++;
|
||||
}
|
||||
|
||||
bgp_attr_undup(&attr, adj->attr);
|
||||
bgp_attr_flush(&attr);
|
||||
}
|
||||
} else if (type == bgp_show_adj_route_bestpath) {
|
||||
struct bgp_path_info *pi;
|
||||
|
@ -859,7 +859,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
|
||||
bgp_dest_get_prefix(dest), pi, &tmp_pi);
|
||||
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_undup(&tmp_attr, &attr);
|
||||
bgp_attr_flush(&tmp_attr);
|
||||
continue;
|
||||
} else {
|
||||
new_attr = bgp_attr_intern(&tmp_attr);
|
||||
|
Loading…
Reference in New Issue
Block a user