mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-17 20:20:12 +00:00
Summary: Test effect of route-map on received/advertised routes
This patch adds the ability to see the effect of applying a route-map on the routes received or advertised from or to a neighbor. This effect can be seen without actually affecting the current state. If the result seen is what is desired, then the user can actually apply the route-map. Currently, the application acts on route-map in or out and on unsuppress maps. Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
This commit is contained in:
parent
518f0eb188
commit
0b16f23991
507
bgpd/bgp_route.c
507
bgpd/bgp_route.c
@ -698,11 +698,12 @@ bgp_cluster_filter (struct peer *peer, struct attr *attr)
|
||||
|
||||
static int
|
||||
bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
|
||||
afi_t afi, safi_t safi)
|
||||
afi_t afi, safi_t safi, char *rmap_name)
|
||||
{
|
||||
struct bgp_filter *filter;
|
||||
struct bgp_info info;
|
||||
route_map_result_t ret;
|
||||
struct route_map *rmap = NULL;
|
||||
|
||||
filter = &peer->filter[afi][safi];
|
||||
|
||||
@ -710,8 +711,18 @@ bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
|
||||
if (peer->weight)
|
||||
(bgp_attr_extra_get (attr))->weight = peer->weight;
|
||||
|
||||
if (rmap_name)
|
||||
{
|
||||
rmap = route_map_lookup_by_name(rmap_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ROUTE_MAP_IN_NAME(filter))
|
||||
rmap = ROUTE_MAP_IN (filter);
|
||||
}
|
||||
|
||||
/* Route map apply. */
|
||||
if (ROUTE_MAP_IN_NAME (filter))
|
||||
if (rmap)
|
||||
{
|
||||
/* Duplicate current value to new strucutre for modification. */
|
||||
info.peer = peer;
|
||||
@ -720,7 +731,56 @@ bgp_input_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
|
||||
SET_FLAG (peer->rmap_type, PEER_RMAP_TYPE_IN);
|
||||
|
||||
/* Apply BGP route map to the attribute. */
|
||||
ret = route_map_apply (ROUTE_MAP_IN (filter), p, RMAP_BGP, &info);
|
||||
ret = route_map_apply (rmap, p, RMAP_BGP, &info);
|
||||
|
||||
peer->rmap_type = 0;
|
||||
|
||||
if (ret == RMAP_DENYMATCH)
|
||||
{
|
||||
/* Free newly generated AS path and community by route-map. */
|
||||
bgp_attr_flush (attr);
|
||||
return RMAP_DENY;
|
||||
}
|
||||
}
|
||||
return RMAP_PERMIT;
|
||||
}
|
||||
|
||||
static int
|
||||
bgp_output_modifier (struct peer *peer, struct prefix *p, struct attr *attr,
|
||||
afi_t afi, safi_t safi, char *rmap_name)
|
||||
{
|
||||
struct bgp_filter *filter;
|
||||
struct bgp_info info;
|
||||
route_map_result_t ret;
|
||||
struct route_map *rmap = NULL;
|
||||
|
||||
filter = &peer->filter[afi][safi];
|
||||
|
||||
/* Apply default weight value. */
|
||||
if (peer->weight)
|
||||
(bgp_attr_extra_get (attr))->weight = peer->weight;
|
||||
|
||||
if (rmap_name)
|
||||
{
|
||||
rmap = route_map_lookup_by_name(rmap_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ROUTE_MAP_OUT_NAME(filter))
|
||||
rmap = ROUTE_MAP_OUT (filter);
|
||||
}
|
||||
|
||||
/* Route map apply. */
|
||||
if (rmap)
|
||||
{
|
||||
/* Duplicate current value to new strucutre for modification. */
|
||||
info.peer = peer;
|
||||
info.attr = attr;
|
||||
|
||||
SET_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT);
|
||||
|
||||
/* Apply BGP route map to the attribute. */
|
||||
ret = route_map_apply (rmap, p, RMAP_BGP, &info);
|
||||
|
||||
peer->rmap_type = 0;
|
||||
|
||||
@ -2236,7 +2296,7 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
|
||||
* NB: new_attr may now contain newly allocated values from route-map "set"
|
||||
* commands, so we need bgp_attr_flush in the error paths, until we intern
|
||||
* the attr (which takes over the memory references) */
|
||||
if (bgp_input_modifier (peer, p, &new_attr, afi, safi) == RMAP_DENY)
|
||||
if (bgp_input_modifier (peer, p, &new_attr, afi, safi, NULL) == RMAP_DENY)
|
||||
{
|
||||
reason = "route-map;";
|
||||
bgp_attr_flush (&new_attr);
|
||||
@ -10085,19 +10145,22 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts,
|
||||
return bgp_peer_counts (vty, peer, AFI_IP, SAFI_MPLS_VPN);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
|
||||
int in, char *delim)
|
||||
int in, char *delim, char *rmap_name)
|
||||
{
|
||||
struct bgp_table *table;
|
||||
struct bgp_adj_in *ain;
|
||||
struct bgp_adj_out *adj;
|
||||
unsigned long output_count;
|
||||
unsigned long filtered_count;
|
||||
struct bgp_node *rn;
|
||||
int header1 = 1;
|
||||
struct bgp *bgp;
|
||||
int header2 = 1;
|
||||
struct attr attr;
|
||||
struct attr_extra extra;
|
||||
int ret;
|
||||
|
||||
bgp = peer->bgp;
|
||||
|
||||
@ -10109,7 +10172,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
|
||||
|
||||
table = bgp->rib[afi][safi];
|
||||
|
||||
output_count = 0;
|
||||
output_count = filtered_count = 0;
|
||||
|
||||
if (! in && CHECK_FLAG (peer->af_sflags[afi][safi],
|
||||
PEER_STATUS_DEFAULT_ORIGINATE))
|
||||
@ -10123,6 +10186,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
|
||||
header1 = 0;
|
||||
}
|
||||
|
||||
attr.extra = &extra;
|
||||
for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn))
|
||||
if (in)
|
||||
{
|
||||
@ -10146,8 +10210,15 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
|
||||
}
|
||||
if (ain->attr)
|
||||
{
|
||||
route_vty_out_tmp (vty, &rn->p, ain->attr, safi, delim);
|
||||
output_count++;
|
||||
bgp_attr_dup(&attr, ain->attr);
|
||||
if (bgp_input_modifier(peer, &rn->p, &attr, afi,
|
||||
safi, rmap_name) != RMAP_DENY)
|
||||
{
|
||||
route_vty_out_tmp (vty, &rn->p, &attr, safi, delim);
|
||||
output_count++;
|
||||
}
|
||||
else
|
||||
filtered_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10173,8 +10244,25 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
|
||||
}
|
||||
if (adj->attr)
|
||||
{
|
||||
route_vty_out_tmp (vty, &rn->p, adj->attr, safi, delim);
|
||||
output_count++;
|
||||
if (!CHECK_FLAG(peer->af_flags[afi][safi],
|
||||
PEER_FLAG_REFLECTOR_CLIENT)
|
||||
|| bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
|
||||
{
|
||||
|
||||
bgp_attr_dup(&attr, adj->attr);
|
||||
ret = bgp_output_modifier(peer, &rn->p, &attr, afi,
|
||||
safi, rmap_name);
|
||||
}
|
||||
else
|
||||
ret = RMAP_PERMIT;
|
||||
|
||||
if (ret != RMAP_DENY)
|
||||
{
|
||||
route_vty_out_tmp (vty, &rn->p, &attr, safi, delim);
|
||||
output_count++;
|
||||
}
|
||||
else
|
||||
filtered_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10186,7 +10274,7 @@ show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
|
||||
|
||||
static int
|
||||
peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
|
||||
int in, char *delim)
|
||||
int in, char *delim, char *rmap_name)
|
||||
{
|
||||
if (! peer || ! peer->afc[afi][safi])
|
||||
{
|
||||
@ -10201,7 +10289,17 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
show_adj_route (vty, peer, afi, safi, in, delim);
|
||||
if (!in && (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)
|
||||
&& !bgp_flag_check(peer->bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)))
|
||||
{
|
||||
vty_out (vty, "%% Cannot apply outgoing route-map on route-reflector clients%s",
|
||||
VTY_NEWLINE);
|
||||
vty_out (vty, "%% Enable bgp route-reflector allow-outbound-policy flag%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
show_adj_route (vty, peer, afi, safi, in, delim, rmap_name);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -10228,11 +10326,11 @@ DEFUN (show_ip_bgp_view_neighbor_advertised_route,
|
||||
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, NULL);
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
ALIAS (show_ip_bgp_view_neighbor_advertised_route,
|
||||
DEFUN (show_ip_bgp_neighbor_advertised_route,
|
||||
show_ip_bgp_neighbor_advertised_route_cmd,
|
||||
"show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
|
||||
SHOW_STR
|
||||
@ -10244,6 +10342,33 @@ ALIAS (show_ip_bgp_view_neighbor_advertised_route,
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
{
|
||||
struct peer *peer;
|
||||
char *rmap_name = NULL;
|
||||
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[0]);
|
||||
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (argc == 2)
|
||||
rmap_name = argv[1];
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, NULL, rmap_name);
|
||||
}
|
||||
|
||||
ALIAS (show_ip_bgp_neighbor_advertised_route,
|
||||
show_ip_bgp_neighbor_advertised_route_rmap_cmd,
|
||||
"show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
DEFUN (show_ip_bgp_neighbor_advertised_route_csv,
|
||||
show_ip_bgp_neighbor_advertised_route_csv_cmd,
|
||||
"show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
|
||||
@ -10259,18 +10384,34 @@ DEFUN (show_ip_bgp_neighbor_advertised_route_csv,
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
{
|
||||
struct peer *peer;
|
||||
char *rmap_name = NULL;
|
||||
|
||||
if (argc == 2)
|
||||
peer = peer_lookup_in_view (vty, argv[0], argv[1]);
|
||||
else
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[0]);
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[0]);
|
||||
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, &csv);
|
||||
if (argc == 2)
|
||||
rmap_name = argv[1];
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, &csv, rmap_name);
|
||||
}
|
||||
|
||||
ALIAS (show_ip_bgp_neighbor_advertised_route_csv,
|
||||
show_ip_bgp_neighbor_advertised_route_csv_rmap_cmd,
|
||||
"show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv route-map WORD",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
"BGP view\n"
|
||||
"View name\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n"
|
||||
"Apply this route-map to display what would've been advertised\n")
|
||||
|
||||
DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
|
||||
show_ip_bgp_ipv4_neighbor_advertised_route_cmd,
|
||||
"show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
|
||||
@ -10287,17 +10428,37 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
{
|
||||
struct peer *peer;
|
||||
char *rmap_name = NULL;
|
||||
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[1]);
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (strncmp (argv[0], "m", 1) == 0)
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 0, NULL);
|
||||
if (argc == 3)
|
||||
rmap_name = argv[2];
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, NULL);
|
||||
if (strncmp (argv[0], "m", 1) == 0)
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 0, NULL, rmap_name);
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0, NULL, rmap_name);
|
||||
}
|
||||
|
||||
ALIAS (show_ip_bgp_ipv4_neighbor_advertised_route,
|
||||
show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd,
|
||||
"show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
"Address family\n"
|
||||
"Address Family modifier\n"
|
||||
"Address Family modifier\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n"
|
||||
"Route-map to control what is displayed\n")
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
DEFUN (show_bgp_view_neighbor_advertised_route,
|
||||
show_bgp_view_neighbor_advertised_route_cmd,
|
||||
@ -10320,11 +10481,25 @@ DEFUN (show_bgp_view_neighbor_advertised_route,
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[0]);
|
||||
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
return CMD_WARNING;
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, NULL);
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_advertised_route,
|
||||
show_bgp_view_ipv6_neighbor_advertised_route_cmd,
|
||||
"show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"BGP view\n"
|
||||
"View name\n"
|
||||
"Address family\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
DEFUN (show_bgp_view_neighbor_advertised_route_csv,
|
||||
show_bgp_view_neighbor_advertised_route_csv_cmd,
|
||||
"show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
|
||||
@ -10348,23 +10523,9 @@ DEFUN (show_bgp_view_neighbor_advertised_route_csv,
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, &csv);
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, &csv, NULL);
|
||||
}
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_advertised_route,
|
||||
show_bgp_view_ipv6_neighbor_advertised_route_cmd,
|
||||
"show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"BGP view\n"
|
||||
"View name\n"
|
||||
"Address family\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_advertised_route_csv,
|
||||
show_bgp_view_ipv6_neighbor_advertised_route_csv_cmd,
|
||||
"show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
|
||||
@ -10379,47 +10540,7 @@ ALIAS (show_bgp_view_neighbor_advertised_route_csv,
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
DEFUN (show_bgp_view_neighbor_received_routes,
|
||||
show_bgp_view_neighbor_received_routes_cmd,
|
||||
"show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"BGP view\n"
|
||||
"View name\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
{
|
||||
struct peer *peer;
|
||||
|
||||
if (argc == 2)
|
||||
peer = peer_lookup_in_view (vty, argv[0], argv[1]);
|
||||
else
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[0]);
|
||||
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1, NULL);
|
||||
}
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_received_routes,
|
||||
show_bgp_view_ipv6_neighbor_received_routes_cmd,
|
||||
"show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"BGP view\n"
|
||||
"View name\n"
|
||||
"Address family\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_advertised_route,
|
||||
DEFUN (show_bgp_neighbor_advertised_route,
|
||||
show_bgp_neighbor_advertised_route_cmd,
|
||||
"show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
|
||||
SHOW_STR
|
||||
@ -10429,8 +10550,34 @@ ALIAS (show_bgp_view_neighbor_advertised_route,
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_advertised_route,
|
||||
|
||||
{
|
||||
struct peer *peer;
|
||||
char *rmap_name = NULL;
|
||||
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[0]);
|
||||
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (argc == 2)
|
||||
rmap_name = argv[1];
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, NULL, rmap_name);
|
||||
}
|
||||
|
||||
ALIAS (show_bgp_neighbor_advertised_route,
|
||||
show_bgp_neighbor_advertised_route_rmap_cmd,
|
||||
"show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
ALIAS (show_bgp_neighbor_advertised_route,
|
||||
show_bgp_ipv6_neighbor_advertised_route_cmd,
|
||||
"show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
|
||||
SHOW_STR
|
||||
@ -10442,7 +10589,19 @@ ALIAS (show_bgp_view_neighbor_advertised_route,
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_advertised_route_csv,
|
||||
ALIAS (show_bgp_neighbor_advertised_route,
|
||||
show_bgp_ipv6_neighbor_advertised_route_rmap_cmd,
|
||||
"show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes route-map WORD",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"Address family\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
DEFUN (show_bgp_neighbor_advertised_route_csv,
|
||||
show_bgp_neighbor_advertised_route_csv_cmd,
|
||||
"show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
|
||||
SHOW_STR
|
||||
@ -10452,8 +10611,33 @@ ALIAS (show_bgp_view_neighbor_advertised_route_csv,
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
{
|
||||
struct peer *peer;
|
||||
char *rmap_name = NULL;
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_advertised_route_csv,
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[0]);
|
||||
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (argc == 2)
|
||||
rmap_name = argv[1];
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, &csv, rmap_name);
|
||||
}
|
||||
|
||||
ALIAS (show_bgp_neighbor_advertised_route_csv,
|
||||
show_bgp_neighbor_advertised_route_csv_rmap_cmd,
|
||||
"show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv route-map WORD",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
ALIAS (show_bgp_neighbor_advertised_route_csv,
|
||||
show_bgp_ipv6_neighbor_advertised_route_csv_cmd,
|
||||
"show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv",
|
||||
SHOW_STR
|
||||
@ -10465,8 +10649,20 @@ ALIAS (show_bgp_view_neighbor_advertised_route_csv,
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
ALIAS (show_bgp_neighbor_advertised_route_csv,
|
||||
show_bgp_ipv6_neighbor_advertised_route_csv_rmap_cmd,
|
||||
"show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes csv route-map WORD",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"Address family\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the routes advertised to a BGP neighbor\n")
|
||||
|
||||
/* old command */
|
||||
ALIAS (show_bgp_view_neighbor_advertised_route,
|
||||
ALIAS (show_bgp_neighbor_advertised_route,
|
||||
ipv6_bgp_neighbor_advertised_route_cmd,
|
||||
"show ipv6 bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
|
||||
SHOW_STR
|
||||
@ -10498,10 +10694,36 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route,
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 0, NULL);
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 0, NULL, NULL);
|
||||
}
|
||||
#endif /* HAVE_IPV6 */
|
||||
|
||||
DEFUN (show_bgp_view_neighbor_received_routes,
|
||||
show_bgp_view_neighbor_received_routes_cmd,
|
||||
"show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"BGP view\n"
|
||||
"View name\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
{
|
||||
struct peer *peer;
|
||||
|
||||
if (argc == 2)
|
||||
peer = peer_lookup_in_view (vty, argv[0], argv[1]);
|
||||
else
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[0]);
|
||||
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 1, NULL, NULL);
|
||||
}
|
||||
|
||||
DEFUN (show_ip_bgp_view_neighbor_received_routes,
|
||||
show_ip_bgp_view_neighbor_received_routes_cmd,
|
||||
"show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
|
||||
@ -10526,10 +10748,24 @@ DEFUN (show_ip_bgp_view_neighbor_received_routes,
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, NULL);
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, NULL, NULL);
|
||||
}
|
||||
|
||||
ALIAS (show_ip_bgp_view_neighbor_received_routes,
|
||||
ALIAS (show_bgp_view_neighbor_received_routes,
|
||||
show_bgp_view_ipv6_neighbor_received_routes_cmd,
|
||||
"show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"BGP view\n"
|
||||
"View name\n"
|
||||
"Address family\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
|
||||
DEFUN (show_ip_bgp_neighbor_received_routes,
|
||||
show_ip_bgp_neighbor_received_routes_cmd,
|
||||
"show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
|
||||
SHOW_STR
|
||||
@ -10541,6 +10777,33 @@ ALIAS (show_ip_bgp_view_neighbor_received_routes,
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
|
||||
{
|
||||
struct peer *peer;
|
||||
char *rmap_name = NULL;
|
||||
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[0]);
|
||||
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (argc == 2)
|
||||
rmap_name = argv[1];
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, NULL, rmap_name);
|
||||
}
|
||||
|
||||
ALIAS (show_ip_bgp_neighbor_received_routes,
|
||||
show_ip_bgp_neighbor_received_routes_rmap_cmd,
|
||||
"show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
|
||||
DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
|
||||
show_ip_bgp_ipv4_neighbor_received_routes_cmd,
|
||||
"show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes",
|
||||
@ -10557,17 +10820,36 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
|
||||
"Display the received routes from neighbor\n")
|
||||
{
|
||||
struct peer *peer;
|
||||
char *rmap_name = NULL;
|
||||
|
||||
peer = peer_lookup_in_view (vty, NULL, argv[1]);
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (strncmp (argv[0], "m", 1) == 0)
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 1, NULL);
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, NULL);
|
||||
if (argc == 3)
|
||||
rmap_name = argv[2];
|
||||
|
||||
if (strncmp (argv[0], "m", 1) == 0)
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 1, NULL, rmap_name);
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1, NULL, rmap_name);
|
||||
}
|
||||
|
||||
ALIAS (show_ip_bgp_ipv4_neighbor_received_routes,
|
||||
show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd,
|
||||
"show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
"Address family\n"
|
||||
"Address Family modifier\n"
|
||||
"Address Family modifier\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
|
||||
DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes,
|
||||
show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd,
|
||||
#ifdef HAVE_IPV6
|
||||
@ -10616,7 +10898,7 @@ DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes,
|
||||
in = (strncmp (argv[3], "r", 1) == 0) ? 1 : 0;
|
||||
#endif
|
||||
|
||||
return peer_adj_routes (vty, peer, afi, safi, in, NULL);
|
||||
return peer_adj_routes (vty, peer, afi, safi, in, NULL, NULL);
|
||||
}
|
||||
|
||||
DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
|
||||
@ -10752,6 +11034,29 @@ ALIAS (show_bgp_view_neighbor_received_routes,
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_received_routes,
|
||||
show_bgp_neighbor_received_routes_rmap_cmd,
|
||||
"show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
|
||||
ALIAS (show_bgp_view_neighbor_received_routes,
|
||||
show_bgp_ipv6_neighbor_received_routes_rmap_cmd,
|
||||
"show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) received-routes route-map WORD",
|
||||
SHOW_STR
|
||||
BGP_STR
|
||||
"Address family\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor to display information about\n"
|
||||
"Neighbor on bgp configured interface\n"
|
||||
"Display the received routes from neighbor\n")
|
||||
|
||||
DEFUN (show_bgp_neighbor_received_prefix_filter,
|
||||
show_bgp_neighbor_received_prefix_filter_cmd,
|
||||
"show bgp neighbors (A.B.C.D|X:X::X:X|WORD) received prefix-filter",
|
||||
@ -10842,7 +11147,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes,
|
||||
if (! peer)
|
||||
return CMD_WARNING;
|
||||
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 1, NULL);
|
||||
return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 1, NULL, NULL);
|
||||
}
|
||||
|
||||
DEFUN (show_bgp_view_neighbor_received_prefix_filter,
|
||||
@ -13062,10 +13367,15 @@ bgp_route_init (void)
|
||||
install_element (VIEW_NODE, &show_ip_bgp_prefix_longer_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_ipv4_prefix_longer_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_neighbor_advertised_route_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_neighbor_advertised_route_rmap_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_neighbor_advertised_route_csv_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_neighbor_advertised_route_csv_rmap_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_routes_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_routes_rmap_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd);
|
||||
install_element (VIEW_NODE, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd);
|
||||
install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_csv_cmd);
|
||||
@ -13200,9 +13510,14 @@ bgp_route_init (void)
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_ipv4_prefix_longer_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_advertised_route_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_advertised_route_csv_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_advertised_route_rmap_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_advertised_route_csv_rmap_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_advertised_route_rmap_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_routes_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_received_routes_rmap_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_received_routes_rmap_cmd);
|
||||
install_element (ENABLE_NODE, &show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_routes_cmd);
|
||||
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_routes_csv_cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user