Skip to content

Commit

Permalink
bgpd: code review comments addressed
Browse files Browse the repository at this point in the history
Signed-off-by: Madhuri Kuruganti <[email protected]>
  • Loading branch information
maduri111 committed Oct 11, 2022
1 parent 87556ba commit ebcc89f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2444,7 +2444,7 @@ static int bgp_config_write_debug(struct vty *vty)

if (CONF_BGP_DEBUG(cond_adv, COND_ADV)) {
vty_out(vty, "debug bgp conditional-advertisement\n");
write++
write++;
}

if (CONF_BGP_DEBUG(optimal_route_reflection, ORR)) {
Expand Down
18 changes: 7 additions & 11 deletions bgpd/bgp_orr.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ int peer_orr_group_unset(struct peer *peer, afi_t afi, safi_t safi,
int bgp_afi_safi_orr_group_set_vty(struct vty *vty, afi_t afi, safi_t safi,
const char *name, const char *primary_str,
const char *secondary_str,
const char *tertiary_str, bool set)
const char *tertiary_str, bool unset)
{
int ret = CMD_WARNING_CONFIG_FAILED;
struct bgp *bgp;
Expand All @@ -567,7 +567,7 @@ int bgp_afi_safi_orr_group_set_vty(struct vty *vty, afi_t afi, safi_t safi,
return ret;
}

if (!set) {
if (unset) {
ret = bgp_afi_safi_orr_group_unset(bgp, afi, safi, name);
if (ret != CMD_SUCCESS)
vty_out(vty,
Expand Down Expand Up @@ -611,7 +611,7 @@ int bgp_afi_safi_orr_group_set_vty(struct vty *vty, afi_t afi, safi_t safi,

/* Set optimal route reflection group name to the peer. */
int peer_orr_group_set_vty(struct vty *vty, const char *ip_str, afi_t afi,
safi_t safi, const char *orr_group_name, bool set)
safi_t safi, const char *orr_group_name, bool unset)
{
int ret = CMD_WARNING_CONFIG_FAILED;
struct peer *peer;
Expand All @@ -626,7 +626,7 @@ int peer_orr_group_set_vty(struct vty *vty, const char *ip_str, afi_t afi,
return ret;
}

if (set) {
if (!unset) {
ret = peer_orr_group_set(peer, afi, safi, orr_group_name);
if (ret != CMD_SUCCESS)
vty_out(vty, "%% ORR Group '%s' is not configured\n",
Expand Down Expand Up @@ -763,13 +763,9 @@ bool peer_orr_rrclient_check(struct peer *peer, afi_t afi, safi_t safi)
return false;

for (ALL_LIST_ELEMENTS_RO(orr_group_list, node, orr_group)) {
/*Check if peer configured as primary/secondary/tertiary root */
if ((orr_group->primary &&
strmatch(peer->host, orr_group->primary->host)) ||
(orr_group->secondary &&
strmatch(peer->host, orr_group->secondary->host)) ||
(orr_group->tertiary &&
strmatch(peer->host, orr_group->tertiary->host)))
/* Check if peer configured as primary/secondary/tertiary root
*/
if (is_orr_root_node(orr_group, peer->host))
return true;
/*
* Check if peer is mapped to any ORR Group in this
Expand Down
4 changes: 2 additions & 2 deletions bgpd/bgp_orr.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ extern int bgp_afi_safi_orr_group_set_vty(struct vty *vty, afi_t afi,
safi_t safi, const char *name,
const char *primary_str,
const char *secondary_str,
const char *tertiary_str, bool set);
const char *tertiary_str, bool unset);
extern int peer_orr_group_unset(struct peer *peer, afi_t afi, safi_t safi,
const char *orr_group_name);
extern int peer_orr_group_set_vty(struct vty *vty, const char *ip_str,
afi_t afi, safi_t safi,
const char *orr_group_name, bool set);
const char *orr_group_name, bool unset);
extern bool peer_orr_rrclient_check(struct peer *peer, afi_t afi, safi_t safi);

extern int bgp_show_orr(struct vty *vty, struct bgp *bgp, afi_t afi,
Expand Down
4 changes: 2 additions & 2 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -6218,7 +6218,7 @@ DEFPY (optimal_route_reflection,
}
return bgp_afi_safi_orr_group_set_vty(
vty, bgp_node_afi(vty), bgp_node_safi(vty), orr_group,
primary_str, secondary_str, tertiary_str, !no);
primary_str, secondary_str, tertiary_str, !!no);
}

/* neighbor optimal-route-reflection group*/
Expand All @@ -6232,7 +6232,7 @@ DEFPY (neighbor_optimal_route_reflection,
"ORR group name\n")
{
return peer_orr_group_set_vty(vty, neighbor, bgp_node_afi(vty),
bgp_node_safi(vty), orr_group, !no);
bgp_node_safi(vty), orr_group, !!no);
}

/* neighbor route-server-client. */
Expand Down

0 comments on commit ebcc89f

Please sign in to comment.