From f92155718692b89c60d483c378e59120628e9538 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 7 May 2020 08:55:55 -0400 Subject: [PATCH] zebra: Remove typedef rnh_type_t from system Signed-off-by: Donald Sharp --- zebra/rib.h | 4 ++-- zebra/zebra_rnh.c | 31 ++++++++++++++++--------------- zebra/zebra_rnh.h | 14 +++++++------- zebra/zebra_vty.c | 2 +- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/zebra/rib.h b/zebra/rib.h index 3717a12814..e982758d0c 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -41,7 +41,7 @@ extern "C" { #endif -typedef enum { RNH_NEXTHOP_TYPE, RNH_IMPORT_CHECK_TYPE } rnh_type_t; +enum rnh_type { RNH_NEXTHOP_TYPE, RNH_IMPORT_CHECK_TYPE }; PREDECL_LIST(rnh_list) @@ -58,7 +58,7 @@ struct rnh { afi_t afi; - rnh_type_t type; + enum rnh_type type; uint32_t seqno; diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index f9c74c7462..ad2e00b1ec 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -57,8 +57,8 @@ static void free_state(vrf_id_t vrf_id, struct route_entry *re, static void copy_state(struct rnh *rnh, const struct route_entry *re, struct route_node *rn); static int compare_state(struct route_entry *r1, struct route_entry *r2); -static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type, - vrf_id_t vrf_id); +static int send_client(struct rnh *rnh, struct zserv *client, + enum rnh_type type, vrf_id_t vrf_id); static void print_rnh(struct route_node *rn, struct vty *vty); static int zebra_client_cleanup_rnh(struct zserv *client); @@ -68,7 +68,7 @@ void zebra_rnh_init(void) } static inline struct route_table *get_rnh_table(vrf_id_t vrfid, afi_t afi, - rnh_type_t type) + enum rnh_type type) { struct zebra_vrf *zvrf; struct route_table *t = NULL; @@ -148,7 +148,7 @@ static void zebra_rnh_store_in_routing_table(struct rnh *rnh) route_unlock_node(rn); } -struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid, rnh_type_t type, +struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid, enum rnh_type type, bool *exists) { struct route_table *table; @@ -207,7 +207,8 @@ struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid, rnh_type_t type, return (rn->info); } -struct rnh *zebra_lookup_rnh(struct prefix *p, vrf_id_t vrfid, rnh_type_t type) +struct rnh *zebra_lookup_rnh(struct prefix *p, vrf_id_t vrfid, + enum rnh_type type) { struct route_table *table; struct route_node *rn; @@ -258,7 +259,7 @@ void zebra_free_rnh(struct rnh *rnh) XFREE(MTYPE_RNH, rnh); } -static void zebra_delete_rnh(struct rnh *rnh, rnh_type_t type) +static void zebra_delete_rnh(struct rnh *rnh, enum rnh_type type) { struct route_node *rn; @@ -289,7 +290,7 @@ static void zebra_delete_rnh(struct rnh *rnh, rnh_type_t type) * and as such it will have a resolved rnh. */ void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client, - rnh_type_t type, vrf_id_t vrf_id) + enum rnh_type type, vrf_id_t vrf_id) { if (IS_ZEBRA_DEBUG_NHT) { char buf[PREFIX2STR_BUFFER]; @@ -308,7 +309,7 @@ void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client, } void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client, - rnh_type_t type) + enum rnh_type type) { if (IS_ZEBRA_DEBUG_NHT) { char buf[PREFIX2STR_BUFFER]; @@ -804,7 +805,7 @@ static void zebra_rnh_eval_nexthop_entry(struct zebra_vrf *zvrf, afi_t afi, /* Evaluate one tracked entry */ static void zebra_rnh_evaluate_entry(struct zebra_vrf *zvrf, afi_t afi, - int force, rnh_type_t type, + int force, enum rnh_type type, struct route_node *nrn) { struct rnh *rnh; @@ -851,7 +852,7 @@ static void zebra_rnh_evaluate_entry(struct zebra_vrf *zvrf, afi_t afi, * covers multiple nexthops we are interested in. */ static void zebra_rnh_clear_nhc_flag(struct zebra_vrf *zvrf, afi_t afi, - rnh_type_t type, struct route_node *nrn) + enum rnh_type type, struct route_node *nrn) { struct rnh *rnh; struct route_entry *re; @@ -875,7 +876,7 @@ static void zebra_rnh_clear_nhc_flag(struct zebra_vrf *zvrf, afi_t afi, * of a particular VRF and address-family or a specific prefix. */ void zebra_evaluate_rnh(struct zebra_vrf *zvrf, afi_t afi, int force, - rnh_type_t type, struct prefix *p) + enum rnh_type type, struct prefix *p) { struct route_table *rnh_table; struct route_node *nrn; @@ -911,7 +912,7 @@ void zebra_evaluate_rnh(struct zebra_vrf *zvrf, afi_t afi, int force, } void zebra_print_rnh_table(vrf_id_t vrfid, afi_t afi, struct vty *vty, - rnh_type_t type, struct prefix *p) + enum rnh_type type, struct prefix *p) { struct route_table *table; struct route_node *rn; @@ -997,8 +998,8 @@ static int compare_state(struct route_entry *r1, struct route_entry *r2) return 0; } -static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type, - vrf_id_t vrf_id) +static int send_client(struct rnh *rnh, struct zserv *client, + enum rnh_type type, vrf_id_t vrf_id) { struct stream *s; struct route_entry *re; @@ -1134,7 +1135,7 @@ static void print_rnh(struct route_node *rn, struct vty *vty) } static int zebra_cleanup_rnh_client(vrf_id_t vrf_id, afi_t afi, - struct zserv *client, rnh_type_t type) + struct zserv *client, enum rnh_type type) { struct route_table *ntable; struct route_node *nrn; diff --git a/zebra/zebra_rnh.h b/zebra/zebra_rnh.h index 6e2dab8d9f..f07e5bc791 100644 --- a/zebra/zebra_rnh.h +++ b/zebra/zebra_rnh.h @@ -31,7 +31,7 @@ extern "C" { extern void zebra_rnh_init(void); -static inline const char *rnh_type2str(rnh_type_t type) +static inline const char *rnh_type2str(enum rnh_type type) { switch (type) { case RNH_NEXTHOP_TYPE: @@ -44,20 +44,20 @@ static inline const char *rnh_type2str(rnh_type_t type) } extern struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid, - rnh_type_t type, bool *exists); + enum rnh_type type, bool *exists); extern struct rnh *zebra_lookup_rnh(struct prefix *p, vrf_id_t vrfid, - rnh_type_t type); + enum rnh_type type); extern void zebra_free_rnh(struct rnh *rnh); extern void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client, - rnh_type_t type, vrf_id_t vrfid); + enum rnh_type type, vrf_id_t vrfid); extern void zebra_register_rnh_pseudowire(vrf_id_t, struct zebra_pw *); extern void zebra_deregister_rnh_pseudowire(vrf_id_t, struct zebra_pw *); extern void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client, - rnh_type_t type); + enum rnh_type type); extern void zebra_evaluate_rnh(struct zebra_vrf *zvrf, afi_t afi, int force, - rnh_type_t type, struct prefix *p); + enum rnh_type type, struct prefix *p); extern void zebra_print_rnh_table(vrf_id_t vrfid, afi_t afi, struct vty *vty, - rnh_type_t type, struct prefix *p); + enum rnh_type type, struct prefix *p); extern char *rnh_str(struct rnh *rnh, char *buf, int size); extern int rnh_resolve_via_default(struct zebra_vrf *zvrf, int family); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 8024db4ca7..b809b75812 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1059,7 +1059,7 @@ DEFPY (show_ip_nht, afi_t afi = ipv4 ? AFI_IP : AFI_IP6; vrf_id_t vrf_id = VRF_DEFAULT; struct prefix prefix, *p = NULL; - rnh_type_t rtype; + enum rnh_type rtype; if (strcmp(type, "nht") == 0) rtype = RNH_NEXTHOP_TYPE; -- 2.39.5