mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 17:13:46 +00:00
bgpd: Handle transit attributes the same way as others using setters/getters
To be consistent and error-safe. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
0a0137da85
commit
09b4537755
@ -421,6 +421,9 @@ static struct transit *transit_intern(struct transit *transit)
|
|||||||
|
|
||||||
static void transit_unintern(struct transit **transit)
|
static void transit_unintern(struct transit **transit)
|
||||||
{
|
{
|
||||||
|
if (!*transit)
|
||||||
|
return;
|
||||||
|
|
||||||
if ((*transit)->refcnt)
|
if ((*transit)->refcnt)
|
||||||
(*transit)->refcnt--;
|
(*transit)->refcnt--;
|
||||||
|
|
||||||
@ -1186,6 +1189,7 @@ void bgp_attr_unintern_sub(struct attr *attr)
|
|||||||
struct cluster_list *cluster;
|
struct cluster_list *cluster;
|
||||||
struct lcommunity *lcomm = NULL;
|
struct lcommunity *lcomm = NULL;
|
||||||
struct community *comm = NULL;
|
struct community *comm = NULL;
|
||||||
|
struct transit *transit;
|
||||||
|
|
||||||
/* aspath refcount shoud be decrement. */
|
/* aspath refcount shoud be decrement. */
|
||||||
aspath_unintern(&attr->aspath);
|
aspath_unintern(&attr->aspath);
|
||||||
@ -1211,12 +1215,9 @@ void bgp_attr_unintern_sub(struct attr *attr)
|
|||||||
cluster_unintern(&cluster);
|
cluster_unintern(&cluster);
|
||||||
bgp_attr_set_cluster(attr, NULL);
|
bgp_attr_set_cluster(attr, NULL);
|
||||||
|
|
||||||
struct transit *transit = bgp_attr_get_transit(attr);
|
transit = bgp_attr_get_transit(attr);
|
||||||
|
transit_unintern(&transit);
|
||||||
if (transit) {
|
bgp_attr_set_transit(attr, NULL);
|
||||||
transit_unintern(&transit);
|
|
||||||
bgp_attr_set_transit(attr, transit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attr->encap_subtlvs)
|
if (attr->encap_subtlvs)
|
||||||
encap_unintern(&attr->encap_subtlvs, ENCAP_SUBTLV_TYPE);
|
encap_unintern(&attr->encap_subtlvs, ENCAP_SUBTLV_TYPE);
|
||||||
|
Loading…
Reference in New Issue
Block a user