Skip to content

Commit

Permalink
bgpd: disallow importing a vrf into itself
Browse files Browse the repository at this point in the history
Prior to this fix, you could configure importing a vrf from inside
the same vrf.  This can lead to unexpected behavior in the leaking
process.  This fix disallows that behavior.

Ticket: CM-20539
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
  • Loading branch information
dslicenc authored and donaldsharp committed Apr 25, 2018
1 parent 79ef866 commit 25679ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -6680,6 +6680,14 @@ DEFPY (bgp_imexport_vrf,
afi = bgp_node_afi(vty);
safi = bgp_node_safi(vty);

if (((BGP_INSTANCE_TYPE_DEFAULT == bgp->inst_type)
&& (strcmp(import_name, BGP_DEFAULT_NAME) == 0))
|| (bgp->name && (strcmp(import_name, bgp->name) == 0))) {
vty_out(vty, "%% Cannot %s vrf %s into itself\n",
remove ? "unimport" : "import", import_name);
return CMD_WARNING;
}

bgp_default = bgp_get_default();
if (!bgp_default) {
/* Auto-create assuming the same AS */
Expand Down

0 comments on commit 25679ca

Please sign in to comment.