summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSri Mohana Singamsetty <srimohans@gmail.com>2021-04-13 17:32:37 -0700
committerGitHub <noreply@github.com>2021-04-13 17:32:37 -0700
commite64a538c70c270328278a22a97fde953a7680082 (patch)
treefa5a62cc3d7e50d7cd2f5fe46ad19ecc02762be7
parentd75213d26036a2880f23f5e67cb1c890f20299de (diff)
parentd89b48fe28279582df0b3df7389a742dcf4e343c (diff)
Merge pull request #8448 from ton31337/feature/show_rpki_state_in_global_show_bgp
bgpd: Show RPKI short state in `show bgp <afi> <safi>`
-rw-r--r--bgpd/bgp_route.c27
-rw-r--r--bgpd/bgp_route.h5
-rw-r--r--doc/user/bgp.rst4
-rw-r--r--tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post4.1.ref1
-rw-r--r--tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post5.0.ref1
-rw-r--r--tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post6.1.ref1
-rw-r--r--tests/topotests/all-protocol-startup/r1/show_bgp_ipv6-post4.1.ref1
-rw-r--r--tests/topotests/all-protocol-startup/r1/show_bgp_ipv6_post6.1.ref1
-rw-r--r--tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post4.1.ref1
-rw-r--r--tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post6.1.ref1
-rw-r--r--tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post4.1.ref1
-rw-r--r--tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post6.1.ref1
-rw-r--r--tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post4.1.ref1
-rw-r--r--tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post6.1.ref1
14 files changed, 41 insertions, 6 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 1c2ad7fc73..2a6779f53f 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -8342,8 +8342,11 @@ bgp_path_selection_reason2str(enum bgp_path_selection_reason reason)
/* Print the short form route status for a bgp_path_info */
static void route_vty_short_status_out(struct vty *vty,
struct bgp_path_info *path,
+ const struct prefix *p,
json_object *json_path)
{
+ enum rpki_states rpki_state = RPKI_NOT_BEING_USED;
+
if (json_path) {
/* Route status display. */
@@ -8389,6 +8392,17 @@ static void route_vty_short_status_out(struct vty *vty,
return;
}
+ /* RPKI validation state */
+ rpki_state =
+ hook_call(bgp_rpki_prefix_status, path->peer, path->attr, p);
+
+ if (rpki_state == RPKI_VALID)
+ vty_out(vty, "V");
+ else if (rpki_state == RPKI_INVALID)
+ vty_out(vty, "I");
+ else if (rpki_state == RPKI_NOTFOUND)
+ vty_out(vty, "N");
+
/* Route status display. */
if (CHECK_FLAG(path->flags, BGP_PATH_REMOVED))
vty_out(vty, "R");
@@ -8457,7 +8471,7 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
json_path = json_object_new_object();
/* short status lead text */
- route_vty_short_status_out(vty, path, json_path);
+ route_vty_short_status_out(vty, path, p, json_path);
if (!json_paths) {
/* print prefix and mask */
@@ -9103,7 +9117,7 @@ void route_vty_out_tag(struct vty *vty, const struct prefix *p,
json_out = json_object_new_object();
/* short status lead text */
- route_vty_short_status_out(vty, path, json_out);
+ route_vty_short_status_out(vty, path, p, json_out);
/* print prefix and mask */
if (json == NULL) {
@@ -9206,7 +9220,7 @@ void route_vty_out_overlay(struct vty *vty, const struct prefix *p,
}
/* short status lead text */
- route_vty_short_status_out(vty, path, json_path);
+ route_vty_short_status_out(vty, path, p, json_path);
/* print prefix and mask */
if (!display)
@@ -9310,7 +9324,7 @@ static void damp_route_vty_out(struct vty *vty, const struct prefix *p,
char timebuf[BGP_UPTIME_LEN];
/* short status lead text */
- route_vty_short_status_out(vty, path, json);
+ route_vty_short_status_out(vty, path, p, json);
/* print prefix and mask */
if (!use_json) {
@@ -9381,7 +9395,7 @@ static void flap_route_vty_out(struct vty *vty, const struct prefix *p,
bdi = path->extra->damp_info;
/* short status lead text */
- route_vty_short_status_out(vty, path, json);
+ route_vty_short_status_out(vty, path, p, json);
/* print prefix and mask */
if (!use_json) {
@@ -10803,6 +10817,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
vty_out(vty, BGP_SHOW_SCODE_HEADER);
vty_out(vty, BGP_SHOW_NCODE_HEADER);
vty_out(vty, BGP_SHOW_OCODE_HEADER);
+ vty_out(vty, BGP_SHOW_RPKI_HEADER);
if (type == bgp_show_type_dampend_paths
|| type == bgp_show_type_damp_neighbor)
vty_out(vty, BGP_SHOW_DAMP_HEADER);
@@ -13179,6 +13194,7 @@ static void show_adj_route_header(struct vty *vty, struct bgp *bgp,
vty_out(vty, BGP_SHOW_SCODE_HEADER);
vty_out(vty, BGP_SHOW_NCODE_HEADER);
vty_out(vty, BGP_SHOW_OCODE_HEADER);
+ vty_out(vty, BGP_SHOW_RPKI_HEADER);
}
*header1 = 0;
}
@@ -13265,6 +13281,7 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
vty_out(vty, BGP_SHOW_SCODE_HEADER);
vty_out(vty, BGP_SHOW_NCODE_HEADER);
vty_out(vty, BGP_SHOW_OCODE_HEADER);
+ vty_out(vty, BGP_SHOW_RPKI_HEADER);
vty_out(vty, "Originating default network %s\n\n",
(afi == AFI_IP) ? "0.0.0.0/0" : "::/0");
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 1bf5dcf186..5a7ee4d0a1 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -73,8 +73,11 @@ enum bgp_show_adj_route_type {
"Status codes: s suppressed, d damped, " \
"h history, * valid, > best, = multipath,\n" \
" i internal, r RIB-failure, S Stale, R Removed\n"
-#define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete\n\n"
+#define BGP_SHOW_OCODE_HEADER \
+ "Origin codes: i - IGP, e - EGP, ? - incomplete\n"
#define BGP_SHOW_NCODE_HEADER "Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self\n"
+#define BGP_SHOW_RPKI_HEADER \
+ "RPKI validation codes: V valid, I invalid, N Not found\n\n"
#define BGP_SHOW_HEADER " Network Next Hop Metric LocPrf Weight Path\n"
#define BGP_SHOW_HEADER_WIDE " Network Next Hop Metric LocPrf Weight Path\n"
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index adb87d386d..e2328508d0 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -2849,6 +2849,7 @@ When default route is present in R2'2 BGP table, 10.139.224.0/20 and 192.0.2.1/3
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+ RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 10.10.10.1 0 0 1 i
@@ -2878,6 +2879,7 @@ When default route is present in R2'2 BGP table, 10.139.224.0/20 and 192.0.2.1/3
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+ RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0/0 0.0.0.0 0 1 i
@@ -2896,6 +2898,7 @@ When default route is not present in R2'2 BGP table, 10.139.224.0/20 and 192.0.2
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+ RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 10.139.224.0/20 10.10.10.1 0 0 1 ?
@@ -2925,6 +2928,7 @@ When default route is not present in R2'2 BGP table, 10.139.224.0/20 and 192.0.2
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+ RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 10.139.224.0/20 0.0.0.0 0 1 ?
diff --git a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post4.1.ref b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post4.1.ref
index 6cc23a465c..b38701a53d 100644
--- a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post4.1.ref
+++ b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post4.1.ref
@@ -3,6 +3,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 192.168.0.0 0.0.0.0 0 32768 i
diff --git a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post5.0.ref b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post5.0.ref
index 2f348a7b77..82b64c0d98 100644
--- a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post5.0.ref
+++ b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post5.0.ref
@@ -3,6 +3,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 192.168.0.0/24 0.0.0.0 0 32768 i
diff --git a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post6.1.ref b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post6.1.ref
index d36d045397..fd333b3084 100644
--- a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post6.1.ref
+++ b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv4-post6.1.ref
@@ -4,6 +4,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 192.168.0.0/24 0.0.0.0 0 32768 i
diff --git a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv6-post4.1.ref b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv6-post4.1.ref
index 8bb5da72be..20034b7408 100644
--- a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv6-post4.1.ref
+++ b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv6-post4.1.ref
@@ -3,6 +3,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> fc00::/64 :: 0 32768 i
diff --git a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv6_post6.1.ref b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv6_post6.1.ref
index de91b247d8..5b5f8596cf 100644
--- a/tests/topotests/all-protocol-startup/r1/show_bgp_ipv6_post6.1.ref
+++ b/tests/topotests/all-protocol-startup/r1/show_bgp_ipv6_post6.1.ref
@@ -4,6 +4,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> fc00::/64 :: 0 32768 i
diff --git a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post4.1.ref b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post4.1.ref
index 9e30bf2ef0..6b20e1df5a 100644
--- a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post4.1.ref
+++ b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post4.1.ref
@@ -3,6 +3,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 10.0.1.0/24 172.16.1.5 0 65005 i
diff --git a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post6.1.ref b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post6.1.ref
index 2cf87487ab..5469eaa1cc 100644
--- a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post6.1.ref
+++ b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_1-post6.1.ref
@@ -4,6 +4,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 10.0.1.0/24 172.16.1.5 0 65005 i
diff --git a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post4.1.ref b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post4.1.ref
index 39eb3134be..a64927c92d 100644
--- a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post4.1.ref
+++ b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post4.1.ref
@@ -3,6 +3,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 10.0.1.0/24 172.16.1.4 0 65004 i
diff --git a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post6.1.ref b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post6.1.ref
index 9d1b948b5c..8d4a843b84 100644
--- a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post6.1.ref
+++ b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_2-post6.1.ref
@@ -4,6 +4,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 10.0.1.0/24 172.16.1.4 0 65004 i
diff --git a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post4.1.ref b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post4.1.ref
index fa53d79e88..a3b9ef0888 100644
--- a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post4.1.ref
+++ b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post4.1.ref
@@ -3,6 +3,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 10.0.1.0/24 172.16.1.8 0 65008 i
diff --git a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post6.1.ref b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post6.1.ref
index 8b66fa67ec..117e48847a 100644
--- a/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post6.1.ref
+++ b/tests/topotests/bgp_multiview_topo1/r1/show_ip_bgp_view_3-post6.1.ref
@@ -4,6 +4,7 @@ Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
+RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 10.0.1.0/24 172.16.1.8 0 65008 i