[frr] [PATCH v2 03/10] bgpd: move bgp_show_type enumerate to single header place

Philippe Guibert philippe.guibert at 6wind.com
Wed Dec 21 09:02:06 EST 2016


Because bgp_show_type is used many times for encap and vpnv4 families,
this define is moved to a single place. It will be used from this place.

Signed-off-by: Philippe Guibert <philippe.guibert at 6wind.com>
---
 bgpd/bgp_encap.c   | 16 ----------------
 bgpd/bgp_mplsvpn.c | 16 ----------------
 bgpd/bgp_route.c   | 21 ---------------------
 bgpd/bgp_route.h   | 21 +++++++++++++++++++++
 4 files changed, 21 insertions(+), 53 deletions(-)

diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c
index 4ea2f9cde73a..8f25de7539e3 100644
--- a/bgpd/bgp_encap.c
+++ b/bgpd/bgp_encap.c
@@ -332,22 +332,6 @@ show_adj_route_encap (struct vty *vty, struct peer *peer, struct prefix_rd *prd)
   return CMD_SUCCESS;
 }
 
-enum bgp_show_type
-{
-  bgp_show_type_normal,
-  bgp_show_type_regexp,
-  bgp_show_type_prefix_list,
-  bgp_show_type_filter_list,
-  bgp_show_type_neighbor,
-  bgp_show_type_cidr_only,
-  bgp_show_type_prefix_longer,
-  bgp_show_type_community_all,
-  bgp_show_type_community,
-  bgp_show_type_community_exact,
-  bgp_show_type_community_list,
-  bgp_show_type_community_list_exact
-};
-
 static int
 bgp_show_encap (
     struct vty *vty,
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index c64c69dfca12..3ba2f5dad9b3 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -661,22 +661,6 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u
   return CMD_SUCCESS;
 }
 
-enum bgp_show_type
-{
-  bgp_show_type_normal,
-  bgp_show_type_regexp,
-  bgp_show_type_prefix_list,
-  bgp_show_type_filter_list,
-  bgp_show_type_neighbor,
-  bgp_show_type_cidr_only,
-  bgp_show_type_prefix_longer,
-  bgp_show_type_community_all,
-  bgp_show_type_community,
-  bgp_show_type_community_exact,
-  bgp_show_type_community_list,
-  bgp_show_type_community_list_exact
-};
-
 static int
 bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
 		   enum bgp_show_type type, void *output_arg, int tags, u_char use_json)
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index cfc4ec34077f..58c88686ff51 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -7217,27 +7217,6 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
 #define BGP_SHOW_DAMP_HEADER "   Network          From             Reuse    Path%s"
 #define BGP_SHOW_FLAP_HEADER "   Network          From            Flaps Duration Reuse    Path%s"
 
-enum bgp_show_type
-{
-  bgp_show_type_normal,
-  bgp_show_type_regexp,
-  bgp_show_type_prefix_list,
-  bgp_show_type_filter_list,
-  bgp_show_type_route_map,
-  bgp_show_type_neighbor,
-  bgp_show_type_cidr_only,
-  bgp_show_type_prefix_longer,
-  bgp_show_type_community_all,
-  bgp_show_type_community,
-  bgp_show_type_community_exact,
-  bgp_show_type_community_list,
-  bgp_show_type_community_list_exact,
-  bgp_show_type_flap_statistics,
-  bgp_show_type_flap_neighbor,
-  bgp_show_type_dampend_paths,
-  bgp_show_type_damp_neighbor
-};
-
 static int
 bgp_show_prefix_list (struct vty *vty, const char *name,
                       const char *prefix_list_str, afi_t afi,
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 63b18aa2d8fb..1c6eac5f85d3 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -32,6 +32,27 @@ struct bgp_nexthop_cache;
 #define BGP_SHOW_OCODE_HEADER "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s"
 #define BGP_SHOW_HEADER "   Network          Next Hop            Metric LocPrf Weight Path%s"
 
+enum bgp_show_type
+{
+  bgp_show_type_normal,
+  bgp_show_type_regexp,
+  bgp_show_type_prefix_list,
+  bgp_show_type_filter_list,
+  bgp_show_type_route_map,
+  bgp_show_type_neighbor,
+  bgp_show_type_cidr_only,
+  bgp_show_type_prefix_longer,
+  bgp_show_type_community_all,
+  bgp_show_type_community,
+  bgp_show_type_community_exact,
+  bgp_show_type_community_list,
+  bgp_show_type_community_list_exact,
+  bgp_show_type_flap_statistics,
+  bgp_show_type_flap_neighbor,
+  bgp_show_type_dampend_paths,
+  bgp_show_type_damp_neighbor
+};
+
 /* Ancillary information to struct bgp_info, 
  * used for uncommonly used data (aggregation, MPLS, etc.)
  * and lazily allocated to save memory.
-- 
2.1.4





More information about the dev mailing list