diff options
Diffstat (limited to '')
-rw-r--r-- | bgpd/bgp_vty.c | 63 | ||||
-rwxr-xr-x | vtysh/extract.pl.in | 1 | ||||
-rw-r--r-- | vtysh/vtysh.c | 8 |
3 files changed, 55 insertions, 17 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 17b3b2fdb..3b4ae3db7 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -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); + // "router bgp" without an ASN + if (argc < 1) + { + bgp = bgp_get_default(); - if (argc == 2) - name = argv[1]; + if (bgp == NULL) + { + vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); + return CMD_WARNING; + } - ret = bgp_get (&bgp, &as, name); - switch (ret) + if (listcount(bm->bgp) > 1) + { + vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); + return CMD_WARNING; + } + } + + // "router bgp X" + else { - 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_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); diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 56e711592..da0e4563e 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -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"; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 58014c2e0..5786c68c9 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1043,6 +1043,13 @@ DEFUNSH (VTYSH_BGPD, 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, "router bgp " CMD_AS_RANGE " view WORD", ROUTER_STR @@ -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); |