Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: changes for code maintainability #16852

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading