mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-23 09:52:37 +00:00
bgpd: autocomplete "router bgp" ASN
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
4a11bf2c09
commit
2ed9fe4a2b
@ -925,7 +925,7 @@ DEFUN (no_auto_summary,
|
||||
/* "router bgp" commands. */
|
||||
DEFUN_NOSH (router_bgp,
|
||||
router_bgp_cmd,
|
||||
"router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
|
||||
"router bgp [(1-4294967295)$instasn [<view|vrf> VIEWVRFNAME]]",
|
||||
ROUTER_STR
|
||||
BGP_STR
|
||||
AS_STR
|
||||
@ -1015,7 +1015,7 @@ DEFUN_NOSH (router_bgp,
|
||||
/* "no router bgp" commands. */
|
||||
DEFUN (no_router_bgp,
|
||||
no_router_bgp_cmd,
|
||||
"no router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
|
||||
"no router bgp [(1-4294967295)$instasn [<view|vrf> VIEWVRFNAME]]",
|
||||
NO_STR
|
||||
ROUTER_STR
|
||||
BGP_STR
|
||||
|
23
bgpd/bgpd.c
23
bgpd/bgpd.c
@ -7878,8 +7878,31 @@ static void bgp_viewvrf_autocomplete(vector comps, struct cmd_token *token)
|
||||
}
|
||||
}
|
||||
|
||||
static void bgp_instasn_autocomplete(vector comps, struct cmd_token *token)
|
||||
{
|
||||
struct listnode *next, *next2;
|
||||
struct bgp *bgp, *bgp2;
|
||||
char buf[11];
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(bm->bgp, next, bgp)) {
|
||||
/* deduplicate */
|
||||
for (ALL_LIST_ELEMENTS_RO(bm->bgp, next2, bgp2)) {
|
||||
if (bgp2->as == bgp->as)
|
||||
break;
|
||||
if (bgp2 == bgp)
|
||||
break;
|
||||
}
|
||||
if (bgp2 != bgp)
|
||||
continue;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%u", bgp->as);
|
||||
vector_set(comps, XSTRDUP(MTYPE_COMPLETION, buf));
|
||||
}
|
||||
}
|
||||
|
||||
static const struct cmd_variable_handler bgp_viewvrf_var_handlers[] = {
|
||||
{.tokenname = "VIEWVRFNAME", .completions = bgp_viewvrf_autocomplete},
|
||||
{.varname = "instasn", .completions = bgp_instasn_autocomplete},
|
||||
{.completions = NULL},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user