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)
{
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 **);
if (filtered)
count++;
- bgp_attr_undup(&attr, ain->attr);
+ bgp_attr_flush(&attr);
}
}
if (type == bgp_show_adj_route_filtered &&
!route_filtered && ret != RMAP_DENY) {
- bgp_attr_undup(&attr, ain->attr);
+ bgp_attr_flush(&attr);
continue;
}
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) {
(*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;
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);