Skip to content

Commit

Permalink
Merge pull request #16768 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
ton31337 authored Sep 10, 2024
2 parents 3c173df + bbfbf3e commit b774fc6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bgpd/bgp_clist.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ static char *community_str_get(struct community *com, int i)
break;
default:
str = XSTRDUP(MTYPE_COMMUNITY_STR, "65536:65535");
as = (comval >> 16) & 0xFFFF;
val = comval & 0xFFFF;
as = CHECK_FLAG((comval >> 16), 0xFFFF);
val = CHECK_FLAG(comval, 0xFFFF);
snprintf(str, strlen(str), "%u:%d", as, val);
break;
}
Expand Down
7 changes: 3 additions & 4 deletions bgpd/bgp_community.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,12 @@ static void set_community_string(struct community *com, bool make_json,
}
break;
default:
as = (comval >> 16) & 0xFFFF;
val = comval & 0xFFFF;
as = CHECK_FLAG((comval >> 16), 0xFFFF);
val = CHECK_FLAG(comval, 0xFFFF);
char buf[32];
snprintf(buf, sizeof(buf), "%u:%d", as, val);
const char *com2alias =
translate_alias ? bgp_community2alias(buf)
: buf;
translate_alias ? bgp_community2alias(buf) : buf;

strlcat(str, com2alias, len);
if (make_json) {
Expand Down
4 changes: 2 additions & 2 deletions bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2558,7 +2558,7 @@ static int bgp_debug_per_prefix(const struct prefix *p,
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;

if (term_bgp_debug_type & BGP_DEBUG_TYPE) {
if (CHECK_FLAG(term_bgp_debug_type, BGP_DEBUG_TYPE)) {
/* We are debugging all prefixes so return true */
if (!per_prefix_list || list_isempty(per_prefix_list))
return 1;
Expand Down Expand Up @@ -2591,7 +2591,7 @@ static bool bgp_debug_per_peer(char *host, const struct prefix *p,
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;

if (term_bgp_debug_type & BGP_DEBUG_TYPE) {
if (CHECK_FLAG(term_bgp_debug_type, BGP_DEBUG_TYPE)) {
/* We are debugging all peers so return true */
if (!per_peer_list || list_isempty(per_peer_list))
return true;
Expand Down

0 comments on commit b774fc6

Please sign in to comment.