bgpd: Add [bestpath|multipath] option to 'show ip bgp x.x.x.x'
When showing a prefix in bgp allow user to specify output
based upon the bestpath chosen, multipath information of all
information about a prefix(the default)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 48645cf..72e1005 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -6754,7 +6754,7 @@
bgp_show_route_in_table (struct vty *vty, struct bgp *bgp,
struct bgp_table *rib, const char *ip_str,
afi_t afi, safi_t safi, struct prefix_rd *prd,
- int prefix_check)
+ int prefix_check, enum bgp_path_type pathtype)
{
int ret;
int header;
@@ -6805,7 +6805,12 @@
header = 0;
}
display++;
- route_vty_out_detail (vty, bgp, &rm->p, ri, AFI_IP, safi);
+
+ if (pathtype == BGP_PATH_ALL ||
+ (pathtype == BGP_PATH_BESTPATH && CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)) ||
+ (pathtype == BGP_PATH_MULTIPATH &&
+ (CHECK_FLAG (ri->flags, BGP_INFO_MULTIPATH) || CHECK_FLAG (ri->flags, BGP_INFO_SELECTED))))
+ route_vty_out_detail (vty, bgp, &rm->p, ri, AFI_IP, safi);
}
bgp_unlock_node (rm);
@@ -6829,7 +6834,12 @@
header = 0;
}
display++;
- route_vty_out_detail (vty, bgp, &rn->p, ri, afi, safi);
+
+ if (pathtype == BGP_PATH_ALL ||
+ (pathtype == BGP_PATH_BESTPATH && CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)) ||
+ (pathtype == BGP_PATH_MULTIPATH &&
+ (CHECK_FLAG (ri->flags, BGP_INFO_MULTIPATH) || CHECK_FLAG (ri->flags, BGP_INFO_SELECTED))))
+ route_vty_out_detail (vty, bgp, &rn->p, ri, afi, safi);
}
}
@@ -6850,7 +6860,7 @@
static int
bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str,
afi_t afi, safi_t safi, struct prefix_rd *prd,
- int prefix_check)
+ int prefix_check, enum bgp_path_type pathtype)
{
struct bgp *bgp;
@@ -6875,7 +6885,7 @@
}
return bgp_show_route_in_table (vty, bgp, bgp->rib[afi][safi], ip_str,
- afi, safi, prd, prefix_check);
+ afi, safi, prd, prefix_check, pathtype);
}
/* BGP route print out function. */
@@ -6914,7 +6924,47 @@
BGP_STR
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
+}
+
+DEFUN (show_ip_bgp_route_pathtype,
+ show_ip_bgp_route_pathtype_cmd,
+ "show ip bgp A.B.C.D (bestpath|multipath)",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+{
+ if (strncmp (argv[1], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH);
+}
+
+DEFUN (show_bgp_ipv4_safi_route_pathtype,
+ show_bgp_ipv4_safi_route_pathtype_cmd,
+ "show bgp ipv4 (unicast|multicast) A.B.C.D (bestpath|multipath)",
+ SHOW_STR
+ BGP_STR
+ "Address family\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+{
+ if (strncmp (argv[0], "m", 1) == 0)
+ if (strncmp (argv[2], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH);
+ else
+ if (strncmp (argv[2], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH);
}
DEFUN (show_ip_bgp_ipv4_route,
@@ -6929,9 +6979,9 @@
"Network in the BGP routing table to display\n")
{
if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL);
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_ip_bgp_vpnv4_all_route,
@@ -6944,9 +6994,10 @@
"Display information about all VPNv4 NLRIs\n"
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL);
}
+
DEFUN (show_ip_bgp_vpnv4_rd_route,
show_ip_bgp_vpnv4_rd_route_cmd,
"show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D",
@@ -6967,7 +7018,7 @@
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL);
}
DEFUN (show_ip_bgp_prefix,
@@ -6978,7 +7029,23 @@
BGP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
+}
+
+DEFUN (show_ip_bgp_prefix_pathtype,
+ show_ip_bgp_prefix_pathtype_cmd,
+ "show ip bgp A.B.C.D/M (bestpath|multipath)",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+{
+ if (strncmp (argv[1], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH);
}
DEFUN (show_ip_bgp_ipv4_prefix,
@@ -6993,11 +7060,48 @@
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL);
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
+DEFUN (show_ip_bgp_ipv4_prefix_pathtype,
+ show_ip_bgp_ipv4_prefix_pathtype_cmd,
+ "show ip bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath)",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ "Address family\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+{
+ if (strncmp (argv[0], "m", 1) == 0)
+ if (strncmp (argv[2], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH);
+ else
+ if (strncmp (argv[2], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH);
+}
+
+ALIAS (show_ip_bgp_ipv4_prefix_pathtype,
+ show_bgp_ipv4_safi_prefix_pathtype_cmd,
+ "show bgp ipv4 (unicast|multicast) A.B.C.D/M (bestpath|multipath)",
+ SHOW_STR
+ BGP_STR
+ "Address family\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+
DEFUN (show_ip_bgp_vpnv4_all_prefix,
show_ip_bgp_vpnv4_all_prefix_cmd,
"show ip bgp vpnv4 all A.B.C.D/M",
@@ -7008,7 +7112,7 @@
"Display information about all VPNv4 NLRIs\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_ip_bgp_vpnv4_rd_prefix,
@@ -7031,7 +7135,7 @@
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 1);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 1, BGP_PATH_ALL);
}
DEFUN (show_ip_bgp_view,
@@ -7066,7 +7170,7 @@
"View name\n"
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_ip_bgp_view_prefix,
@@ -7079,7 +7183,7 @@
"View name\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp,
@@ -7118,7 +7222,7 @@
BGP_STR
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv4_safi,
@@ -7148,9 +7252,58 @@
"Network in the BGP routing table to display\n")
{
if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL);
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
+}
+
+DEFUN (show_bgp_route_pathtype,
+ show_bgp_route_pathtype_cmd,
+ "show bgp X:X::X:X (bestpath|multipath)",
+ SHOW_STR
+ BGP_STR
+ "Network in the BGP routing table to display\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+{
+ if (strncmp (argv[1], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH);
+}
+
+ALIAS (show_bgp_route_pathtype,
+ show_bgp_ipv6_route_pathtype_cmd,
+ "show bgp ipv6 X:X::X:X (bestpath|multipath)",
+ SHOW_STR
+ BGP_STR
+ "Address family\n"
+ "Network in the BGP routing table to display\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+
+DEFUN (show_bgp_ipv6_safi_route_pathtype,
+ show_bgp_ipv6_safi_route_pathtype_cmd,
+ "show bgp ipv6 (unicast|multicast) X:X::X:X (bestpath|multipath)",
+ SHOW_STR
+ BGP_STR
+ "Address family\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "Network in the BGP routing table to display\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+{
+ if (strncmp (argv[0], "m", 1) == 0)
+ if (strncmp (argv[2], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_MULTIPATH);
+ else
+ if (strncmp (argv[2], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH);
}
DEFUN (show_bgp_ipv4_vpn_route,
@@ -7162,7 +7315,7 @@
"Display VPN NLRI specific information\n"
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv6_vpn_route,
@@ -7174,7 +7327,7 @@
"Display VPN NLRI specific information\n"
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv4_vpn_rd_route,
@@ -7197,7 +7350,7 @@
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv6_vpn_rd_route,
@@ -7220,7 +7373,56 @@
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MPLS_VPN, &prd, 0);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL);
+}
+
+DEFUN (show_bgp_prefix_pathtype,
+ show_bgp_prefix_pathtype_cmd,
+ "show bgp X:X::X:X/M (bestpath|multipath)",
+ SHOW_STR
+ BGP_STR
+ "IPv6 prefix <network>/<length>\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+{
+ if (strncmp (argv[1], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH);
+}
+
+ALIAS (show_bgp_prefix_pathtype,
+ show_bgp_ipv6_prefix_pathtype_cmd,
+ "show bgp ipv6 X:X::X:X/M (bestpath|multipath)",
+ SHOW_STR
+ BGP_STR
+ "Address family\n"
+ "IPv6 prefix <network>/<length>\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+
+DEFUN (show_bgp_ipv6_safi_prefix_pathtype,
+ show_bgp_ipv6_safi_prefix_pathtype_cmd,
+ "show bgp ipv6 (unicast|multicast) X:X::X:X/M (bestpath|multipath)",
+ SHOW_STR
+ BGP_STR
+ "Address family\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
+ "Display only the bestpath\n"
+ "Display only multipaths\n")
+{
+ if (strncmp (argv[0], "m", 1) == 0)
+ if (strncmp (argv[2], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_MULTIPATH);
+ else
+ if (strncmp (argv[2], "b", 1) == 0)
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_BESTPATH);
+ else
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_MULTIPATH);
}
DEFUN (show_bgp_ipv4_encap_route,
@@ -7232,7 +7434,7 @@
"Display ENCAP NLRI specific information\n"
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_ENCAP, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_ENCAP, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv6_encap_route,
@@ -7244,7 +7446,7 @@
"Display ENCAP NLRI specific information\n"
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_ENCAP, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_ENCAP, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv4_safi_rd_route,
@@ -7273,7 +7475,7 @@
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, NULL, argv[2], AFI_IP, safi, &prd, 0);
+ return bgp_show_route (vty, NULL, argv[2], AFI_IP, safi, &prd, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv6_safi_rd_route,
@@ -7302,7 +7504,7 @@
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, NULL, argv[2], AFI_IP6, SAFI_ENCAP, &prd, 0);
+ return bgp_show_route (vty, NULL, argv[2], AFI_IP6, SAFI_ENCAP, &prd, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv4_prefix,
@@ -7313,7 +7515,7 @@
IP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv4_safi_prefix,
@@ -7327,9 +7529,9 @@
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL);
- return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv4_vpn_prefix,
@@ -7341,7 +7543,7 @@
"Display VPN NLRI specific information\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv6_vpn_prefix,
@@ -7353,7 +7555,7 @@
"Display VPN NLRI specific information\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv4_encap_prefix,
@@ -7366,7 +7568,7 @@
"Display information about ENCAP NLRIs\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_ENCAP, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_ENCAP, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv6_encap_prefix,
@@ -7379,7 +7581,7 @@
"Display information about ENCAP NLRIs\n"
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_ENCAP, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_ENCAP, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv4_safi_rd_prefix,
@@ -7409,7 +7611,7 @@
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, NULL, argv[2], AFI_IP, safi, &prd, 1);
+ return bgp_show_route (vty, NULL, argv[2], AFI_IP, safi, &prd, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv6_safi_rd_prefix,
@@ -7439,7 +7641,7 @@
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, NULL, argv[2], AFI_IP6, safi, &prd, 1);
+ return bgp_show_route (vty, NULL, argv[2], AFI_IP6, safi, &prd, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_afi_safi_view,
@@ -7507,7 +7709,7 @@
vty_out (vty, "Error: Bad SAFI: %s%s", argv[1], VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, argv[0], argv[3], afi, safi, NULL, 0);
+ return bgp_show_route (vty, argv[0], argv[3], afi, safi, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_view_afi_safi_prefix,
@@ -7536,7 +7738,7 @@
vty_out (vty, "Error: Bad SAFI: %s%s", argv[1], VTY_NEWLINE);
return CMD_WARNING;
}
- return bgp_show_route (vty, argv[0], argv[3], afi, safi, NULL, 1);
+ return bgp_show_route (vty, argv[0], argv[3], afi, safi, NULL, 1, BGP_PATH_ALL);
}
/* new001 */
@@ -7582,7 +7784,7 @@
"Address family\n"
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv6_safi_route,
@@ -7596,9 +7798,9 @@
"Network in the BGP routing table to display\n")
{
if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL);
- return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
/* old command */
@@ -7610,7 +7812,7 @@
BGP_STR
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_prefix,
@@ -7620,7 +7822,7 @@
BGP_STR
"IPv6 prefix <network>/<length>\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
@@ -7633,7 +7835,7 @@
"Address family\n"
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_ipv6_safi_prefix,
show_bgp_ipv6_safi_prefix_cmd,
@@ -7646,9 +7848,9 @@
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
{
if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL);
- return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
/* old command */
@@ -7660,7 +7862,7 @@
BGP_STR
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_view,
@@ -7715,7 +7917,7 @@
"View name\n"
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_view_ipv6_route,
@@ -7728,7 +7930,7 @@
"Address family\n"
"Network in the BGP routing table to display\n")
{
- return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0);
+ return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
/* old command */
@@ -7752,7 +7954,7 @@
MBGP_STR
"Network in the MBGP routing table to display\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 0);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 0, BGP_PATH_ALL);
}
/* old command */
@@ -7764,7 +7966,7 @@
MBGP_STR
"IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
{
- return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 1);
+ return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_view_prefix,
@@ -7776,7 +7978,7 @@
"View name\n"
"IPv6 prefix <network>/<length>\n")
{
- return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_view_ipv6_prefix,
@@ -7789,7 +7991,7 @@
"Address family\n"
"IPv6 prefix <network>/<length>\n")
{
- return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1);
+ return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
static int
@@ -13533,7 +13735,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][SAFI_UNICAST],
(argc == 3) ? argv[2] : argv[1],
- AFI_IP, SAFI_UNICAST, NULL, 0);
+ AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
ALIAS (show_ip_bgp_view_rsclient_route,
@@ -13790,7 +13992,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][safi],
(argc == 4) ? argv[3] : argv[2],
- AFI_IP, safi, NULL, 0);
+ AFI_IP, safi, NULL, 0, BGP_PATH_ALL);
}
ALIAS (show_bgp_view_ipv4_safi_rsclient_route,
@@ -13872,7 +14074,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][safi],
(argc == 4) ? argv[3] : argv[2],
- AFI_IP, safi, NULL, 1);
+ AFI_IP, safi, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_ip_bgp_view_rsclient_prefix,
@@ -13935,7 +14137,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP][SAFI_UNICAST],
(argc == 3) ? argv[2] : argv[1],
- AFI_IP, SAFI_UNICAST, NULL, 1);
+ AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
ALIAS (show_ip_bgp_view_rsclient_prefix,
@@ -14484,7 +14686,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][SAFI_UNICAST],
(argc == 3) ? argv[2] : argv[1],
- AFI_IP6, SAFI_UNICAST, NULL, 0);
+ AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
DEFUN (show_bgp_view_ipv6_rsclient_route,
@@ -14547,7 +14749,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][SAFI_UNICAST],
(argc == 3) ? argv[2] : argv[1],
- AFI_IP6, SAFI_UNICAST, NULL, 0);
+ AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL);
}
ALIAS (show_bgp_view_ipv6_rsclient_route,
@@ -14635,7 +14837,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][safi],
(argc == 4) ? argv[3] : argv[2],
- AFI_IP6, safi, NULL, 0);
+ AFI_IP6, safi, NULL, 0, BGP_PATH_ALL);
}
ALIAS (show_bgp_view_ipv6_safi_rsclient_route,
@@ -14710,7 +14912,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][SAFI_UNICAST],
(argc == 3) ? argv[2] : argv[1],
- AFI_IP6, SAFI_UNICAST, NULL, 1);
+ AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
DEFUN (show_bgp_view_ipv6_rsclient_prefix,
@@ -14773,7 +14975,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][SAFI_UNICAST],
(argc == 3) ? argv[2] : argv[1],
- AFI_IP6, SAFI_UNICAST, NULL, 1);
+ AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL);
}
ALIAS (show_bgp_view_ipv6_rsclient_prefix,
@@ -14860,7 +15062,7 @@
return bgp_show_route_in_table (vty, bgp, peer->rib[AFI_IP6][safi],
(argc == 4) ? argv[3] : argv[2],
- AFI_IP6, safi, NULL, 1);
+ AFI_IP6, safi, NULL, 1, BGP_PATH_ALL);
}
ALIAS (show_bgp_view_ipv6_safi_rsclient_prefix,
@@ -16419,11 +16621,16 @@
install_element (VIEW_NODE, &show_ip_bgp_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_pathtype_cmd);
+ install_element (VIEW_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd);
install_element (VIEW_NODE, &show_ip_bgp_ipv4_route_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_route_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_route_cmd);
install_element (VIEW_NODE, &show_ip_bgp_prefix_cmd);
install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_cmd);
+ install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd);
+ install_element (VIEW_NODE, &show_bgp_ipv4_safi_prefix_pathtype_cmd);
+ install_element (VIEW_NODE, &show_ip_bgp_prefix_pathtype_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_prefix_cmd);
install_element (VIEW_NODE, &show_ip_bgp_view_cmd);
@@ -16505,10 +16712,15 @@
install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_prefix_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_route_cmd);
+ install_element (RESTRICTED_NODE, &show_ip_bgp_route_pathtype_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_route_pathtype_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_route_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_route_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_prefix_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_prefix_cmd);
+ install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_prefix_pathtype_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_prefix_pathtype_cmd);
+ install_element (RESTRICTED_NODE, &show_ip_bgp_prefix_pathtype_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_prefix_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_prefix_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_view_route_cmd);
@@ -16537,10 +16749,17 @@
install_element (VIEW_NODE, &show_ip_bgp_neighbor_prefix_counts_cmd);
install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd);
+
install_element (VIEW_NODE, &show_bgp_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_cmd);
install_element (VIEW_NODE, &show_bgp_route_cmd);
install_element (VIEW_NODE, &show_bgp_prefix_cmd);
+ install_element (VIEW_NODE, &show_bgp_route_pathtype_cmd);
+ install_element (VIEW_NODE, &show_bgp_ipv6_route_pathtype_cmd);
+ install_element (VIEW_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd);
+ install_element (VIEW_NODE, &show_bgp_prefix_pathtype_cmd);
+ install_element (VIEW_NODE, &show_bgp_ipv6_prefix_pathtype_cmd);
+ install_element (VIEW_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd);
install_element (VIEW_NODE, &show_bgp_regexp_cmd);
install_element (VIEW_NODE, &show_bgp_prefix_list_cmd);
install_element (VIEW_NODE, &show_bgp_filter_list_cmd);
@@ -16579,6 +16798,12 @@
install_element (RESTRICTED_NODE, &show_bgp_route_cmd);
install_element (RESTRICTED_NODE, &show_bgp_prefix_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_route_pathtype_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_ipv6_route_pathtype_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_route_pathtype_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_prefix_pathtype_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_ipv6_prefix_pathtype_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_prefix_pathtype_cmd);
install_element (RESTRICTED_NODE, &show_bgp_community_cmd);
install_element (RESTRICTED_NODE, &show_bgp_community2_cmd);
install_element (RESTRICTED_NODE, &show_bgp_community3_cmd);
@@ -16590,7 +16815,7 @@
install_element (RESTRICTED_NODE, &show_bgp_view_route_cmd);
install_element (RESTRICTED_NODE, &show_bgp_view_prefix_cmd);
install_element (RESTRICTED_NODE, &show_bgp_view_neighbor_received_prefix_filter_cmd);
-
+
install_element (ENABLE_NODE, &show_bgp_statistics_vpnv4_cmd);
install_element (ENABLE_NODE, &show_bgp_statistics_view_vpnv4_cmd);
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 16b6d5a..81df8fa 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -184,6 +184,13 @@
BGP_CLEAR_ROUTE_MY_RSCLIENT
};
+enum bgp_path_type
+{
+ BGP_PATH_ALL,
+ BGP_PATH_BESTPATH,
+ BGP_PATH_MULTIPATH
+};
+
/* Prototypes. */
extern void bgp_route_init (void);
extern void bgp_route_finish (void);