mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 23:53:28 +00:00
bgpd: Handle cluster attribute 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
7415f1e120
commit
0a0137da85
@ -167,6 +167,9 @@ static struct cluster_list *cluster_intern(struct cluster_list *cluster)
|
|||||||
|
|
||||||
static void cluster_unintern(struct cluster_list **cluster)
|
static void cluster_unintern(struct cluster_list **cluster)
|
||||||
{
|
{
|
||||||
|
if (!*cluster)
|
||||||
|
return;
|
||||||
|
|
||||||
if ((*cluster)->refcnt)
|
if ((*cluster)->refcnt)
|
||||||
(*cluster)->refcnt--;
|
(*cluster)->refcnt--;
|
||||||
|
|
||||||
@ -1205,11 +1208,8 @@ void bgp_attr_unintern_sub(struct attr *attr)
|
|||||||
bgp_attr_set_lcommunity(attr, NULL);
|
bgp_attr_set_lcommunity(attr, NULL);
|
||||||
|
|
||||||
cluster = bgp_attr_get_cluster(attr);
|
cluster = bgp_attr_get_cluster(attr);
|
||||||
if (cluster) {
|
|
||||||
cluster_unintern(&cluster);
|
cluster_unintern(&cluster);
|
||||||
bgp_attr_set_cluster(attr, cluster);
|
bgp_attr_set_cluster(attr, NULL);
|
||||||
}
|
|
||||||
UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST));
|
|
||||||
|
|
||||||
struct transit *transit = bgp_attr_get_transit(attr);
|
struct transit *transit = bgp_attr_get_transit(attr);
|
||||||
|
|
||||||
@ -2214,8 +2214,6 @@ bgp_attr_cluster_list(struct bgp_attr_parser_args *args)
|
|||||||
/* XXX: Fix cluster_parse to use stream API and then remove this */
|
/* XXX: Fix cluster_parse to use stream API and then remove this */
|
||||||
stream_forward_getp(peer->curr, length);
|
stream_forward_getp(peer->curr, length);
|
||||||
|
|
||||||
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST);
|
|
||||||
|
|
||||||
return BGP_ATTR_PARSE_PROCEED;
|
return BGP_ATTR_PARSE_PROCEED;
|
||||||
|
|
||||||
cluster_list_ignore:
|
cluster_list_ignore:
|
||||||
|
@ -606,6 +606,11 @@ static inline void bgp_attr_set_cluster(struct attr *attr,
|
|||||||
struct cluster_list *cl)
|
struct cluster_list *cl)
|
||||||
{
|
{
|
||||||
attr->cluster1 = cl;
|
attr->cluster1 = cl;
|
||||||
|
|
||||||
|
if (cl)
|
||||||
|
SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST));
|
||||||
|
else
|
||||||
|
UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const struct bgp_route_evpn *
|
static inline const struct bgp_route_evpn *
|
||||||
|
Loading…
Reference in New Issue
Block a user