From: Dinesh Dutt <[email protected]>

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 <[email protected]>
Signed-off-by: Donald Sharp <[email protected]>
---
 bgpd/bgp_route.c | 373 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 316 insertions(+), 57 deletions(-)

diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 126dc11..e17396d 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -714,11 +714,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, const 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];
 
@@ -726,8 +727,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;
@@ -736,7 +747,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, const 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;
 
@@ -2269,7 +2329,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);
@@ -10292,19 +10352,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)
+               int in, char *delim, const 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;
 
@@ -10313,8 +10376,8 @@ 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))
     {
@@ -10327,6 +10390,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)
       {
@@ -10346,9 +10410,16 @@ show_adj_route (struct vty *vty, struct peer *peer, 
afi_t afi, safi_t safi,
                  header2 = 0;
                }
              if (ain->attr)
-               { 
-                 route_vty_out_tmp (vty, &rn->p, ain->attr, safi);
-                 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);
+                     output_count++;
+                   }
+                 else
+                   filtered_count++;
                }
            }
       }
@@ -10370,9 +10441,26 @@ show_adj_route (struct vty *vty, struct peer *peer, 
afi_t afi, safi_t safi,
                  header2 = 0;
                }
              if (adj->attr)
-               {       
-                 route_vty_out_tmp (vty, &rn->p, adj->attr, safi);
-                 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);
+                     output_count++;
+                   }
+                 else
+                   filtered_count++;
                }
            }
       }
@@ -10383,7 +10471,8 @@ 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)
+peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
+                int in, char *delim, const char *rmap_name)
 {    
   if (! peer || ! peer->afc[afi][safi])
     {
@@ -10398,7 +10487,17 @@ peer_adj_routes (struct vty *vty, struct peer *peer, 
afi_t afi, safi_t safi, int
       return CMD_WARNING;
     }
 
-  show_adj_route (vty, peer, afi, safi, in);
+  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;
 }
@@ -10425,11 +10524,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);
+
+  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
@@ -10440,7 +10539,32 @@ ALIAS (show_ip_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")
+{
+  struct peer *peer;
+  const 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_ipv4_neighbor_advertised_route,
        show_ip_bgp_ipv4_neighbor_advertised_route_cmd,
@@ -10458,17 +10582,37 @@ DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
        "Display the routes advertised to a BGP neighbor\n")
 {
   struct peer *peer;
+  const char *rmap_name = NULL;
 
   peer = peer_lookup_in_view (vty, NULL, argv[1]);
   if (! peer)
     return CMD_WARNING;
 
+  if (argc == 3)
+    rmap_name = argv[2];
+
   if (strncmp (argv[0], "m", 1) == 0)
-    return peer_adj_routes (vty, peer, AFI_IP, SAFI_MULTICAST, 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);
+  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,
@@ -10491,9 +10635,9 @@ 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);
+  return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, NULL, NULL);
 }
 
 ALIAS (show_bgp_view_neighbor_advertised_route,
@@ -10510,60 +10654,58 @@ ALIAS (show_bgp_view_neighbor_advertised_route,
        "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",
+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
        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")
+       "Display the routes advertised to a BGP neighbor\n")
+
 {
   struct peer *peer;
+  const 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_IP6, SAFI_UNICAST, 1);
+  if (argc == 2)
+    rmap_name = argv[1];
+
+  return peer_adj_routes (vty, peer, AFI_IP6, SAFI_UNICAST, 0, NULL, 
rmap_name);
 }
 
-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",
+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
-       "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")
+       "Display the routes advertised to a BGP neighbor\n")
 
-ALIAS (show_bgp_view_neighbor_advertised_route,
-       show_bgp_neighbor_advertised_route_cmd,
-       "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) advertised-routes",
+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
        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")
-       
-ALIAS (show_bgp_view_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",
+
+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"
@@ -10574,7 +10716,7 @@ ALIAS (show_bgp_view_neighbor_advertised_route,
        "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
@@ -10606,10 +10748,36 @@ DEFUN (ipv6_mbgp_neighbor_advertised_route,
   if (! peer)
     return CMD_WARNING;  
 
-  return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 0);
+  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",
@@ -10634,10 +10802,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);
+  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
@@ -10649,6 +10831,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;
+  const 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",
@@ -10665,17 +10874,36 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
        "Display the received routes from neighbor\n")
 {
   struct peer *peer;
+  const char *rmap_name = NULL;
 
   peer = peer_lookup_in_view (vty, NULL, argv[1]);
   if (! peer)
     return CMD_WARNING;
-  
+
+  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);
+    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);
+  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,
        "show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors 
(A.B.C.D|X:X::X:X|WORD) (advertised-routes|received-routes)",
@@ -10708,7 +10936,7 @@ DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes,
   safi = (strncmp (argv[2], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
   in = (strncmp (argv[4], "r", 1) == 0) ? 1 : 0;
 
-  return peer_adj_routes (vty, peer, afi, safi, in);
+  return peer_adj_routes (vty, peer, afi, safi, in, NULL, NULL);
 }
 
 DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
@@ -10844,6 +11072,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",
@@ -10934,7 +11185,7 @@ DEFUN (ipv6_mbgp_neighbor_received_routes,
   if (! peer)
     return CMD_WARNING;
 
-  return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 1);
+  return peer_adj_routes (vty, peer, AFI_IP6, SAFI_MULTICAST, 1, NULL, NULL);
 }
 
 DEFUN (show_bgp_view_neighbor_received_prefix_filter,
@@ -13101,9 +13352,13 @@ 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_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_ipv4_neighbor_routes_cmd);
@@ -13253,9 +13508,13 @@ bgp_route_init (void)
   install_element (ENABLE_NODE, &show_ip_bgp_prefix_longer_cmd);
   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_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_ipv4_neighbor_routes_cmd);
-- 
1.9.1


_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to