mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 13:02:59 +00:00
BGP: vtysh should accept just "router bgp" if the AS is already defined
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-5674
This commit is contained in:
parent
692c795432
commit
2385a8767a
@ -643,26 +643,48 @@ DEFUN (router_bgp,
|
||||
struct bgp *bgp;
|
||||
const char *name = NULL;
|
||||
|
||||
VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
|
||||
|
||||
if (argc == 2)
|
||||
name = argv[1];
|
||||
|
||||
ret = bgp_get (&bgp, &as, name);
|
||||
switch (ret)
|
||||
// "router bgp" without an ASN
|
||||
if (argc < 1)
|
||||
{
|
||||
case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
|
||||
vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
case BGP_ERR_AS_MISMATCH:
|
||||
vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
case BGP_ERR_INSTANCE_MISMATCH:
|
||||
vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
|
||||
vty_out (vty, "BGP instance is already running; AS is %u%s",
|
||||
as, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
bgp = bgp_get_default();
|
||||
|
||||
if (bgp == NULL)
|
||||
{
|
||||
vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
if (listcount(bm->bgp) > 1)
|
||||
{
|
||||
vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
}
|
||||
|
||||
// "router bgp X"
|
||||
else
|
||||
{
|
||||
VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
|
||||
|
||||
if (argc == 2)
|
||||
name = argv[1];
|
||||
|
||||
ret = bgp_get (&bgp, &as, name);
|
||||
switch (ret)
|
||||
{
|
||||
case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
|
||||
vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
case BGP_ERR_AS_MISMATCH:
|
||||
vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
case BGP_ERR_INSTANCE_MISMATCH:
|
||||
vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
|
||||
vty_out (vty, "BGP instance is already running; AS is %u%s",
|
||||
as, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
}
|
||||
|
||||
vty->node = BGP_NODE;
|
||||
@ -680,6 +702,12 @@ ALIAS (router_bgp,
|
||||
"BGP view\n"
|
||||
"view name\n")
|
||||
|
||||
ALIAS (router_bgp,
|
||||
router_bgp_noasn_cmd,
|
||||
"router bgp",
|
||||
ROUTER_STR
|
||||
BGP_STR)
|
||||
|
||||
/* "no router bgp" commands. */
|
||||
DEFUN (no_router_bgp,
|
||||
no_router_bgp_cmd,
|
||||
@ -12590,6 +12618,7 @@ bgp_vty_init (void)
|
||||
/* "router bgp" commands. */
|
||||
install_element (CONFIG_NODE, &router_bgp_cmd);
|
||||
install_element (CONFIG_NODE, &router_bgp_view_cmd);
|
||||
install_element (CONFIG_NODE, &router_bgp_noasn_cmd);
|
||||
|
||||
/* "no router bgp" commands. */
|
||||
install_element (CONFIG_NODE, &no_router_bgp_cmd);
|
||||
|
@ -39,6 +39,7 @@ $ignore{'"router ospf"'} = "ignore";
|
||||
$ignore{'"router ospf <1-65535>"'} = "ignore";
|
||||
$ignore{'"router ospf6"'} = "ignore";
|
||||
$ignore{'"router babel"'} = "ignore";
|
||||
$ignore{'"router bgp"'} = "ignore";
|
||||
$ignore{'"router bgp " "<1-4294967295>"'} = "ignore";
|
||||
$ignore{'"router bgp " "<1-4294967295>" " view WORD"'} = "ignore";
|
||||
$ignore{'"router isis WORD"'} = "ignore";
|
||||
|
@ -1041,6 +1041,13 @@ DEFUNSH (VTYSH_BGPD,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
ALIAS_SH (VTYSH_BGPD,
|
||||
router_bgp,
|
||||
router_bgp_asn_cmd,
|
||||
"router bgp",
|
||||
ROUTER_STR
|
||||
BGP_STR)
|
||||
|
||||
ALIAS_SH (VTYSH_BGPD,
|
||||
router_bgp,
|
||||
router_bgp_view_cmd,
|
||||
@ -2817,6 +2824,7 @@ vtysh_init_vty (void)
|
||||
install_element (CONFIG_NODE, &router_babel_cmd);
|
||||
install_element (CONFIG_NODE, &router_isis_cmd);
|
||||
install_element (CONFIG_NODE, &router_bgp_cmd);
|
||||
install_element (CONFIG_NODE, &router_bgp_asn_cmd);
|
||||
install_element (CONFIG_NODE, &router_bgp_view_cmd);
|
||||
install_element (BGP_NODE, &address_family_vpnv4_cmd);
|
||||
install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user