mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 09:20:25 +00:00
bgpd: Fixup / add back some BGP show commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
fd8503f557
commit
8c3deaae51
370
bgpd/bgp_route.c
370
bgpd/bgp_route.c
@ -7430,7 +7430,7 @@ bgp_show_prefix_longer (struct vty *vty, const char *name,
|
|||||||
const char *prefix, afi_t afi,
|
const char *prefix, afi_t afi,
|
||||||
safi_t safi, enum bgp_show_type type);
|
safi_t safi, enum bgp_show_type type);
|
||||||
static int
|
static int
|
||||||
bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi,
|
bgp_show_regexp (struct vty *vty, const char *regstr, afi_t afi,
|
||||||
safi_t safi, enum bgp_show_type type);
|
safi_t safi, enum bgp_show_type type);
|
||||||
static int
|
static int
|
||||||
bgp_show_community (struct vty *vty, const char *view_name, int argc,
|
bgp_show_community (struct vty *vty, const char *view_name, int argc,
|
||||||
@ -8029,7 +8029,7 @@ DEFUN (show_ip_bgp_ipv4,
|
|||||||
[<\
|
[<\
|
||||||
cidr-only\
|
cidr-only\
|
||||||
|community\
|
|community\
|
||||||
|dampening <flap-statistics|dampened-paths>\
|
|dampening <flap-statistics|dampened-paths|parameters>\
|
||||||
|route-map WORD\
|
|route-map WORD\
|
||||||
|prefix-list WORD\
|
|prefix-list WORD\
|
||||||
|filter-list WORD\
|
|filter-list WORD\
|
||||||
@ -8043,15 +8043,15 @@ DEFUN (show_ip_bgp_ipv4,
|
|||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Display only routes with non-natural netmasks\n"
|
"Display only routes with non-natural netmasks\n"
|
||||||
"Display routes matching the communities\n"
|
"Display routes matching the communities\n"
|
||||||
@ -8061,7 +8061,7 @@ DEFUN (show_ip_bgp_ipv4,
|
|||||||
"Display routes matching the route-map\n"
|
"Display routes matching the route-map\n"
|
||||||
"A route-map to match on\n"
|
"A route-map to match on\n"
|
||||||
"Display routes conforming to the prefix-list\n"
|
"Display routes conforming to the prefix-list\n"
|
||||||
"prefix-list name\n"
|
"Prefix-list name\n"
|
||||||
"Display routes conforming to the filter-list\n"
|
"Display routes conforming to the filter-list\n"
|
||||||
"Regular expression access list name\n"
|
"Regular expression access list name\n"
|
||||||
"Display routes matching the communities\n"
|
"Display routes matching the communities\n"
|
||||||
@ -8075,6 +8075,7 @@ DEFUN (show_ip_bgp_ipv4,
|
|||||||
"community-list name\n"
|
"community-list name\n"
|
||||||
"Exact match of the communities\n"
|
"Exact match of the communities\n"
|
||||||
"IPv4 prefix <network>/<length>, e.g., 35.0.0.0/8\n"
|
"IPv4 prefix <network>/<length>, e.g., 35.0.0.0/8\n"
|
||||||
|
"Display route and more specific routes\n"
|
||||||
"IPv6 prefix <network>/<length>\n"
|
"IPv6 prefix <network>/<length>\n"
|
||||||
"Display route and more specific routes\n"
|
"Display route and more specific routes\n"
|
||||||
"JavaScript Object Notation\n")
|
"JavaScript Object Notation\n")
|
||||||
@ -8120,14 +8121,15 @@ DEFUN (show_ip_bgp_ipv4,
|
|||||||
if (strmatch(argv[idx]->text, "cidr-only"))
|
if (strmatch(argv[idx]->text, "cidr-only"))
|
||||||
return bgp_show (vty, bgp, afi, safi, bgp_show_type_cidr_only, NULL, uj);
|
return bgp_show (vty, bgp, afi, safi, bgp_show_type_cidr_only, NULL, uj);
|
||||||
|
|
||||||
else if (strmatch(argv[idx]->text, "dampened-paths"))
|
else if (strmatch(argv[idx]->text, "dampening"))
|
||||||
return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj);
|
{
|
||||||
|
if (argv_find (argv, argc, "dampened-paths", &idx))
|
||||||
else if (strmatch(argv[idx]->text, "flap-statistics"))
|
return bgp_show (vty, bgp, afi, safi, bgp_show_type_dampend_paths, NULL, uj);
|
||||||
return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj);
|
else if (argv_find (argv, argc, "flap-statistics", &idx))
|
||||||
|
return bgp_show (vty, bgp, afi, safi, bgp_show_type_flap_statistics, NULL, uj);
|
||||||
else if (strmatch(argv[idx]->text, "regexp"))
|
else if (argv_find (argv, argc, "parameters", &idx))
|
||||||
return bgp_show_regexp (vty, argc, argv, afi, safi, bgp_show_type_regexp);
|
return bgp_show_dampening_parameters (vty, AFI_IP, SAFI_UNICAST);
|
||||||
|
}
|
||||||
|
|
||||||
else if (strmatch(argv[idx]->text, "prefix-list"))
|
else if (strmatch(argv[idx]->text, "prefix-list"))
|
||||||
return bgp_show_prefix_list (vty, vrf, argv[idx + 1]->arg, afi, safi, bgp_show_type_prefix_list);
|
return bgp_show_prefix_list (vty, vrf, argv[idx + 1]->arg, afi, safi, bgp_show_type_prefix_list);
|
||||||
@ -8156,9 +8158,10 @@ DEFUN (show_ip_bgp_ipv4,
|
|||||||
}
|
}
|
||||||
else if (strmatch(argv[idx]->text, "community-list"))
|
else if (strmatch(argv[idx]->text, "community-list"))
|
||||||
{
|
{
|
||||||
if (strmatch(argv[idx + 2]->text, "exact_match"))
|
const char *clist_number_or_name = argv[++idx]->arg;
|
||||||
|
if (++idx < argc && strmatch (argv[idx]->arg, "exact-match"))
|
||||||
exact_match = 1;
|
exact_match = 1;
|
||||||
return bgp_show_community_list (vty, vrf, argv[idx + 1]->arg, exact_match, afi, safi);
|
return bgp_show_community_list (vty, vrf, clist_number_or_name, exact_match, afi, safi);
|
||||||
}
|
}
|
||||||
/* prefix-longer */
|
/* prefix-longer */
|
||||||
else if (argv[idx]->type == IPV4_TKN || argv[idx]->type == IPV6_TKN)
|
else if (argv[idx]->type == IPV4_TKN || argv[idx]->type == IPV6_TKN)
|
||||||
@ -8176,20 +8179,19 @@ DEFUN (show_ip_bgp_route,
|
|||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Display information for a route distinguisher\n"
|
|
||||||
"VPN Route Distinguisher\n"
|
|
||||||
"Network in the BGP routing table to display\n"
|
"Network in the BGP routing table to display\n"
|
||||||
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
|
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
|
||||||
|
"Network in the BGP routing table to display\n"
|
||||||
"IPv6 prefix <network>/<length>\n"
|
"IPv6 prefix <network>/<length>\n"
|
||||||
"Display only the bestpath\n"
|
"Display only the bestpath\n"
|
||||||
"Display only multipaths\n"
|
"Display only multipaths\n"
|
||||||
@ -8258,6 +8260,55 @@ DEFUN (show_ip_bgp_route,
|
|||||||
return bgp_show_route (vty, vrf, prefix, afi, safi, NULL, prefix_check, path_type, uj);
|
return bgp_show_route (vty, vrf, prefix, afi, safi, NULL, prefix_check, path_type, uj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN (show_ip_bgp_regexp,
|
||||||
|
show_ip_bgp_regexp_cmd,
|
||||||
|
"show [ip] bgp [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] regexp REGEX...",
|
||||||
|
SHOW_STR
|
||||||
|
IP_STR
|
||||||
|
BGP_STR
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Display routes matching the AS path regular expression\n"
|
||||||
|
"A regular-expression to match the BGP AS paths\n")
|
||||||
|
{
|
||||||
|
afi_t afi = AFI_IP6;
|
||||||
|
safi_t safi = SAFI_UNICAST;
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
|
/* [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] */
|
||||||
|
if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx))
|
||||||
|
{
|
||||||
|
afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP;
|
||||||
|
if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx))
|
||||||
|
safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST;
|
||||||
|
}
|
||||||
|
else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx))
|
||||||
|
{
|
||||||
|
afi = AFI_IP;
|
||||||
|
safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN;
|
||||||
|
// advance idx if necessary
|
||||||
|
argv_find (argv, argc, "unicast", &idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get index of regex
|
||||||
|
argv_find (argv, argc, "regexp", &idx);
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
char *regstr = argv_concat (argv, argc, idx);
|
||||||
|
int rc = bgp_show_regexp (vty, (const char *) regstr, afi, safi, bgp_show_type_regexp);
|
||||||
|
XFREE (MTYPE_TMP, regstr);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_instance_all,
|
DEFUN (show_ip_bgp_instance_all,
|
||||||
show_ip_bgp_instance_all_cmd,
|
show_ip_bgp_instance_all_cmd,
|
||||||
"show [ip] bgp <view|vrf> all [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] [json]",
|
"show [ip] bgp <view|vrf> all [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] [json]",
|
||||||
@ -8265,6 +8316,16 @@ DEFUN (show_ip_bgp_instance_all,
|
|||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_ALL_HELP_STR
|
BGP_INSTANCE_ALL_HELP_STR
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
"JavaScript Object Notation\n")
|
"JavaScript Object Notation\n")
|
||||||
{
|
{
|
||||||
afi_t afi = AFI_IP;
|
afi_t afi = AFI_IP;
|
||||||
@ -8298,52 +8359,24 @@ DEFUN (show_ip_bgp_instance_all,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bgp_show_regexp (struct vty *vty, int argc, struct cmd_token **argv, afi_t afi,
|
bgp_show_regexp (struct vty *vty, const char *regstr, afi_t afi,
|
||||||
safi_t safi, enum bgp_show_type type)
|
safi_t safi, enum bgp_show_type type)
|
||||||
{
|
{
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
/* XXX(vtysh-grammar): Needs updating for new CLI backend.
|
|
||||||
|
|
||||||
int i;
|
|
||||||
struct buffer *b;
|
|
||||||
char *regstr;
|
|
||||||
int first;
|
|
||||||
regex_t *regex;
|
regex_t *regex;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
first = 0;
|
|
||||||
b = buffer_new (1024);
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
if (first)
|
|
||||||
buffer_putc (b, ' ');
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((strcmp (argv[i]->arg, "unicast") == 0) || (strcmp (argv[i]->arg, "multicast") == 0))
|
|
||||||
continue;
|
|
||||||
first = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer_putstr (b, argv[i]->arg);
|
|
||||||
}
|
|
||||||
buffer_putc (b, '\0');
|
|
||||||
|
|
||||||
regstr = buffer_getstr (b);
|
|
||||||
buffer_free (b);
|
|
||||||
|
|
||||||
regex = bgp_regcomp (regstr);
|
regex = bgp_regcomp (regstr);
|
||||||
XFREE(MTYPE_TMP, regstr);
|
|
||||||
if (! regex)
|
if (! regex)
|
||||||
{
|
{
|
||||||
vty_out (vty, "Can't compile regexp %s%s", argv[0]->arg,
|
vty_out (vty, "Can't compile regexp %s%s", regstr, VTY_NEWLINE);
|
||||||
VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = bgp_show (vty, NULL, afi, safi, type, regex, 0);
|
rc = bgp_show (vty, NULL, afi, safi, type, regex, 0);
|
||||||
bgp_regex_free (regex);
|
bgp_regex_free (regex);
|
||||||
return rc;
|
return rc;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -8414,7 +8447,7 @@ DEFUN (show_ip_bgp_ipv4_dampening_parameters,
|
|||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Display detailed information about dampening\n"
|
"Display detailed information about dampening\n"
|
||||||
@ -8975,8 +9008,8 @@ DEFUN (show_bgp_statistics,
|
|||||||
"show bgp <ipv4|ipv6> <encap|multicast|unicast|vpn> statistics",
|
"show bgp <ipv4|ipv6> <encap|multicast|unicast|vpn> statistics",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
@ -8994,8 +9027,8 @@ DEFUN (show_bgp_statistics_view,
|
|||||||
SHOW_STR
|
SHOW_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
@ -9253,7 +9286,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts,
|
|||||||
"show bgp ipv6 neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]",
|
"show bgp ipv6 neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
@ -9278,7 +9311,7 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts,
|
|||||||
SHOW_STR
|
SHOW_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
@ -9304,7 +9337,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts,
|
|||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
@ -9335,7 +9368,7 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts,
|
|||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
@ -9598,52 +9631,70 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
|
|||||||
|
|
||||||
DEFUN (show_ip_bgp_instance_neighbor_advertised_route,
|
DEFUN (show_ip_bgp_instance_neighbor_advertised_route,
|
||||||
show_ip_bgp_instance_neighbor_advertised_route_cmd,
|
show_ip_bgp_instance_neighbor_advertised_route_cmd,
|
||||||
"show [ip] bgp [<view|vrf>] WORD [<ipv4 [unicast]|ipv6 [unicast]|encap [unicast]|ipv4 multicast|vpnv4 unicast>] neighbors <A.B.C.D|X:X::X:X|WORD> [<received-routes [route-map WORD]|advertised-routes [route-map WORD]>] [json]",
|
"show [ip] bgp [<view|vrf>] WORD [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] neighbors <A.B.C.D|X:X::X:X|WORD> [<received-routes|advertised-routes> [route-map WORD]] [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
|
"Neighbor on bgp configured interface\n"
|
||||||
"Display the received routes from neighbor\n"
|
"Display the received routes from neighbor\n"
|
||||||
"Route-map to modify the attributes\n"
|
|
||||||
"Name of the route map\n"
|
|
||||||
"Display the routes advertised to a BGP neighbor\n"
|
"Display the routes advertised to a BGP neighbor\n"
|
||||||
"Route-map to modify the attributes\n"
|
"Route-map to modify the attributes\n"
|
||||||
"Name of the route map\n"
|
"Name of the route map\n"
|
||||||
"JavaScript Object Notation\n")
|
"JavaScript Object Notation\n")
|
||||||
{
|
{
|
||||||
int idx_view_vrf = 3;
|
afi_t afi = AFI_IP6;
|
||||||
int idx_vrf = 4;
|
safi_t safi = SAFI_UNICAST;
|
||||||
int idx_afi = 5;
|
|
||||||
int idx_safi = 6;
|
|
||||||
int idx_peer;
|
|
||||||
int idx_adv_recv;
|
|
||||||
int idx_rmap;
|
|
||||||
int rcvd = 0;
|
|
||||||
char *vrf = NULL;
|
char *vrf = NULL;
|
||||||
char *rmap_name = NULL;
|
char *rmap_name = NULL;
|
||||||
|
char *peerstr = NULL;
|
||||||
|
int rcvd;
|
||||||
|
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
afi_t afi;
|
|
||||||
safi_t safi;
|
int idx = 0;
|
||||||
|
|
||||||
|
/* show [ip] bgp */
|
||||||
|
if (argv_find (argv, argc, "ip", &idx))
|
||||||
|
afi = AFI_IP;
|
||||||
|
/* [<view|vrf> WORD] */
|
||||||
|
if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx))
|
||||||
|
vrf = argv[++idx]->arg;
|
||||||
|
/* [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] */
|
||||||
|
if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx))
|
||||||
|
{
|
||||||
|
afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP;
|
||||||
|
if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx))
|
||||||
|
safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST;
|
||||||
|
}
|
||||||
|
else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx))
|
||||||
|
{
|
||||||
|
afi = AFI_IP;
|
||||||
|
safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN;
|
||||||
|
// advance idx if necessary
|
||||||
|
argv_find (argv, argc, "unicast", &idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* neighbors <A.B.C.D|X:X::X:X|WORD> */
|
||||||
|
argv_find (argv, argc, "neighbors", &idx);
|
||||||
|
peerstr = argv[++idx]->arg;
|
||||||
|
|
||||||
u_char uj = use_json(argc, argv);
|
u_char uj = use_json(argc, argv);
|
||||||
|
|
||||||
vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi);
|
peer = peer_lookup_in_view (vty, vrf, peerstr, uj);
|
||||||
idx_safi = idx_afi + 1;
|
|
||||||
bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_peer);
|
|
||||||
|
|
||||||
peer = peer_lookup_in_view (vty, vrf, argv[idx_peer]->arg, uj);
|
|
||||||
|
|
||||||
if (! peer)
|
if (! peer)
|
||||||
{
|
{
|
||||||
@ -9651,32 +9702,24 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route,
|
|||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx_adv_recv = idx_peer + 1;
|
if (argv_find (argv, argc, "received-routes", &idx))
|
||||||
idx_rmap = idx_adv_recv + 2;
|
rcvd = 1;
|
||||||
|
if (argv_find (argv, argc, "advertised-routes", &idx))
|
||||||
if (argc > idx_adv_recv)
|
rcvd = 0;
|
||||||
{
|
if (argv_find (argv, argc, "route-map", &idx))
|
||||||
if (strmatch(argv[idx_adv_recv]->text, "received-routes"))
|
rmap_name = argv[++idx]->arg;
|
||||||
rcvd = 1;
|
|
||||||
else if (strmatch(argv[idx_adv_recv]->text, "advertised-routes"))
|
|
||||||
rcvd = 0;
|
|
||||||
|
|
||||||
if (argc > idx_rmap)
|
|
||||||
rmap_name = argv[idx_rmap]->arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
return peer_adj_routes (vty, peer, afi, safi, rcvd, rmap_name, uj);
|
return peer_adj_routes (vty, peer, afi, safi, rcvd, rmap_name, uj);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
|
DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
|
||||||
show_ip_bgp_neighbor_received_prefix_filter_cmd,
|
show_ip_bgp_neighbor_received_prefix_filter_cmd,
|
||||||
"show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [unicast]] neighbors <A.B.C.D|X:X::X:X|WORD> received prefix-filter [json]",
|
"show [ip] bgp [<ipv4|ipv6> [unicast]] neighbors <A.B.C.D|X:X::X:X|WORD> received prefix-filter [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
"Address Family\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
@ -9686,35 +9729,41 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
|
|||||||
"Display the prefixlist filter\n"
|
"Display the prefixlist filter\n"
|
||||||
"JavaScript Object Notation\n")
|
"JavaScript Object Notation\n")
|
||||||
{
|
{
|
||||||
int idx_view_vrf = 3;
|
afi_t afi = AFI_IP6;
|
||||||
int idx_vrf = 4;
|
safi_t safi = SAFI_UNICAST;
|
||||||
int idx_afi;
|
char *peerstr = NULL;
|
||||||
int idx_safi;
|
|
||||||
int idx_neighbors;
|
|
||||||
int idx_peer;
|
|
||||||
afi_t afi;
|
|
||||||
safi_t safi;
|
|
||||||
char name[BUFSIZ];
|
char name[BUFSIZ];
|
||||||
union sockunion su;
|
union sockunion su;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
int count, ret;
|
int count, ret;
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
|
/* show [ip] bgp */
|
||||||
|
if (argv_find (argv, argc, "ip", &idx))
|
||||||
|
afi = AFI_IP;
|
||||||
|
/* [<ipv4|ipv6> [unicast]] */
|
||||||
|
if (argv_find (argv, argc, "ipv4", &idx))
|
||||||
|
afi = AFI_IP;
|
||||||
|
if (argv_find (argv, argc, "ipv6", &idx))
|
||||||
|
afi = AFI_IP6;
|
||||||
|
/* neighbors <A.B.C.D|X:X::X:X|WORD> */
|
||||||
|
argv_find (argv, argc, "neighbors", &idx);
|
||||||
|
peerstr = argv[++idx]->arg;
|
||||||
|
|
||||||
u_char uj = use_json(argc, argv);
|
u_char uj = use_json(argc, argv);
|
||||||
|
|
||||||
bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi);
|
ret = str2sockunion (peerstr, &su);
|
||||||
idx_safi = idx_afi + 1;
|
|
||||||
bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_neighbors);
|
|
||||||
idx_peer = idx_neighbors + 1;
|
|
||||||
|
|
||||||
ret = str2sockunion (argv[idx_peer]->arg, &su);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
peer = peer_lookup_by_conf_if (NULL, argv[idx_peer]->arg);
|
peer = peer_lookup_by_conf_if (NULL, peerstr);
|
||||||
if (! peer)
|
if (! peer)
|
||||||
{
|
{
|
||||||
if (uj)
|
if (uj)
|
||||||
vty_out (vty, "{}%s", VTY_NEWLINE);
|
vty_out (vty, "{}%s", VTY_NEWLINE);
|
||||||
else
|
else
|
||||||
vty_out (vty, "%% Malformed address or name: %s%s", argv[idx_peer]->arg, VTY_NEWLINE);
|
vty_out (vty, "%% Malformed address or name: %s%s", peerstr, VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9736,7 +9785,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
|
|||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
if (!uj)
|
if (!uj)
|
||||||
vty_out (vty, "Address family: %s%s", afi_safi_print(afi, safi), VTY_NEWLINE);
|
vty_out (vty, "Address Family: %s%s", afi_safi_print(afi, safi), VTY_NEWLINE);
|
||||||
prefix_bgp_show_prefix_list (vty, afi, name, uj);
|
prefix_bgp_show_prefix_list (vty, afi, name, uj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -9774,61 +9823,79 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi,
|
|||||||
|
|
||||||
DEFUN (show_ip_bgp_neighbor_routes,
|
DEFUN (show_ip_bgp_neighbor_routes,
|
||||||
show_ip_bgp_neighbor_routes_cmd,
|
show_ip_bgp_neighbor_routes_cmd,
|
||||||
"show [ip] bgp [<view|vrf> WORD] [<ipv4 [unicast]|ipv6 [unicast]|encap [unicast]|ipv4 multicast|vpnv4 unicast>] neighbors <A.B.C.D|X:X::X:X|WORD> <flap-statistics|dampened-routes|routes> [json]",
|
"show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] neighbors <A.B.C.D|X:X::X:X|WORD> <flap-statistics|dampened-routes|routes> [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address family\n"
|
|
||||||
"Address family\n"
|
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
"Neighbor on bgp configured interface\n"
|
"Neighbor on bgp configured interface\n"
|
||||||
"Display routes learned from neighbor\n"
|
|
||||||
"Display the dampened routes received from neighbor\n"
|
|
||||||
"Display flap statistics of the routes learned from neighbor\n"
|
"Display flap statistics of the routes learned from neighbor\n"
|
||||||
|
"Display the dampened routes received from neighbor\n"
|
||||||
|
"Display routes learned from neighbor\n"
|
||||||
"JavaScript Object Notation\n")
|
"JavaScript Object Notation\n")
|
||||||
{
|
{
|
||||||
int idx_view_vrf = 3;
|
|
||||||
int idx_vrf = 4;
|
|
||||||
int idx_afi;
|
|
||||||
int idx_safi;
|
|
||||||
int idx_peer;
|
|
||||||
int idx_sh_type;
|
|
||||||
char *vrf = NULL;
|
char *vrf = NULL;
|
||||||
afi_t afi;
|
char *peerstr = NULL;
|
||||||
safi_t safi;
|
|
||||||
|
afi_t afi = AFI_IP6;
|
||||||
|
safi_t safi = SAFI_UNICAST;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
enum bgp_show_type sh_type = bgp_show_type_neighbor;
|
enum bgp_show_type sh_type = bgp_show_type_neighbor;
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
|
/* show [ip] bgp */
|
||||||
|
if (argv_find (argv, argc, "ip", &idx))
|
||||||
|
afi = AFI_IP;
|
||||||
|
/* [<view|vrf> WORD] */
|
||||||
|
if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx))
|
||||||
|
vrf = argv[++idx]->arg;
|
||||||
|
/* [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] */
|
||||||
|
if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx))
|
||||||
|
{
|
||||||
|
afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP;
|
||||||
|
if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx))
|
||||||
|
safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST;
|
||||||
|
}
|
||||||
|
else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx))
|
||||||
|
{
|
||||||
|
afi = AFI_IP;
|
||||||
|
safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN;
|
||||||
|
// advance idx if necessary
|
||||||
|
argv_find (argv, argc, "unicast", &idx);
|
||||||
|
}
|
||||||
|
/* neighbors <A.B.C.D|X:X::X:X|WORD> */
|
||||||
|
argv_find (argv, argc, "neighbors", &idx);
|
||||||
|
peerstr = argv[++idx]->arg;
|
||||||
|
|
||||||
u_char uj = use_json(argc, argv);
|
u_char uj = use_json(argc, argv);
|
||||||
|
|
||||||
vrf = bgp_get_argv_vrf (argc, argv, &afi, &safi, &idx_view_vrf, &idx_vrf, &idx_afi);
|
peer = peer_lookup_in_view (vty, vrf, peerstr, uj);
|
||||||
idx_safi = idx_afi + 1;
|
|
||||||
bgp_get_argv_afi_safi (argc, argv, idx_afi, idx_safi, &afi, &safi, &idx_peer);
|
|
||||||
|
|
||||||
peer = peer_lookup_in_view (vty, vrf, argv[idx_peer]->arg, uj);
|
|
||||||
if (! peer)
|
if (! peer)
|
||||||
{
|
{
|
||||||
vty_out (vty, "No such neighbor%s", VTY_NEWLINE);
|
vty_out (vty, "No such neighbor%s", VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx_sh_type = idx_peer + 1;
|
if (argv_find (argv, argc, "flap-statistics", &idx))
|
||||||
|
|
||||||
if (strmatch(argv[idx_sh_type]->text, "routes"))
|
|
||||||
sh_type = bgp_show_type_neighbor;
|
|
||||||
|
|
||||||
else if (strmatch(argv[idx_sh_type]->text, "dampened-routes"))
|
|
||||||
sh_type = bgp_show_type_damp_neighbor;
|
|
||||||
|
|
||||||
else if (strmatch(argv[idx_sh_type]->text, "flap-statistics"))
|
|
||||||
sh_type = bgp_show_type_flap_neighbor;
|
sh_type = bgp_show_type_flap_neighbor;
|
||||||
|
else if (argv_find (argv, argc, "dampened-routes", &idx))
|
||||||
|
sh_type = bgp_show_type_damp_neighbor;
|
||||||
|
else if (argv_find (argv, argc, "routes", &idx))
|
||||||
|
sh_type = bgp_show_type_neighbor;
|
||||||
|
|
||||||
return bgp_show_neighbor_route (vty, peer, afi, safi, sh_type, uj);
|
return bgp_show_neighbor_route (vty, peer, afi, safi, sh_type, uj);
|
||||||
}
|
}
|
||||||
@ -10672,6 +10739,7 @@ bgp_route_init (void)
|
|||||||
install_element (VIEW_NODE, &show_ip_bgp_instance_all_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_instance_all_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_route_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_route_cmd);
|
||||||
|
install_element (VIEW_NODE, &show_ip_bgp_regexp_cmd);
|
||||||
|
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd);
|
||||||
|
179
bgpd/bgp_vty.c
179
bgpd/bgp_vty.c
@ -5673,12 +5673,12 @@ DEFUN (no_neighbor_addpath_tx_bestpath_per_as,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Address family configuration. */
|
/* Address Family configuration. */
|
||||||
DEFUN (address_family_ipv4,
|
DEFUN (address_family_ipv4,
|
||||||
address_family_ipv4_cmd,
|
address_family_ipv4_cmd,
|
||||||
"address-family ipv4",
|
"address-family ipv4",
|
||||||
"Enter Address Family command mode\n"
|
"Enter Address Family command mode\n"
|
||||||
"Address family\n")
|
"Address Family\n")
|
||||||
{
|
{
|
||||||
vty->node = BGP_IPV4_NODE;
|
vty->node = BGP_IPV4_NODE;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -5688,7 +5688,7 @@ DEFUN (address_family_ipv4_safi,
|
|||||||
address_family_ipv4_safi_cmd,
|
address_family_ipv4_safi_cmd,
|
||||||
"address-family ipv4 <unicast|multicast>",
|
"address-family ipv4 <unicast|multicast>",
|
||||||
"Enter Address Family command mode\n"
|
"Enter Address Family command mode\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n")
|
"Address Family modifier\n")
|
||||||
{
|
{
|
||||||
@ -5705,7 +5705,7 @@ DEFUN (address_family_ipv6,
|
|||||||
address_family_ipv6_cmd,
|
address_family_ipv6_cmd,
|
||||||
"address-family ipv6",
|
"address-family ipv6",
|
||||||
"Enter Address Family command mode\n"
|
"Enter Address Family command mode\n"
|
||||||
"Address family\n")
|
"Address Family\n")
|
||||||
{
|
{
|
||||||
vty->node = BGP_IPV6_NODE;
|
vty->node = BGP_IPV6_NODE;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -5715,7 +5715,7 @@ DEFUN (address_family_ipv6_safi,
|
|||||||
address_family_ipv6_safi_cmd,
|
address_family_ipv6_safi_cmd,
|
||||||
"address-family ipv6 <unicast|multicast>",
|
"address-family ipv6 <unicast|multicast>",
|
||||||
"Enter Address Family command mode\n"
|
"Enter Address Family command mode\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n")
|
"Address Family modifier\n")
|
||||||
{
|
{
|
||||||
@ -5732,7 +5732,7 @@ DEFUN (address_family_vpnv4,
|
|||||||
address_family_vpnv4_cmd,
|
address_family_vpnv4_cmd,
|
||||||
"address-family vpnv4 [unicast]",
|
"address-family vpnv4 [unicast]",
|
||||||
"Enter Address Family command mode\n"
|
"Enter Address Family command mode\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family Modifier\n")
|
"Address Family Modifier\n")
|
||||||
{
|
{
|
||||||
vty->node = BGP_VPNV4_NODE;
|
vty->node = BGP_VPNV4_NODE;
|
||||||
@ -5743,7 +5743,7 @@ DEFUN (address_family_vpnv6,
|
|||||||
address_family_vpnv6_cmd,
|
address_family_vpnv6_cmd,
|
||||||
"address-family vpnv6 [unicast]",
|
"address-family vpnv6 [unicast]",
|
||||||
"Enter Address Family command mode\n"
|
"Enter Address Family command mode\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family Modifier\n")
|
"Address Family Modifier\n")
|
||||||
{
|
{
|
||||||
vty->node = BGP_VPNV6_NODE;
|
vty->node = BGP_VPNV6_NODE;
|
||||||
@ -5754,8 +5754,8 @@ DEFUN (address_family_encap,
|
|||||||
address_family_encap_cmd,
|
address_family_encap_cmd,
|
||||||
"address-family <encap|encapv4>",
|
"address-family <encap|encapv4>",
|
||||||
"Enter Address Family command mode\n"
|
"Enter Address Family command mode\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address family\n")
|
"Address Family\n")
|
||||||
{
|
{
|
||||||
vty->node = BGP_ENCAP_NODE;
|
vty->node = BGP_ENCAP_NODE;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -5766,7 +5766,7 @@ DEFUN (address_family_encapv6,
|
|||||||
address_family_encapv6_cmd,
|
address_family_encapv6_cmd,
|
||||||
"address-family encapv6",
|
"address-family encapv6",
|
||||||
"Enter Address Family command mode\n"
|
"Enter Address Family command mode\n"
|
||||||
"Address family\n")
|
"Address Family\n")
|
||||||
{
|
{
|
||||||
vty->node = BGP_ENCAPV6_NODE;
|
vty->node = BGP_ENCAPV6_NODE;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -5870,109 +5870,6 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
|
||||||
bgp_get_argv_vrf (int argc, struct cmd_token **argv, afi_t *afi, safi_t *safi,
|
|
||||||
int *idx_view_vrf, int *idx_vrf, int *idx_next_token)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* The DEFUN that calls this MUST begin with one of the following
|
|
||||||
* clear [ip] bgp [<view|vrf> WORD]
|
|
||||||
* show [ip] bgp [<view|vrf> WORD]
|
|
||||||
*
|
|
||||||
* We will do the following
|
|
||||||
* - set the afi/safi
|
|
||||||
* - decrement the idx_view_vrf and idx_vrf pointers if needed
|
|
||||||
* - return a pointer to the vrf name
|
|
||||||
*/
|
|
||||||
int idx_ip = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the user does "<clear|show> ip bgp" then we default the afi safi to ipv4 unicast.
|
|
||||||
* If the user does "<clear|show> bgp" then we default the afi safi to ipv6 unicast.
|
|
||||||
* This may be over-written later in the command if they explicitly
|
|
||||||
* specify an afi safi.
|
|
||||||
*/
|
|
||||||
if (strmatch(argv[idx_ip]->text, "ip"))
|
|
||||||
{
|
|
||||||
*afi = AFI_IP;
|
|
||||||
*safi = SAFI_UNICAST;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*afi = AFI_IP6;
|
|
||||||
*safi = SAFI_UNICAST;
|
|
||||||
*idx_view_vrf = *idx_view_vrf - 1;
|
|
||||||
*idx_vrf = *idx_vrf - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc > *idx_vrf)
|
|
||||||
if (strmatch(argv[*idx_view_vrf]->text, "view") || strmatch(argv[*idx_view_vrf]->text, "vrf"))
|
|
||||||
{
|
|
||||||
*idx_next_token = *idx_vrf + 1;
|
|
||||||
return argv[*idx_vrf]->arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
*idx_next_token = *idx_view_vrf;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
bgp_get_argv_afi_safi (int argc, struct cmd_token **argv,
|
|
||||||
int idx_afi, int idx_safi,
|
|
||||||
afi_t *afi, safi_t *safi,
|
|
||||||
int *idx_next_token)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* The DEFUN that calls this must use
|
|
||||||
* <ipv4 unicast|ipv4 multicast|ipv6 unicast|vpnv4 unicast|encap unicast>
|
|
||||||
*/
|
|
||||||
if (strmatch(argv[idx_afi]->text, "ipv4"))
|
|
||||||
{
|
|
||||||
*afi = AFI_IP;
|
|
||||||
|
|
||||||
if (strmatch(argv[idx_safi]->text, "unicast"))
|
|
||||||
*safi = SAFI_UNICAST;
|
|
||||||
else if (strmatch(argv[idx_safi]->text, "multicast"))
|
|
||||||
*safi = SAFI_MULTICAST;
|
|
||||||
|
|
||||||
if (idx_next_token)
|
|
||||||
*idx_next_token = idx_safi + 1;
|
|
||||||
}
|
|
||||||
else if (strmatch(argv[idx_afi]->text, "ipv6"))
|
|
||||||
{
|
|
||||||
*afi = AFI_IP6;
|
|
||||||
|
|
||||||
if (strmatch(argv[idx_safi]->text, "unicast"))
|
|
||||||
*safi = SAFI_UNICAST;
|
|
||||||
else if (strmatch(argv[idx_safi]->text, "multicast"))
|
|
||||||
*safi = SAFI_MULTICAST;
|
|
||||||
|
|
||||||
if (idx_next_token)
|
|
||||||
*idx_next_token = idx_safi + 1;
|
|
||||||
}
|
|
||||||
else if (strmatch(argv[idx_afi]->text, "encap"))
|
|
||||||
{
|
|
||||||
*afi = AFI_IP;
|
|
||||||
*safi = SAFI_ENCAP;
|
|
||||||
|
|
||||||
if (idx_next_token)
|
|
||||||
*idx_next_token = idx_safi + 1;
|
|
||||||
}
|
|
||||||
else if (strmatch(argv[idx_afi]->text, "vpnv4"))
|
|
||||||
{
|
|
||||||
*afi = AFI_IP;
|
|
||||||
|
|
||||||
if (idx_next_token)
|
|
||||||
*idx_next_token = idx_safi + 1;
|
|
||||||
*safi = SAFI_MPLS_VPN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (idx_next_token)
|
|
||||||
*idx_next_token = idx_afi;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* one clear bgp command to rule them all */
|
/* one clear bgp command to rule them all */
|
||||||
DEFUN (clear_ip_bgp_all,
|
DEFUN (clear_ip_bgp_all,
|
||||||
clear_ip_bgp_all_cmd,
|
clear_ip_bgp_all_cmd,
|
||||||
@ -5989,24 +5886,21 @@ DEFUN (clear_ip_bgp_all,
|
|||||||
"Clear all external peers\n"
|
"Clear all external peers\n"
|
||||||
"Clear all members of peer-group\n"
|
"Clear all members of peer-group\n"
|
||||||
"BGP peer-group name\n"
|
"BGP peer-group name\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
|
"Address Family modifier\n"
|
||||||
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
BGP_SOFT_STR
|
|
||||||
BGP_SOFT_STR
|
BGP_SOFT_STR
|
||||||
BGP_SOFT_IN_STR
|
BGP_SOFT_IN_STR
|
||||||
BGP_SOFT_STR
|
|
||||||
BGP_SOFT_OUT_STR
|
BGP_SOFT_OUT_STR
|
||||||
BGP_SOFT_IN_STR
|
BGP_SOFT_IN_STR
|
||||||
"Push out prefix-list ORF and do inbound soft reconfig\n"
|
"Push out prefix-list ORF and do inbound soft reconfig\n"
|
||||||
BGP_SOFT_IN_STR
|
|
||||||
BGP_SOFT_OUT_STR)
|
BGP_SOFT_OUT_STR)
|
||||||
{
|
{
|
||||||
char *vrf = NULL;
|
char *vrf = NULL;
|
||||||
@ -6142,7 +6036,7 @@ DEFUN (clear_bgp_ipv6_safi_prefix,
|
|||||||
"clear bgp ipv6 <unicast|multicast> prefix X:X::X:X/M",
|
"clear bgp ipv6 <unicast|multicast> prefix X:X::X:X/M",
|
||||||
CLEAR_STR
|
CLEAR_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family Modifier\n"
|
"Address Family Modifier\n"
|
||||||
"Clear bestpath and re-advertise\n"
|
"Clear bestpath and re-advertise\n"
|
||||||
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
|
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
|
||||||
@ -6161,7 +6055,7 @@ DEFUN (clear_bgp_instance_ipv6_safi_prefix,
|
|||||||
CLEAR_STR
|
CLEAR_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family Modifier\n"
|
"Address Family Modifier\n"
|
||||||
"Clear bestpath and re-advertise\n"
|
"Clear bestpath and re-advertise\n"
|
||||||
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
|
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
|
||||||
@ -6863,15 +6757,15 @@ DEFUN (show_ip_bgp_summary,
|
|||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Summary of BGP neighbor status\n"
|
"Summary of BGP neighbor status\n"
|
||||||
"JavaScript Object Notation\n")
|
"JavaScript Object Notation\n")
|
||||||
@ -8046,7 +7940,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js
|
|||||||
for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
|
for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
|
||||||
if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
|
if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
|
||||||
{
|
{
|
||||||
vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
|
vty_out (vty, " Address Family %s:", afi_safi_print (afi, safi));
|
||||||
if (p->afc_adv[afi][safi])
|
if (p->afc_adv[afi][safi])
|
||||||
vty_out (vty, " advertised");
|
vty_out (vty, " advertised");
|
||||||
if (p->afc_recv[afi][safi])
|
if (p->afc_recv[afi][safi])
|
||||||
@ -8751,8 +8645,8 @@ DEFUN (show_ip_bgp_neighbors,
|
|||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_ALL_HELP_STR
|
BGP_INSTANCE_ALL_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
@ -8804,7 +8698,7 @@ DEFUN (show_ip_bgp_ipv4_paths,
|
|||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Path information\n")
|
"Path information\n")
|
||||||
@ -8910,15 +8804,15 @@ DEFUN (show_ip_bgp_updgrps,
|
|||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
BGP_INSTANCE_HELP_STR
|
BGP_INSTANCE_HELP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Detailed info about dynamic update groups\n"
|
"Detailed info about dynamic update groups\n"
|
||||||
"Specific subgroup to display detailed info for\n")
|
"Specific subgroup to display detailed info for\n")
|
||||||
@ -9071,8 +8965,8 @@ DEFUN (show_bgp_updgrps_afi_adj,
|
|||||||
"show bgp <ipv4|ipv6> <unicast|multicast> update-groups <advertise-queue|advertised-routes|packet-queue>",
|
"show bgp <ipv4|ipv6> <unicast|multicast> update-groups <advertise-queue|advertised-routes|packet-queue>",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"BGP update groups\n"
|
"BGP update groups\n"
|
||||||
@ -9178,8 +9072,8 @@ DEFUN (show_bgp_updgrps_afi_adj_s,
|
|||||||
"show bgp <ipv4|ipv6> <unicast|multicast> update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
|
"show bgp <ipv4|ipv6> <unicast|multicast> update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address family\n"
|
"Address Family\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"Address Family modifier\n"
|
"Address Family modifier\n"
|
||||||
"BGP update groups\n"
|
"BGP update groups\n"
|
||||||
@ -10104,6 +9998,7 @@ bgp_vty_init (void)
|
|||||||
|
|
||||||
/* "bgp config-type" commands. */
|
/* "bgp config-type" commands. */
|
||||||
install_element (CONFIG_NODE, &bgp_config_type_cmd);
|
install_element (CONFIG_NODE, &bgp_config_type_cmd);
|
||||||
|
install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
|
||||||
|
|
||||||
/* bgp route-map delay-timer commands. */
|
/* bgp route-map delay-timer commands. */
|
||||||
install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd);
|
install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd);
|
||||||
@ -11053,6 +10948,8 @@ bgp_vty_init (void)
|
|||||||
install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd);
|
install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd);
|
||||||
install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
|
install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
|
||||||
install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
|
install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
|
||||||
|
install_element (VIEW_NODE, &show_bgp_updgrps_stats_cmd);
|
||||||
|
install_element (VIEW_NODE, &show_bgp_instance_updgrps_stats_cmd);
|
||||||
|
|
||||||
/* "show ip bgp neighbors" commands. */
|
/* "show ip bgp neighbors" commands. */
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
|
||||||
|
@ -33,14 +33,6 @@ extern int bgp_config_write_wpkt_quanta(struct vty *vty, struct bgp *bgp);
|
|||||||
extern int bgp_config_write_listen(struct vty *vty, struct bgp *bgp);
|
extern int bgp_config_write_listen(struct vty *vty, struct bgp *bgp);
|
||||||
extern int bgp_config_write_coalesce_time(struct vty *vty, struct bgp *bgp);
|
extern int bgp_config_write_coalesce_time(struct vty *vty, struct bgp *bgp);
|
||||||
extern int bgp_vty_return (struct vty *vty, int ret);
|
extern int bgp_vty_return (struct vty *vty, int ret);
|
||||||
extern char *bgp_get_argv_vrf (int argc, struct cmd_token **argv,
|
|
||||||
afi_t *afi, safi_t *safi,
|
|
||||||
int *idx_view_vrf, int *idx_vrf,
|
|
||||||
int *idx_next_token);
|
|
||||||
extern void bgp_get_argv_afi_safi (int argc, struct cmd_token **argv,
|
|
||||||
int idx_afi, int idx_safi,
|
|
||||||
afi_t *afi, safi_t *safi,
|
|
||||||
int *idx_next_token);
|
|
||||||
extern struct peer *
|
extern struct peer *
|
||||||
peer_and_group_lookup_vty (struct vty *vty, const char *peer_str);
|
peer_and_group_lookup_vty (struct vty *vty, const char *peer_str);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user