forked from Mirror/frr
bgpd: changes for code maintainability
these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
This commit is contained in:
parent
fbd743197a
commit
bbfbf3e6b9
|
@ -496,8 +496,8 @@ static char *community_str_get(struct community *com, int i)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str = XSTRDUP(MTYPE_COMMUNITY_STR, "65536:65535");
|
str = XSTRDUP(MTYPE_COMMUNITY_STR, "65536:65535");
|
||||||
as = (comval >> 16) & 0xFFFF;
|
as = CHECK_FLAG((comval >> 16), 0xFFFF);
|
||||||
val = comval & 0xFFFF;
|
val = CHECK_FLAG(comval, 0xFFFF);
|
||||||
snprintf(str, strlen(str), "%u:%d", as, val);
|
snprintf(str, strlen(str), "%u:%d", as, val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,13 +416,12 @@ static void set_community_string(struct community *com, bool make_json,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
as = (comval >> 16) & 0xFFFF;
|
as = CHECK_FLAG((comval >> 16), 0xFFFF);
|
||||||
val = comval & 0xFFFF;
|
val = CHECK_FLAG(comval, 0xFFFF);
|
||||||
char buf[32];
|
char buf[32];
|
||||||
snprintf(buf, sizeof(buf), "%u:%d", as, val);
|
snprintf(buf, sizeof(buf), "%u:%d", as, val);
|
||||||
const char *com2alias =
|
const char *com2alias =
|
||||||
translate_alias ? bgp_community2alias(buf)
|
translate_alias ? bgp_community2alias(buf) : buf;
|
||||||
: buf;
|
|
||||||
|
|
||||||
strlcat(str, com2alias, len);
|
strlcat(str, com2alias, len);
|
||||||
if (make_json) {
|
if (make_json) {
|
||||||
|
|
|
@ -2558,7 +2558,7 @@ static int bgp_debug_per_prefix(const struct prefix *p,
|
||||||
struct bgp_debug_filter *filter;
|
struct bgp_debug_filter *filter;
|
||||||
struct listnode *node, *nnode;
|
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 */
|
/* We are debugging all prefixes so return true */
|
||||||
if (!per_prefix_list || list_isempty(per_prefix_list))
|
if (!per_prefix_list || list_isempty(per_prefix_list))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2591,7 +2591,7 @@ static bool bgp_debug_per_peer(char *host, const struct prefix *p,
|
||||||
struct bgp_debug_filter *filter;
|
struct bgp_debug_filter *filter;
|
||||||
struct listnode *node, *nnode;
|
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 */
|
/* We are debugging all peers so return true */
|
||||||
if (!per_peer_list || list_isempty(per_peer_list))
|
if (!per_peer_list || list_isempty(per_peer_list))
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue