Skip to content

Commit

Permalink
bgpd: Ensure evpn local table display shows route send status
Browse files Browse the repository at this point in the history
evpn has a concept of `local` tables where the evpn routes
are actually converted into underlying routes/neighbor
table entries( or vice versa ).  Then this local route
is propagated to the global evpn l2vpn table and sent
to the peers.  Certain show commands in evpn look
operate on the local table but make the output look
like the data has not been sent to the peer.  This
is confusing for the operator.  Modify the code
such that local tables get a `Local BGP table not advertised`
in the place where the code talks about whom has received
the data or not.

Example:
torm11# show bgp l2vpn evpn route vni 1000 mac 8a:a1:cc:73:a3:ac ip 45.0.0.5
BGP routing table entry for [2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5]
Paths: (2 available, best #2)
  Local BGP table not advertised
  Route [2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5] VNI 1000
  Imported from 192.168.100.18:2:[2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5], VNI 1000
  65101 65005
    192.168.100.18(leaf2) from leaf2(192.168.5.1) (192.168.100.14)
      Origin IGP, valid, external
      Extended Community: RT:65005:1000 ET:8
      Last update: Thu Mar 21 14:29:04 2024
  Route [2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5] VNI 1000
  Imported from 192.168.100.18:2:[2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5], VNI 1000
  65101 65005
    192.168.100.18(leaf1) from leaf1(192.168.1.1) (192.168.100.13)
      Origin IGP, valid, external, bestpath-from-AS 65101, best (Router ID)
      Extended Community: RT:65005:1000 ET:8
      Last update: Thu Mar 21 14:29:04 2024

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Mar 22, 2024
1 parent 08c56b4 commit 4bde854
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
12 changes: 6 additions & 6 deletions bgpd/bgp_evpn_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -2561,7 +2561,7 @@ static void evpn_show_route_vni_multicast(struct vty *vty, struct bgp *bgp,

/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, dest, bgp_dest_get_prefix(dest),
NULL, afi, safi, json, false);
NULL, afi, safi, json, false, true);

/* Display each path for this prefix. */
for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next) {
Expand Down Expand Up @@ -2663,7 +2663,7 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,

/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, dest, (struct prefix *)&p, NULL,
afi, safi, json, false);
afi, safi, json, false, true);

evp = (const struct prefix_evpn *)bgp_dest_get_prefix(dest);

Expand Down Expand Up @@ -2798,7 +2798,7 @@ static void evpn_show_route_rd_macip(struct vty *vty, struct bgp *bgp,

/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, dest, bgp_dest_get_prefix(dest),
prd, afi, safi, json, false);
prd, afi, safi, json, false, false);

if (json)
json_paths = json_object_new_array();
Expand Down Expand Up @@ -2907,7 +2907,7 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(
vty, bgp, dest, bgp_dest_get_prefix(dest), prd,
afi, safi, json_prefix, false);
afi, safi, json_prefix, false, false);

prefix_cnt++;
}
Expand Down Expand Up @@ -3044,7 +3044,7 @@ static void evpn_show_route_rd_all_macip(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(
vty, bgp, dest, p, (struct prefix_rd *)rd_destp,
AFI_L2VPN, SAFI_EVPN, json_prefix, false);
AFI_L2VPN, SAFI_EVPN, json_prefix, false, false);

/* For EVPN, the prefix is displayed for each path (to
* fit in with code that already exists).
Expand Down Expand Up @@ -3201,7 +3201,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type,
vty, bgp, dest,
bgp_dest_get_prefix(dest),
(struct prefix_rd *)rd_destp, AFI_L2VPN,
SAFI_EVPN, json_prefix, false);
SAFI_EVPN, json_prefix, false, false);

/* For EVPN, the prefix is displayed for each path (to
* fit in
Expand Down
16 changes: 10 additions & 6 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -11528,7 +11528,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t sa
bgp_dest_get_prefix(
dest),
prd, table->afi, safi,
NULL, false);
NULL, false, false);

route_vty_out_detail(
vty, bgp, dest, dest_p, pi,
Expand Down Expand Up @@ -11604,7 +11604,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t sa
route_vty_out_detail_header(
vty, bgp, dest,
bgp_dest_get_prefix(dest), prd,
table->afi, safi, json_paths, true);
table->afi, safi, json_paths, true, false);

vty_out(vty, "\"paths\": ");
json_detail_header_used = true;
Expand Down Expand Up @@ -11810,7 +11810,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
struct bgp_dest *dest, const struct prefix *p,
const struct prefix_rd *prd, afi_t afi,
safi_t safi, json_object *json,
bool incremental_print)
bool incremental_print, bool local_table)
{
struct bgp_path_info *pi;
struct peer *peer;
Expand Down Expand Up @@ -12028,8 +12028,12 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
json_object_object_add(json, "advertisedTo",
json_adv_to);
} else {
if (!json && first)
vty_out(vty, " Not advertised to any peer");
if (!json && first) {
if (!local_table)
vty_out(vty, " Not advertised to any peer");
else
vty_out(vty, " Local BGP table not advertised");
}
vty_out(vty, "\n");
}
}
Expand Down Expand Up @@ -12071,7 +12075,7 @@ static void bgp_show_path_info(const struct prefix_rd *pfx_rd,
route_vty_out_detail_header(
vty, bgp, bgp_node,
bgp_dest_get_prefix(bgp_node), pfx_rd, AFI_IP,
safi, json_header, false);
safi, json_header, false, false);
header = 0;
}
(*display)++;
Expand Down
3 changes: 2 additions & 1 deletion bgpd/bgp_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,8 @@ extern void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
const struct prefix *p,
const struct prefix_rd *prd, afi_t afi,
safi_t safi, json_object *json,
bool incremental_print);
bool incremental_print,
bool local_table);
extern void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
struct bgp_dest *bn, const struct prefix *p,
struct bgp_path_info *path, afi_t afi,
Expand Down

0 comments on commit 4bde854

Please sign in to comment.