summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_route.c68
-rw-r--r--doc/user/bgp.rst9
2 files changed, 34 insertions, 43 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 7018df2ee9..07780e92f6 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -10635,9 +10635,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
#define BGP_SHOW_DAMP_HEADER " Network From Reuse Path\n"
#define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path\n"
-static int bgp_show_prefix_longer(struct vty *vty, struct bgp *bgp,
- const char *prefix, afi_t afi, safi_t safi,
- enum bgp_show_type type);
static int bgp_show_regexp(struct vty *vty, struct bgp *bgp, const char *regstr,
afi_t afi, safi_t safi, enum bgp_show_type type,
bool use_json);
@@ -12004,20 +12001,12 @@ DEFUN(show_ip_bgp_afi_safi_statistics, show_ip_bgp_afi_safi_statistics_cmd,
DEFPY(show_ip_bgp, show_ip_bgp_cmd,
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_CMD_STR
" [" BGP_SAFI_WITH_LABEL_CMD_STR
- "]]\
- <[all$all] dampening <parameters>\
- |A.B.C.D/M longer-prefixes\
- |X:X::X:X/M longer-prefixes\
- >",
+ "]] [all$all] dampening parameters",
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
BGP_SAFI_WITH_LABEL_HELP_STR
"Display the entries for all address families\n"
"Display detailed information about dampening\n"
- "Display detail of configured dampening parameters\n"
- "IPv4 prefix\n"
- "Display route and more specific routes\n"
- "IPv6 prefix\n"
- "Display route and more specific routes\n")
+ "Display detail of configured dampening parameters\n")
{
afi_t afi = AFI_IP6;
safi_t safi = SAFI_UNICAST;
@@ -12046,13 +12035,6 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
show_flags);
}
- /* prefix-longer */
- if (argv_find(argv, argc, "A.B.C.D/M", &idx)
- || argv_find(argv, argc, "X:X::X:X/M", &idx))
- return bgp_show_prefix_longer(vty, bgp, argv[idx]->arg, afi,
- safi,
- bgp_show_type_prefix_longer);
-
return CMD_WARNING;
}
@@ -12076,6 +12058,8 @@ DEFPY(show_ip_bgp_json, show_ip_bgp_json_cmd,
|rpki <invalid|valid|notfound>\
|version (1-4294967295)\
|alias ALIAS_NAME\
+ |A.B.C.D/M longer-prefixes\
+ |X:X::X:X/M longer-prefixes\
] [json$uj [detail$detail] | wide$wide]",
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
BGP_SAFI_WITH_LABEL_HELP_STR
@@ -12117,7 +12101,12 @@ DEFPY(show_ip_bgp_json, show_ip_bgp_json_cmd,
"Display prefixes with matching version numbers\n"
"Version number and above\n"
"Display prefixes with matching BGP community alias\n"
- "BGP community alias\n" JSON_STR
+ "BGP community alias\n"
+ "IPv4 prefix\n"
+ "Display route and more specific routes\n"
+ "IPv6 prefix\n"
+ "Display route and more specific routes\n"
+ JSON_STR
"Display detailed version of JSON output\n"
"Increase table width for longer prefixes\n")
{
@@ -12280,6 +12269,21 @@ DEFPY(show_ip_bgp_json, show_ip_bgp_json_cmd,
output_arg = argv[idx + 1]->arg;
}
+ /* prefix-longer */
+ if (argv_find(argv, argc, "A.B.C.D/M", &idx)
+ || argv_find(argv, argc, "X:X::X:X/M", &idx)) {
+ const char *prefix_str = argv[idx]->arg;
+ struct prefix p;
+
+ if (!str2prefix(prefix_str, &p)) {
+ vty_out(vty, "%% Malformed Prefix\n");
+ return CMD_WARNING;
+ }
+
+ sh_type = bgp_show_type_prefix_longer;
+ output_arg = &p;
+ }
+
if (!all) {
/* show bgp: AFI_IP6, show ip bgp: AFI_IP */
if (community)
@@ -12568,28 +12572,6 @@ static int bgp_show_community(struct vty *vty, struct bgp *bgp,
return ret;
}
-static int bgp_show_prefix_longer(struct vty *vty, struct bgp *bgp,
- const char *prefix, afi_t afi, safi_t safi,
- enum bgp_show_type type)
-{
- int ret;
- struct prefix *p;
- uint16_t show_flags = 0;
-
- p = prefix_new();
-
- ret = str2prefix(prefix, p);
- if (!ret) {
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING;
- }
-
- ret = bgp_show(vty, bgp, afi, safi, type, p, show_flags,
- RPKI_NOT_BEING_USED);
- prefix_free(&p);
- return ret;
-}
-
enum bgp_stats {
BGP_STATS_MAXBITLEN = 0,
BGP_STATS_RIB,
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index ddd184074b..8362e7a744 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -3612,6 +3612,15 @@ structure is extended with :clicmd:`show bgp [afi] [safi]`.
If the ``json`` option is specified, output is displayed in JSON format.
+.. clicmd:: show [ip] bgp [afi] [safi] [all] <A.B.C.D/M|X:X::X:X/M> longer-prefixes [wide|json]
+
+ Displays the specified route and all more specific routes.
+
+ If ``wide`` option is specified, then the prefix table's width is increased
+ to fully display the prefix and the nexthop.
+
+ If the ``json`` option is specified, output is displayed in JSON format.
+
.. clicmd:: show [ip] bgp [afi] [safi] [all] neighbors A.B.C.D [advertised-routes|received-routes|filtered-routes] [json|wide]
Display the routes advertised to a BGP neighbor or received routes