mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 19:10:35 +00:00
Merge pull request #10148 from sworleys/NHG-ID-Dump
zebra: add optional NHG ID output to `show ip ro`
This commit is contained in:
commit
562b5f391f
@ -76,7 +76,7 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
|
|||||||
const struct prefix *longer_prefix_p,
|
const struct prefix *longer_prefix_p,
|
||||||
bool supernets_only, int type,
|
bool supernets_only, int type,
|
||||||
unsigned short ospf_instance_id, uint32_t tableid,
|
unsigned short ospf_instance_id, uint32_t tableid,
|
||||||
struct route_show_ctx *ctx);
|
bool show_ng, struct route_show_ctx *ctx);
|
||||||
static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
|
static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
|
||||||
int mcast, bool use_fib, bool show_ng);
|
int mcast, bool use_fib, bool show_ng);
|
||||||
static void vty_show_ip_route_summary(struct vty *vty,
|
static void vty_show_ip_route_summary(struct vty *vty,
|
||||||
@ -158,7 +158,8 @@ DEFUN (show_ip_rpf,
|
|||||||
};
|
};
|
||||||
|
|
||||||
return do_show_ip_route(vty, VRF_DEFAULT_NAME, AFI_IP, SAFI_MULTICAST,
|
return do_show_ip_route(vty, VRF_DEFAULT_NAME, AFI_IP, SAFI_MULTICAST,
|
||||||
false, uj, 0, NULL, false, 0, 0, 0, &ctx);
|
false, uj, 0, NULL, false, 0, 0, 0, false,
|
||||||
|
&ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_rpf_addr,
|
DEFUN (show_ip_rpf_addr,
|
||||||
@ -889,7 +890,7 @@ static void show_nexthop_json_helper(json_object *json_nexthop,
|
|||||||
|
|
||||||
static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
|
static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
|
||||||
struct route_entry *re, json_object *json,
|
struct route_entry *re, json_object *json,
|
||||||
bool is_fib)
|
bool is_fib, bool show_ng)
|
||||||
{
|
{
|
||||||
const struct nexthop *nexthop;
|
const struct nexthop *nexthop;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@ -1050,6 +1051,9 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
|
|||||||
len += vty_out(vty, " [%u/%u]", re->distance,
|
len += vty_out(vty, " [%u/%u]", re->distance,
|
||||||
re->metric);
|
re->metric);
|
||||||
|
|
||||||
|
if (show_ng)
|
||||||
|
len += vty_out(vty, " (%u)", re->nhe_id);
|
||||||
|
|
||||||
/* Nexthop information. */
|
/* Nexthop information. */
|
||||||
for (ALL_NEXTHOPS_PTR(nhg, nexthop)) {
|
for (ALL_NEXTHOPS_PTR(nhg, nexthop)) {
|
||||||
if (first_p) {
|
if (first_p) {
|
||||||
@ -1122,7 +1126,7 @@ static void vty_show_ip_route_detail_json(struct vty *vty,
|
|||||||
*/
|
*/
|
||||||
if (use_fib && re != dest->selected_fib)
|
if (use_fib && re != dest->selected_fib)
|
||||||
continue;
|
continue;
|
||||||
vty_show_ip_route(vty, rn, re, json_prefix, use_fib);
|
vty_show_ip_route(vty, rn, re, json_prefix, use_fib, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix2str(&rn->p, buf, sizeof(buf));
|
prefix2str(&rn->p, buf, sizeof(buf));
|
||||||
@ -1136,7 +1140,8 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf,
|
|||||||
const struct prefix *longer_prefix_p,
|
const struct prefix *longer_prefix_p,
|
||||||
bool supernets_only, int type,
|
bool supernets_only, int type,
|
||||||
unsigned short ospf_instance_id, bool use_json,
|
unsigned short ospf_instance_id, bool use_json,
|
||||||
uint32_t tableid, struct route_show_ctx *ctx)
|
uint32_t tableid, bool show_ng,
|
||||||
|
struct route_show_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
struct route_entry *re;
|
struct route_entry *re;
|
||||||
@ -1227,7 +1232,8 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf,
|
|||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vty_show_ip_route(vty, rn, re, json_prefix, use_fib);
|
vty_show_ip_route(vty, rn, re, json_prefix, use_fib,
|
||||||
|
show_ng);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json_prefix) {
|
if (json_prefix) {
|
||||||
@ -1246,7 +1252,7 @@ static void do_show_ip_route_all(struct vty *vty, struct zebra_vrf *zvrf,
|
|||||||
route_tag_t tag,
|
route_tag_t tag,
|
||||||
const struct prefix *longer_prefix_p,
|
const struct prefix *longer_prefix_p,
|
||||||
bool supernets_only, int type,
|
bool supernets_only, int type,
|
||||||
unsigned short ospf_instance_id,
|
unsigned short ospf_instance_id, bool show_ng,
|
||||||
struct route_show_ctx *ctx)
|
struct route_show_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct zebra_router_table *zrt;
|
struct zebra_router_table *zrt;
|
||||||
@ -1265,7 +1271,7 @@ static void do_show_ip_route_all(struct vty *vty, struct zebra_vrf *zvrf,
|
|||||||
do_show_ip_route(vty, zvrf_name(zvrf), afi, SAFI_UNICAST,
|
do_show_ip_route(vty, zvrf_name(zvrf), afi, SAFI_UNICAST,
|
||||||
use_fib, use_json, tag, longer_prefix_p,
|
use_fib, use_json, tag, longer_prefix_p,
|
||||||
supernets_only, type, ospf_instance_id,
|
supernets_only, type, ospf_instance_id,
|
||||||
zrt->tableid, ctx);
|
zrt->tableid, show_ng, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1275,7 +1281,7 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
|
|||||||
const struct prefix *longer_prefix_p,
|
const struct prefix *longer_prefix_p,
|
||||||
bool supernets_only, int type,
|
bool supernets_only, int type,
|
||||||
unsigned short ospf_instance_id, uint32_t tableid,
|
unsigned short ospf_instance_id, uint32_t tableid,
|
||||||
struct route_show_ctx *ctx)
|
bool show_ng, struct route_show_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct route_table *table;
|
struct route_table *table;
|
||||||
struct zebra_vrf *zvrf = NULL;
|
struct zebra_vrf *zvrf = NULL;
|
||||||
@ -1308,7 +1314,7 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,
|
|||||||
|
|
||||||
do_show_route_helper(vty, zvrf, table, afi, use_fib, tag,
|
do_show_route_helper(vty, zvrf, table, afi, use_fib, tag,
|
||||||
longer_prefix_p, supernets_only, type,
|
longer_prefix_p, supernets_only, type,
|
||||||
ospf_instance_id, use_json, tableid, ctx);
|
ospf_instance_id, use_json, tableid, show_ng, ctx);
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1792,7 +1798,7 @@ DEFPY (show_route,
|
|||||||
}]\
|
}]\
|
||||||
[" FRR_IP6_REDIST_STR_ZEBRA "$type_str]\
|
[" FRR_IP6_REDIST_STR_ZEBRA "$type_str]\
|
||||||
>\
|
>\
|
||||||
[json$json]",
|
[<json$json|nexthop-group$ng>]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
"IP forwarding table\n"
|
"IP forwarding table\n"
|
||||||
@ -1821,7 +1827,8 @@ DEFPY (show_route,
|
|||||||
"IPv6 prefix\n"
|
"IPv6 prefix\n"
|
||||||
"Show route matching the specified Network/Mask pair only\n"
|
"Show route matching the specified Network/Mask pair only\n"
|
||||||
FRR_IP6_REDIST_HELP_STR_ZEBRA
|
FRR_IP6_REDIST_HELP_STR_ZEBRA
|
||||||
JSON_STR)
|
JSON_STR
|
||||||
|
"Nexthop Group Information\n")
|
||||||
{
|
{
|
||||||
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
||||||
struct vrf *vrf;
|
struct vrf *vrf;
|
||||||
@ -1857,18 +1864,18 @@ DEFPY (show_route,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (table_all)
|
if (table_all)
|
||||||
do_show_ip_route_all(vty, zvrf, afi, !!fib,
|
do_show_ip_route_all(
|
||||||
!!json, tag,
|
vty, zvrf, afi, !!fib, !!json, tag,
|
||||||
prefix_str ? prefix : NULL,
|
prefix_str ? prefix : NULL,
|
||||||
!!supernets_only, type,
|
!!supernets_only, type,
|
||||||
ospf_instance_id, &ctx);
|
ospf_instance_id, !!ng, &ctx);
|
||||||
else
|
else
|
||||||
do_show_ip_route(vty, zvrf_name(zvrf), afi,
|
do_show_ip_route(
|
||||||
SAFI_UNICAST, !!fib, !!json,
|
vty, zvrf_name(zvrf), afi, SAFI_UNICAST,
|
||||||
tag,
|
!!fib, !!json, tag,
|
||||||
prefix_str ? prefix : NULL,
|
prefix_str ? prefix : NULL,
|
||||||
!!supernets_only, type,
|
!!supernets_only, type,
|
||||||
ospf_instance_id, table, &ctx);
|
ospf_instance_id, table, !!ng, &ctx);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vrf_id_t vrf_id = VRF_DEFAULT;
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
||||||
@ -1887,13 +1894,13 @@ DEFPY (show_route,
|
|||||||
do_show_ip_route_all(vty, zvrf, afi, !!fib, !!json, tag,
|
do_show_ip_route_all(vty, zvrf, afi, !!fib, !!json, tag,
|
||||||
prefix_str ? prefix : NULL,
|
prefix_str ? prefix : NULL,
|
||||||
!!supernets_only, type,
|
!!supernets_only, type,
|
||||||
ospf_instance_id, &ctx);
|
ospf_instance_id, !!ng, &ctx);
|
||||||
else
|
else
|
||||||
do_show_ip_route(vty, vrf->name, afi, SAFI_UNICAST,
|
do_show_ip_route(vty, vrf->name, afi, SAFI_UNICAST,
|
||||||
!!fib, !!json, tag,
|
!!fib, !!json, tag,
|
||||||
prefix_str ? prefix : NULL,
|
prefix_str ? prefix : NULL,
|
||||||
!!supernets_only, type,
|
!!supernets_only, type,
|
||||||
ospf_instance_id, table, &ctx);
|
ospf_instance_id, table, !!ng, &ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -2659,7 +2666,7 @@ DEFUN (show_ipv6_mroute,
|
|||||||
vty_out(vty, SHOW_ROUTE_V6_HEADER);
|
vty_out(vty, SHOW_ROUTE_V6_HEADER);
|
||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
vty_show_ip_route(vty, rn, re, NULL, false);
|
vty_show_ip_route(vty, rn, re, NULL, false, false);
|
||||||
}
|
}
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -2691,7 +2698,8 @@ DEFUN (show_ipv6_mroute_vrf_all,
|
|||||||
vty_out(vty, SHOW_ROUTE_V6_HEADER);
|
vty_out(vty, SHOW_ROUTE_V6_HEADER);
|
||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
vty_show_ip_route(vty, rn, re, NULL, false);
|
vty_show_ip_route(vty, rn, re, NULL, false,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
Loading…
Reference in New Issue
Block a user