summaryrefslogtreecommitdiff
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 9d7af3f6c7..861600596e 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -42,6 +42,7 @@
#include "zebra/redistribute.h"
#include "zebra/zebra_routemap.h"
#include "lib/json.h"
+#include "lib/route_opaque.h"
#include "zebra/zebra_vxlan.h"
#include "zebra/zebra_evpn_mh.h"
#ifndef VTYSH_EXTRACT_PL
@@ -421,6 +422,8 @@ static void show_nexthop_detail_helper(struct vty *vty,
static void zebra_show_ip_route_opaque(struct vty *vty, struct route_entry *re,
struct json_object *json)
{
+ struct bgp_zebra_opaque bzo = {};
+
if (!re->opaque)
return;
@@ -433,13 +436,27 @@ static void zebra_show_ip_route_opaque(struct vty *vty, struct route_entry *re,
vty_out(vty, " Opaque Data: %s",
(char *)re->opaque->data);
break;
- case ZEBRA_ROUTE_BGP:
- if (json)
- json_object_string_add(json, "asPath",
- (char *)re->opaque->data);
- else
- vty_out(vty, " AS-Path: %s",
- (char *)re->opaque->data);
+ case ZEBRA_ROUTE_BGP: {
+ memcpy(&bzo, re->opaque->data, re->opaque->length);
+
+ if (json) {
+ json_object_string_add(json, "asPath", bzo.aspath);
+ json_object_string_add(json, "communities",
+ bzo.community);
+ json_object_string_add(json, "largeCommunities",
+ bzo.lcommunity);
+ } else {
+ vty_out(vty, " AS-Path : %s\n", bzo.aspath);
+
+ if (bzo.community[0] != '\0')
+ vty_out(vty, " Communities : %s\n",
+ bzo.community);
+
+ if (bzo.lcommunity[0] != '\0')
+ vty_out(vty, " Large-Communities: %s\n",
+ bzo.lcommunity);
+ }
+ }
default:
break;
}