Skip to content

Commit

Permalink
Merge pull request FRRouting#16852 from sri-mohan1/srib-24-frr-a
Browse files Browse the repository at this point in the history
bgpd: changes for code maintainability
  • Loading branch information
donaldsharp authored Sep 18, 2024
2 parents 7a7ae88 + 80c8b98 commit 174d46d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bgpd/bgp_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ struct transit {
__builtin_choose_expr((X) >= 1 && (X) <= 64, 1ULL << ((X)-1), (void)0)

#define BGP_CLUSTER_LIST_LENGTH(attr) \
(((attr)->flag & ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)) \
(CHECK_FLAG((attr)->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST)) \
? bgp_attr_get_cluster((attr))->length \
: 0)

Expand Down
8 changes: 5 additions & 3 deletions bgpd/bgp_attr_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ uint32_t bgp_attr_mac_mobility_seqnum(struct attr *attr)
continue;
flags = *pnt++;

if (flags & ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY_FLAG_STICKY)
if (CHECK_FLAG(flags,
ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY_FLAG_STICKY))
SET_FLAG(attr->evpn_flags, ATTR_EVPN_FLAG_STICKY);
else
UNSET_FLAG(attr->evpn_flags, ATTR_EVPN_FLAG_STICKY);
Expand Down Expand Up @@ -258,11 +259,12 @@ void bgp_attr_evpn_na_flag(struct attr *attr, bool *proxy)
sub_type == ECOMMUNITY_EVPN_SUBTYPE_ND) {
val = *pnt++;

if (val & ECOMMUNITY_EVPN_SUBTYPE_ND_ROUTER_FLAG)
if (CHECK_FLAG(val,
ECOMMUNITY_EVPN_SUBTYPE_ND_ROUTER_FLAG))
SET_FLAG(attr->evpn_flags,
ATTR_EVPN_FLAG_ROUTER);

if (val & ECOMMUNITY_EVPN_SUBTYPE_PROXY_FLAG)
if (CHECK_FLAG(val, ECOMMUNITY_EVPN_SUBTYPE_PROXY_FLAG))
*proxy = true;

break;
Expand Down
4 changes: 2 additions & 2 deletions bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2543,9 +2543,9 @@ DEFPY(bmp_monitor_cfg, bmp_monitor_cmd,

prev = bt->afimon[afi][safi];
if (no)
bt->afimon[afi][safi] &= ~flag;
UNSET_FLAG(bt->afimon[afi][safi], flag);
else
bt->afimon[afi][safi] |= flag;
SET_FLAG(bt->afimon[afi][safi], flag);

if (prev == bt->afimon[afi][safi])
return CMD_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_btoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void attr_parse(struct stream *s, uint16_t len)
flag = stream_getc(s);
type = stream_getc(s);

if (flag & BGP_ATTR_FLAG_EXTLEN)
if (CHECK_FLAG(flag, BGP_ATTR_FLAG_EXTLEN))
length = stream_getw(s);
else
length = stream_getc(s);
Expand Down

0 comments on commit 174d46d

Please sign in to comment.