Skip to content

Commit

Permalink
bgpd: prevent from configuring vrf-policy when in BGP VRF instance
Browse files Browse the repository at this point in the history
Under a BGP VRF instance, prevent from entering in vrf-policy mode. This
mode is reserved for non VRF instances that want to handle several VRF
at the same time.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
  • Loading branch information
pguibert6WIND committed Feb 16, 2018
1 parent 58120f6 commit e2063df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bgpd/rfapi/bgp_rfapi_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2977,6 +2977,11 @@ DEFUN_NOSH (vnc_vrf_policy,
struct rfapi_nve_group_cfg *rfg;
VTY_DECLVAR_CONTEXT(bgp, bgp);

if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) {
vty_out(vty, "Can't configure vrf-policy within a BGP VRF instance\n");
return CMD_WARNING_CONFIG_FAILED;
}

/* Search for name */
rfg = bgp_rfapi_cfg_match_byname(bgp, argv[1]->arg,
RFAPI_GROUP_CFG_VRF);
Expand Down Expand Up @@ -3007,6 +3012,10 @@ DEFUN (vnc_no_vrf_policy,
{
VTY_DECLVAR_CONTEXT(bgp, bgp);

/* silently return */
if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
return CMD_SUCCESS;

return bgp_rfapi_delete_named_nve_group(vty, bgp, argv[2]->arg,
RFAPI_GROUP_CFG_VRF);
}
Expand Down

0 comments on commit e2063df

Please sign in to comment.