mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-30 22:25:41 +00:00
Merge pull request #6362 from donaldsharp/typedef_i_hatez_it
Typedef replacements
This commit is contained in:
commit
a6f1ad43f0
29
zebra/rib.h
29
zebra/rib.h
@ -41,7 +41,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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)
|
PREDECL_LIST(rnh_list)
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ struct rnh {
|
|||||||
|
|
||||||
afi_t afi;
|
afi_t afi;
|
||||||
|
|
||||||
rnh_type_t type;
|
enum rnh_type type;
|
||||||
|
|
||||||
uint32_t seqno;
|
uint32_t seqno;
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ struct rtadv {
|
|||||||
* Structure that is hung off of a route_table that holds information about
|
* Structure that is hung off of a route_table that holds information about
|
||||||
* the table.
|
* the table.
|
||||||
*/
|
*/
|
||||||
typedef struct rib_table_info_t_ {
|
struct rib_table_info {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Back pointer to zebra_vrf.
|
* Back pointer to zebra_vrf.
|
||||||
@ -284,14 +284,13 @@ typedef struct rib_table_info_t_ {
|
|||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
afi_t afi;
|
afi_t afi;
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
|
};
|
||||||
|
|
||||||
} rib_table_info_t;
|
enum rib_tables_iter_state {
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
RIB_TABLES_ITER_S_INIT,
|
RIB_TABLES_ITER_S_INIT,
|
||||||
RIB_TABLES_ITER_S_ITERATING,
|
RIB_TABLES_ITER_S_ITERATING,
|
||||||
RIB_TABLES_ITER_S_DONE
|
RIB_TABLES_ITER_S_DONE
|
||||||
} rib_tables_iter_state_t;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure that holds state for iterating over all tables in the
|
* Structure that holds state for iterating over all tables in the
|
||||||
@ -301,16 +300,16 @@ typedef struct rib_tables_iter_t_ {
|
|||||||
vrf_id_t vrf_id;
|
vrf_id_t vrf_id;
|
||||||
int afi_safi_ix;
|
int afi_safi_ix;
|
||||||
|
|
||||||
rib_tables_iter_state_t state;
|
enum rib_tables_iter_state state;
|
||||||
} rib_tables_iter_t;
|
} rib_tables_iter_t;
|
||||||
|
|
||||||
/* Events/reasons triggering a RIB update. */
|
/* Events/reasons triggering a RIB update. */
|
||||||
typedef enum {
|
enum rib_update_event {
|
||||||
RIB_UPDATE_KERNEL,
|
RIB_UPDATE_KERNEL,
|
||||||
RIB_UPDATE_RMAP_CHANGE,
|
RIB_UPDATE_RMAP_CHANGE,
|
||||||
RIB_UPDATE_OTHER,
|
RIB_UPDATE_OTHER,
|
||||||
RIB_UPDATE_MAX
|
RIB_UPDATE_MAX
|
||||||
} rib_update_event_t;
|
};
|
||||||
|
|
||||||
extern void route_entry_copy_nexthops(struct route_entry *re,
|
extern void route_entry_copy_nexthops(struct route_entry *re,
|
||||||
struct nexthop *nh);
|
struct nexthop *nh);
|
||||||
@ -374,10 +373,10 @@ extern struct route_entry *rib_match_ipv4_multicast(vrf_id_t vrf_id,
|
|||||||
extern struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p,
|
extern struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p,
|
||||||
vrf_id_t vrf_id);
|
vrf_id_t vrf_id);
|
||||||
|
|
||||||
extern void rib_update(rib_update_event_t event);
|
extern void rib_update(enum rib_update_event event);
|
||||||
extern void rib_update_vrf(vrf_id_t vrf_id, rib_update_event_t event);
|
extern void rib_update_vrf(vrf_id_t vrf_id, enum rib_update_event event);
|
||||||
extern void rib_update_table(struct route_table *table,
|
extern void rib_update_table(struct route_table *table,
|
||||||
rib_update_event_t event);
|
enum rib_update_event event);
|
||||||
extern int rib_sweep_route(struct thread *t);
|
extern int rib_sweep_route(struct thread *t);
|
||||||
extern void rib_sweep_table(struct route_table *table);
|
extern void rib_sweep_table(struct route_table *table);
|
||||||
extern void rib_close_table(struct route_table *table);
|
extern void rib_close_table(struct route_table *table);
|
||||||
@ -412,9 +411,9 @@ extern void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq);
|
|||||||
/*
|
/*
|
||||||
* rib_table_info
|
* rib_table_info
|
||||||
*/
|
*/
|
||||||
static inline rib_table_info_t *rib_table_info(struct route_table *table)
|
static inline struct rib_table_info *rib_table_info(struct route_table *table)
|
||||||
{
|
{
|
||||||
return (rib_table_info_t *)route_table_get_info(table);
|
return (struct rib_table_info *)route_table_get_info(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -171,7 +171,7 @@ static int rtadv_recv_packet(struct zebra_vrf *zvrf, int sock, uint8_t *buf,
|
|||||||
|
|
||||||
/* Send router advertisement packet. */
|
/* Send router advertisement packet. */
|
||||||
static void rtadv_send_packet(int sock, struct interface *ifp,
|
static void rtadv_send_packet(int sock, struct interface *ifp,
|
||||||
ipv6_nd_suppress_ra_status stop)
|
enum ipv6_nd_suppress_ra_status stop)
|
||||||
{
|
{
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
@ -1003,7 +1003,7 @@ void rtadv_delete_prefix(struct zebra_if *zif, const struct prefix *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ipv6_nd_suppress_ra_set(struct interface *ifp,
|
static void ipv6_nd_suppress_ra_set(struct interface *ifp,
|
||||||
ipv6_nd_suppress_ra_status status)
|
enum ipv6_nd_suppress_ra_status status)
|
||||||
{
|
{
|
||||||
struct zebra_if *zif;
|
struct zebra_if *zif;
|
||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
|
@ -147,10 +147,10 @@ enum ipv6_nd_prefix_source {
|
|||||||
PREFIX_SRC_BOTH,
|
PREFIX_SRC_BOTH,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
enum ipv6_nd_suppress_ra_status {
|
||||||
RA_ENABLE = 0,
|
RA_ENABLE = 0,
|
||||||
RA_SUPPRESS,
|
RA_SUPPRESS,
|
||||||
} ipv6_nd_suppress_ra_status;
|
};
|
||||||
|
|
||||||
extern void rtadv_init(struct zebra_vrf *zvrf);
|
extern void rtadv_init(struct zebra_vrf *zvrf);
|
||||||
extern void rtadv_vrf_terminate(struct zebra_vrf *zvrf);
|
extern void rtadv_vrf_terminate(struct zebra_vrf *zvrf);
|
||||||
|
@ -1530,7 +1530,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
|
|||||||
{
|
{
|
||||||
int ret = EINVAL;
|
int ret = EINVAL;
|
||||||
const struct route_table *table = NULL;
|
const struct route_table *table = NULL;
|
||||||
const rib_table_info_t *info;
|
const struct rib_table_info *info;
|
||||||
const struct prefix *p, *src_p;
|
const struct prefix *p, *src_p;
|
||||||
struct zebra_ns *zns;
|
struct zebra_ns *zns;
|
||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
|
@ -76,15 +76,15 @@ static void zfpm_iterate_rmac_table(struct hash_bucket *backet, void *args);
|
|||||||
* Structure that holds state for iterating over all route_node
|
* Structure that holds state for iterating over all route_node
|
||||||
* structures that are candidates for being communicated to the FPM.
|
* structures that are candidates for being communicated to the FPM.
|
||||||
*/
|
*/
|
||||||
typedef struct zfpm_rnodes_iter_t_ {
|
struct zfpm_rnodes_iter {
|
||||||
rib_tables_iter_t tables_iter;
|
rib_tables_iter_t tables_iter;
|
||||||
route_table_iter_t iter;
|
route_table_iter_t iter;
|
||||||
} zfpm_rnodes_iter_t;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Statistics.
|
* Statistics.
|
||||||
*/
|
*/
|
||||||
typedef struct zfpm_stats_t_ {
|
struct zfpm_stats {
|
||||||
unsigned long connect_calls;
|
unsigned long connect_calls;
|
||||||
unsigned long connect_no_sock;
|
unsigned long connect_no_sock;
|
||||||
|
|
||||||
@ -115,13 +115,12 @@ typedef struct zfpm_stats_t_ {
|
|||||||
unsigned long t_conn_up_yields;
|
unsigned long t_conn_up_yields;
|
||||||
unsigned long t_conn_up_aborts;
|
unsigned long t_conn_up_aborts;
|
||||||
unsigned long t_conn_up_finishes;
|
unsigned long t_conn_up_finishes;
|
||||||
|
};
|
||||||
} zfpm_stats_t;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* States for the FPM state machine.
|
* States for the FPM state machine.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
enum zfpm_state {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In this state we are not yet ready to connect to the FPM. This
|
* In this state we are not yet ready to connect to the FPM. This
|
||||||
@ -147,20 +146,21 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
ZFPM_STATE_ESTABLISHED
|
ZFPM_STATE_ESTABLISHED
|
||||||
|
|
||||||
} zfpm_state_t;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Message format to be used to communicate with the FPM.
|
* Message format to be used to communicate with the FPM.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
enum zfpm_msg_format {
|
||||||
ZFPM_MSG_FORMAT_NONE,
|
ZFPM_MSG_FORMAT_NONE,
|
||||||
ZFPM_MSG_FORMAT_NETLINK,
|
ZFPM_MSG_FORMAT_NETLINK,
|
||||||
ZFPM_MSG_FORMAT_PROTOBUF,
|
ZFPM_MSG_FORMAT_PROTOBUF,
|
||||||
} zfpm_msg_format_e;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Globals.
|
* Globals.
|
||||||
*/
|
*/
|
||||||
typedef struct zfpm_glob_t_ {
|
struct zfpm_glob {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* True if the FPM module has been enabled.
|
* True if the FPM module has been enabled.
|
||||||
@ -170,11 +170,11 @@ typedef struct zfpm_glob_t_ {
|
|||||||
/*
|
/*
|
||||||
* Message format to be used to communicate with the fpm.
|
* Message format to be used to communicate with the fpm.
|
||||||
*/
|
*/
|
||||||
zfpm_msg_format_e message_format;
|
enum zfpm_msg_format message_format;
|
||||||
|
|
||||||
struct thread_master *master;
|
struct thread_master *master;
|
||||||
|
|
||||||
zfpm_state_t state;
|
enum zfpm_state state;
|
||||||
|
|
||||||
in_addr_t fpm_server;
|
in_addr_t fpm_server;
|
||||||
/*
|
/*
|
||||||
@ -231,7 +231,7 @@ typedef struct zfpm_glob_t_ {
|
|||||||
struct thread *t_conn_down;
|
struct thread *t_conn_down;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
zfpm_rnodes_iter_t iter;
|
struct zfpm_rnodes_iter iter;
|
||||||
} t_conn_down_state;
|
} t_conn_down_state;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -241,7 +241,7 @@ typedef struct zfpm_glob_t_ {
|
|||||||
struct thread *t_conn_up;
|
struct thread *t_conn_up;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
zfpm_rnodes_iter_t iter;
|
struct zfpm_rnodes_iter iter;
|
||||||
} t_conn_up_state;
|
} t_conn_up_state;
|
||||||
|
|
||||||
unsigned long connect_calls;
|
unsigned long connect_calls;
|
||||||
@ -251,18 +251,18 @@ typedef struct zfpm_glob_t_ {
|
|||||||
* Stats from the start of the current statistics interval up to
|
* Stats from the start of the current statistics interval up to
|
||||||
* now. These are the counters we typically update in the code.
|
* now. These are the counters we typically update in the code.
|
||||||
*/
|
*/
|
||||||
zfpm_stats_t stats;
|
struct zfpm_stats stats;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Statistics that were gathered in the last collection interval.
|
* Statistics that were gathered in the last collection interval.
|
||||||
*/
|
*/
|
||||||
zfpm_stats_t last_ivl_stats;
|
struct zfpm_stats last_ivl_stats;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cumulative stats from the last clear to the start of the current
|
* Cumulative stats from the last clear to the start of the current
|
||||||
* statistics interval.
|
* statistics interval.
|
||||||
*/
|
*/
|
||||||
zfpm_stats_t cumulative_stats;
|
struct zfpm_stats cumulative_stats;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stats interval timer.
|
* Stats interval timer.
|
||||||
@ -273,18 +273,17 @@ typedef struct zfpm_glob_t_ {
|
|||||||
* If non-zero, the last time when statistics were cleared.
|
* If non-zero, the last time when statistics were cleared.
|
||||||
*/
|
*/
|
||||||
time_t last_stats_clear_time;
|
time_t last_stats_clear_time;
|
||||||
|
};
|
||||||
|
|
||||||
} zfpm_glob_t;
|
static struct zfpm_glob zfpm_glob_space;
|
||||||
|
static struct zfpm_glob *zfpm_g = &zfpm_glob_space;
|
||||||
static zfpm_glob_t zfpm_glob_space;
|
|
||||||
static zfpm_glob_t *zfpm_g = &zfpm_glob_space;
|
|
||||||
|
|
||||||
static int zfpm_trigger_update(struct route_node *rn, const char *reason);
|
static int zfpm_trigger_update(struct route_node *rn, const char *reason);
|
||||||
|
|
||||||
static int zfpm_read_cb(struct thread *thread);
|
static int zfpm_read_cb(struct thread *thread);
|
||||||
static int zfpm_write_cb(struct thread *thread);
|
static int zfpm_write_cb(struct thread *thread);
|
||||||
|
|
||||||
static void zfpm_set_state(zfpm_state_t state, const char *reason);
|
static void zfpm_set_state(enum zfpm_state state, const char *reason);
|
||||||
static void zfpm_start_connect_timer(const char *reason);
|
static void zfpm_start_connect_timer(const char *reason);
|
||||||
static void zfpm_start_stats_timer(void);
|
static void zfpm_start_stats_timer(void);
|
||||||
static void zfpm_mac_info_del(struct fpm_mac_info_t *fpm_mac);
|
static void zfpm_mac_info_del(struct fpm_mac_info_t *fpm_mac);
|
||||||
@ -300,7 +299,7 @@ static inline int zfpm_thread_should_yield(struct thread *t)
|
|||||||
/*
|
/*
|
||||||
* zfpm_state_to_str
|
* zfpm_state_to_str
|
||||||
*/
|
*/
|
||||||
static const char *zfpm_state_to_str(zfpm_state_t state)
|
static const char *zfpm_state_to_str(enum zfpm_state state)
|
||||||
{
|
{
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
||||||
@ -343,7 +342,7 @@ static time_t zfpm_get_elapsed_time(time_t reference)
|
|||||||
/*
|
/*
|
||||||
* zfpm_rnodes_iter_init
|
* zfpm_rnodes_iter_init
|
||||||
*/
|
*/
|
||||||
static inline void zfpm_rnodes_iter_init(zfpm_rnodes_iter_t *iter)
|
static inline void zfpm_rnodes_iter_init(struct zfpm_rnodes_iter *iter)
|
||||||
{
|
{
|
||||||
memset(iter, 0, sizeof(*iter));
|
memset(iter, 0, sizeof(*iter));
|
||||||
rib_tables_iter_init(&iter->tables_iter);
|
rib_tables_iter_init(&iter->tables_iter);
|
||||||
@ -360,7 +359,8 @@ static inline void zfpm_rnodes_iter_init(zfpm_rnodes_iter_t *iter)
|
|||||||
/*
|
/*
|
||||||
* zfpm_rnodes_iter_next
|
* zfpm_rnodes_iter_next
|
||||||
*/
|
*/
|
||||||
static inline struct route_node *zfpm_rnodes_iter_next(zfpm_rnodes_iter_t *iter)
|
static inline struct route_node *
|
||||||
|
zfpm_rnodes_iter_next(struct zfpm_rnodes_iter *iter)
|
||||||
{
|
{
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
struct route_table *table;
|
struct route_table *table;
|
||||||
@ -389,7 +389,7 @@ static inline struct route_node *zfpm_rnodes_iter_next(zfpm_rnodes_iter_t *iter)
|
|||||||
/*
|
/*
|
||||||
* zfpm_rnodes_iter_pause
|
* zfpm_rnodes_iter_pause
|
||||||
*/
|
*/
|
||||||
static inline void zfpm_rnodes_iter_pause(zfpm_rnodes_iter_t *iter)
|
static inline void zfpm_rnodes_iter_pause(struct zfpm_rnodes_iter *iter)
|
||||||
{
|
{
|
||||||
route_table_iter_pause(&iter->iter);
|
route_table_iter_pause(&iter->iter);
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ static inline void zfpm_rnodes_iter_pause(zfpm_rnodes_iter_t *iter)
|
|||||||
/*
|
/*
|
||||||
* zfpm_rnodes_iter_cleanup
|
* zfpm_rnodes_iter_cleanup
|
||||||
*/
|
*/
|
||||||
static inline void zfpm_rnodes_iter_cleanup(zfpm_rnodes_iter_t *iter)
|
static inline void zfpm_rnodes_iter_cleanup(struct zfpm_rnodes_iter *iter)
|
||||||
{
|
{
|
||||||
route_table_iter_cleanup(&iter->iter);
|
route_table_iter_cleanup(&iter->iter);
|
||||||
rib_tables_iter_cleanup(&iter->tables_iter);
|
rib_tables_iter_cleanup(&iter->tables_iter);
|
||||||
@ -408,7 +408,7 @@ static inline void zfpm_rnodes_iter_cleanup(zfpm_rnodes_iter_t *iter)
|
|||||||
*
|
*
|
||||||
* Initialize a statistics block.
|
* Initialize a statistics block.
|
||||||
*/
|
*/
|
||||||
static inline void zfpm_stats_init(zfpm_stats_t *stats)
|
static inline void zfpm_stats_init(struct zfpm_stats *stats)
|
||||||
{
|
{
|
||||||
memset(stats, 0, sizeof(*stats));
|
memset(stats, 0, sizeof(*stats));
|
||||||
}
|
}
|
||||||
@ -416,7 +416,7 @@ static inline void zfpm_stats_init(zfpm_stats_t *stats)
|
|||||||
/*
|
/*
|
||||||
* zfpm_stats_reset
|
* zfpm_stats_reset
|
||||||
*/
|
*/
|
||||||
static inline void zfpm_stats_reset(zfpm_stats_t *stats)
|
static inline void zfpm_stats_reset(struct zfpm_stats *stats)
|
||||||
{
|
{
|
||||||
zfpm_stats_init(stats);
|
zfpm_stats_init(stats);
|
||||||
}
|
}
|
||||||
@ -424,7 +424,8 @@ static inline void zfpm_stats_reset(zfpm_stats_t *stats)
|
|||||||
/*
|
/*
|
||||||
* zfpm_stats_copy
|
* zfpm_stats_copy
|
||||||
*/
|
*/
|
||||||
static inline void zfpm_stats_copy(const zfpm_stats_t *src, zfpm_stats_t *dest)
|
static inline void zfpm_stats_copy(const struct zfpm_stats *src,
|
||||||
|
struct zfpm_stats *dest)
|
||||||
{
|
{
|
||||||
memcpy(dest, src, sizeof(*dest));
|
memcpy(dest, src, sizeof(*dest));
|
||||||
}
|
}
|
||||||
@ -440,8 +441,9 @@ static inline void zfpm_stats_copy(const zfpm_stats_t *src, zfpm_stats_t *dest)
|
|||||||
* structure is composed entirely of counters. This can easily be
|
* structure is composed entirely of counters. This can easily be
|
||||||
* changed when necessary.
|
* changed when necessary.
|
||||||
*/
|
*/
|
||||||
static void zfpm_stats_compose(const zfpm_stats_t *s1, const zfpm_stats_t *s2,
|
static void zfpm_stats_compose(const struct zfpm_stats *s1,
|
||||||
zfpm_stats_t *result)
|
const struct zfpm_stats *s2,
|
||||||
|
struct zfpm_stats *result)
|
||||||
{
|
{
|
||||||
const unsigned long *p1, *p2;
|
const unsigned long *p1, *p2;
|
||||||
unsigned long *result_p;
|
unsigned long *result_p;
|
||||||
@ -451,7 +453,7 @@ static void zfpm_stats_compose(const zfpm_stats_t *s1, const zfpm_stats_t *s2,
|
|||||||
p2 = (const unsigned long *)s2;
|
p2 = (const unsigned long *)s2;
|
||||||
result_p = (unsigned long *)result;
|
result_p = (unsigned long *)result;
|
||||||
|
|
||||||
num_counters = (sizeof(zfpm_stats_t) / sizeof(unsigned long));
|
num_counters = (sizeof(struct zfpm_stats) / sizeof(unsigned long));
|
||||||
|
|
||||||
for (i = 0; i < num_counters; i++) {
|
for (i = 0; i < num_counters; i++) {
|
||||||
result_p[i] = p1[i] + p2[i];
|
result_p[i] = p1[i] + p2[i];
|
||||||
@ -512,7 +514,7 @@ static inline void zfpm_connect_off(void)
|
|||||||
static int zfpm_conn_up_thread_cb(struct thread *thread)
|
static int zfpm_conn_up_thread_cb(struct thread *thread)
|
||||||
{
|
{
|
||||||
struct route_node *rnode;
|
struct route_node *rnode;
|
||||||
zfpm_rnodes_iter_t *iter;
|
struct zfpm_rnodes_iter *iter;
|
||||||
rib_dest_t *dest;
|
rib_dest_t *dest;
|
||||||
|
|
||||||
zfpm_g->t_conn_up = NULL;
|
zfpm_g->t_conn_up = NULL;
|
||||||
@ -626,7 +628,7 @@ static void zfpm_connect_check(void)
|
|||||||
static int zfpm_conn_down_thread_cb(struct thread *thread)
|
static int zfpm_conn_down_thread_cb(struct thread *thread)
|
||||||
{
|
{
|
||||||
struct route_node *rnode;
|
struct route_node *rnode;
|
||||||
zfpm_rnodes_iter_t *iter;
|
struct zfpm_rnodes_iter *iter;
|
||||||
rib_dest_t *dest;
|
rib_dest_t *dest;
|
||||||
struct fpm_mac_info_t *mac = NULL;
|
struct fpm_mac_info_t *mac = NULL;
|
||||||
|
|
||||||
@ -1308,9 +1310,9 @@ static int zfpm_connect_cb(struct thread *t)
|
|||||||
*
|
*
|
||||||
* Move state machine into the given state.
|
* Move state machine into the given state.
|
||||||
*/
|
*/
|
||||||
static void zfpm_set_state(zfpm_state_t state, const char *reason)
|
static void zfpm_set_state(enum zfpm_state state, const char *reason)
|
||||||
{
|
{
|
||||||
zfpm_state_t cur_state = zfpm_g->state;
|
enum zfpm_state cur_state = zfpm_g->state;
|
||||||
|
|
||||||
if (!reason)
|
if (!reason)
|
||||||
reason = "Unknown";
|
reason = "Unknown";
|
||||||
@ -1649,7 +1651,7 @@ static void zfpm_iterate_rmac_table(struct hash_bucket *backet, void *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* zfpm_stats_timer_cb
|
* struct zfpm_statsimer_cb
|
||||||
*/
|
*/
|
||||||
static int zfpm_stats_timer_cb(struct thread *t)
|
static int zfpm_stats_timer_cb(struct thread *t)
|
||||||
{
|
{
|
||||||
@ -1714,7 +1716,7 @@ void zfpm_start_stats_timer(void)
|
|||||||
*/
|
*/
|
||||||
static void zfpm_show_stats(struct vty *vty)
|
static void zfpm_show_stats(struct vty *vty)
|
||||||
{
|
{
|
||||||
zfpm_stats_t total_stats;
|
struct zfpm_stats total_stats;
|
||||||
time_t elapsed;
|
time_t elapsed;
|
||||||
|
|
||||||
vty_out(vty, "\n%-40s %10s Last %2d secs\n\n", "Counter", "Total",
|
vty_out(vty, "\n%-40s %10s Last %2d secs\n\n", "Counter", "Total",
|
||||||
|
@ -143,13 +143,13 @@ struct fpm_nh_encap_info_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* netlink_nh_info_t
|
* netlink_nh_info
|
||||||
*
|
*
|
||||||
* Holds information about a single nexthop for netlink. These info
|
* Holds information about a single nexthop for netlink. These info
|
||||||
* structures are transient and may contain pointers into rib
|
* structures are transient and may contain pointers into rib
|
||||||
* data structures for convenience.
|
* data structures for convenience.
|
||||||
*/
|
*/
|
||||||
typedef struct netlink_nh_info_t_ {
|
struct netlink_nh_info {
|
||||||
uint32_t if_index;
|
uint32_t if_index;
|
||||||
union g_addr *gateway;
|
union g_addr *gateway;
|
||||||
|
|
||||||
@ -160,14 +160,14 @@ typedef struct netlink_nh_info_t_ {
|
|||||||
int recursive;
|
int recursive;
|
||||||
enum nexthop_types_t type;
|
enum nexthop_types_t type;
|
||||||
struct fpm_nh_encap_info_t encap_info;
|
struct fpm_nh_encap_info_t encap_info;
|
||||||
} netlink_nh_info_t;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* netlink_route_info_t
|
* netlink_route_info
|
||||||
*
|
*
|
||||||
* A structure for holding information for a netlink route message.
|
* A structure for holding information for a netlink route message.
|
||||||
*/
|
*/
|
||||||
typedef struct netlink_route_info_t_ {
|
struct netlink_route_info {
|
||||||
uint16_t nlmsg_type;
|
uint16_t nlmsg_type;
|
||||||
uint8_t rtm_type;
|
uint8_t rtm_type;
|
||||||
uint32_t rtm_table;
|
uint32_t rtm_table;
|
||||||
@ -180,9 +180,9 @@ typedef struct netlink_route_info_t_ {
|
|||||||
/*
|
/*
|
||||||
* Nexthop structures
|
* Nexthop structures
|
||||||
*/
|
*/
|
||||||
netlink_nh_info_t nhs[MULTIPATH_NUM];
|
struct netlink_nh_info nhs[MULTIPATH_NUM];
|
||||||
union g_addr *pref_src;
|
union g_addr *pref_src;
|
||||||
} netlink_route_info_t;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* netlink_route_info_add_nh
|
* netlink_route_info_add_nh
|
||||||
@ -192,11 +192,11 @@ typedef struct netlink_route_info_t_ {
|
|||||||
*
|
*
|
||||||
* Returns true if a nexthop was added, false otherwise.
|
* Returns true if a nexthop was added, false otherwise.
|
||||||
*/
|
*/
|
||||||
static int netlink_route_info_add_nh(netlink_route_info_t *ri,
|
static int netlink_route_info_add_nh(struct netlink_route_info *ri,
|
||||||
struct nexthop *nexthop,
|
struct nexthop *nexthop,
|
||||||
struct route_entry *re)
|
struct route_entry *re)
|
||||||
{
|
{
|
||||||
netlink_nh_info_t nhi;
|
struct netlink_nh_info nhi;
|
||||||
union g_addr *src;
|
union g_addr *src;
|
||||||
zebra_l3vni_t *zl3vni = NULL;
|
zebra_l3vni_t *zl3vni = NULL;
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ static uint8_t netlink_proto_from_route_type(int type)
|
|||||||
*
|
*
|
||||||
* Returns true on success and false on failure.
|
* Returns true on success and false on failure.
|
||||||
*/
|
*/
|
||||||
static int netlink_route_info_fill(netlink_route_info_t *ri, int cmd,
|
static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd,
|
||||||
rib_dest_t *dest, struct route_entry *re)
|
rib_dest_t *dest, struct route_entry *re)
|
||||||
{
|
{
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
@ -353,13 +353,13 @@ static int netlink_route_info_fill(netlink_route_info_t *ri, int cmd,
|
|||||||
* Returns the number of bytes written to the buffer. 0 or a negative
|
* Returns the number of bytes written to the buffer. 0 or a negative
|
||||||
* value indicates an error.
|
* value indicates an error.
|
||||||
*/
|
*/
|
||||||
static int netlink_route_info_encode(netlink_route_info_t *ri, char *in_buf,
|
static int netlink_route_info_encode(struct netlink_route_info *ri,
|
||||||
size_t in_buf_len)
|
char *in_buf, size_t in_buf_len)
|
||||||
{
|
{
|
||||||
size_t bytelen;
|
size_t bytelen;
|
||||||
unsigned int nexthop_num = 0;
|
unsigned int nexthop_num = 0;
|
||||||
size_t buf_offset;
|
size_t buf_offset;
|
||||||
netlink_nh_info_t *nhi;
|
struct netlink_nh_info *nhi;
|
||||||
enum fpm_nh_encap_type_t encap;
|
enum fpm_nh_encap_type_t encap;
|
||||||
struct rtattr *nest;
|
struct rtattr *nest;
|
||||||
struct vxlan_encap_info_t *vxlan;
|
struct vxlan_encap_info_t *vxlan;
|
||||||
@ -520,9 +520,10 @@ done:
|
|||||||
*
|
*
|
||||||
* Helper function to log the information in a route_info structure.
|
* Helper function to log the information in a route_info structure.
|
||||||
*/
|
*/
|
||||||
static void zfpm_log_route_info(netlink_route_info_t *ri, const char *label)
|
static void zfpm_log_route_info(struct netlink_route_info *ri,
|
||||||
|
const char *label)
|
||||||
{
|
{
|
||||||
netlink_nh_info_t *nhi;
|
struct netlink_nh_info *nhi;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
zfpm_debug("%s : %s %s/%d, Proto: %s, Metric: %u", label,
|
zfpm_debug("%s : %s %s/%d, Proto: %s, Metric: %u", label,
|
||||||
@ -554,7 +555,7 @@ static void zfpm_log_route_info(netlink_route_info_t *ri, const char *label)
|
|||||||
int zfpm_netlink_encode_route(int cmd, rib_dest_t *dest, struct route_entry *re,
|
int zfpm_netlink_encode_route(int cmd, rib_dest_t *dest, struct route_entry *re,
|
||||||
char *in_buf, size_t in_buf_len)
|
char *in_buf, size_t in_buf_len)
|
||||||
{
|
{
|
||||||
netlink_route_info_t ri_space, *ri;
|
struct netlink_route_info ri_space, *ri;
|
||||||
|
|
||||||
ri = &ri_space;
|
ri = &ri_space;
|
||||||
|
|
||||||
|
@ -2092,7 +2092,7 @@ static unsigned nexthop_active_check(struct route_node *rn,
|
|||||||
* in every case.
|
* in every case.
|
||||||
*/
|
*/
|
||||||
if (!family) {
|
if (!family) {
|
||||||
rib_table_info_t *info;
|
struct rib_table_info *info;
|
||||||
|
|
||||||
info = srcdest_rnode_table_info(rn);
|
info = srcdest_rnode_table_info(rn);
|
||||||
family = info->afi;
|
family = info->afi;
|
||||||
|
@ -125,7 +125,7 @@ _rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn,
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (rn) {
|
if (rn) {
|
||||||
rib_table_info_t *info = srcdest_rnode_table_info(rn);
|
struct rib_table_info *info = srcdest_rnode_table_info(rn);
|
||||||
srcdest_rnode2str(rn, buf, sizeof(buf));
|
srcdest_rnode2str(rn, buf, sizeof(buf));
|
||||||
|
|
||||||
if (info->safi == SAFI_MULTICAST)
|
if (info->safi == SAFI_MULTICAST)
|
||||||
@ -420,7 +420,7 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
|
|||||||
struct route_entry *old)
|
struct route_entry *old)
|
||||||
{
|
{
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
rib_table_info_t *info = srcdest_rnode_table_info(rn);
|
struct rib_table_info *info = srcdest_rnode_table_info(rn);
|
||||||
struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id);
|
struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id);
|
||||||
const struct prefix *p, *src_p;
|
const struct prefix *p, *src_p;
|
||||||
enum zebra_dplane_result ret;
|
enum zebra_dplane_result ret;
|
||||||
@ -503,7 +503,7 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
|
|||||||
void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re)
|
void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re)
|
||||||
{
|
{
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
rib_table_info_t *info = srcdest_rnode_table_info(rn);
|
struct rib_table_info *info = srcdest_rnode_table_info(rn);
|
||||||
struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id);
|
struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id);
|
||||||
|
|
||||||
if (info->safi != SAFI_UNICAST) {
|
if (info->safi != SAFI_UNICAST) {
|
||||||
@ -546,7 +546,7 @@ void rib_uninstall_kernel(struct route_node *rn, struct route_entry *re)
|
|||||||
/* Uninstall the route from kernel. */
|
/* Uninstall the route from kernel. */
|
||||||
static void rib_uninstall(struct route_node *rn, struct route_entry *re)
|
static void rib_uninstall(struct route_node *rn, struct route_entry *re)
|
||||||
{
|
{
|
||||||
rib_table_info_t *info = srcdest_rnode_table_info(rn);
|
struct rib_table_info *info = srcdest_rnode_table_info(rn);
|
||||||
rib_dest_t *dest = rib_dest_from_rnode(rn);
|
rib_dest_t *dest = rib_dest_from_rnode(rn);
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
|
|
||||||
@ -3085,7 +3085,7 @@ int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
|
|||||||
return rib_add_multipath(afi, safi, p, src_p, re, ng);
|
return rib_add_multipath(afi, safi, p, src_p, re, ng);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *rib_update_event2str(rib_update_event_t event)
|
static const char *rib_update_event2str(enum rib_update_event event)
|
||||||
{
|
{
|
||||||
const char *ret = "UNKNOWN";
|
const char *ret = "UNKNOWN";
|
||||||
|
|
||||||
@ -3125,7 +3125,7 @@ static void rib_update_route_node(struct route_node *rn, int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Schedule routes of a particular table (address-family) based on event. */
|
/* Schedule routes of a particular table (address-family) based on event. */
|
||||||
void rib_update_table(struct route_table *table, rib_update_event_t event)
|
void rib_update_table(struct route_table *table, enum rib_update_event event)
|
||||||
{
|
{
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
|
|
||||||
@ -3133,13 +3133,14 @@ void rib_update_table(struct route_table *table, rib_update_event_t event)
|
|||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
struct vrf *vrf;
|
struct vrf *vrf;
|
||||||
|
|
||||||
zvrf = table->info ? ((rib_table_info_t *)table->info)->zvrf
|
zvrf = table->info
|
||||||
: NULL;
|
? ((struct rib_table_info *)table->info)->zvrf
|
||||||
|
: NULL;
|
||||||
vrf = zvrf ? zvrf->vrf : NULL;
|
vrf = zvrf ? zvrf->vrf : NULL;
|
||||||
|
|
||||||
zlog_debug("%s: %s VRF %s Table %u event %s", __func__,
|
zlog_debug("%s: %s VRF %s Table %u event %s", __func__,
|
||||||
table->info ? afi2str(
|
table->info ? afi2str(
|
||||||
((rib_table_info_t *)table->info)->afi)
|
((struct rib_table_info *)table->info)->afi)
|
||||||
: "Unknown",
|
: "Unknown",
|
||||||
VRF_LOGNAME(vrf), zvrf ? zvrf->table_id : 0,
|
VRF_LOGNAME(vrf), zvrf ? zvrf->table_id : 0,
|
||||||
rib_update_event2str(event));
|
rib_update_event2str(event));
|
||||||
@ -3173,7 +3174,7 @@ void rib_update_table(struct route_table *table, rib_update_event_t event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rib_update_handle_vrf(vrf_id_t vrf_id, rib_update_event_t event)
|
static void rib_update_handle_vrf(vrf_id_t vrf_id, enum rib_update_event event)
|
||||||
{
|
{
|
||||||
struct route_table *table;
|
struct route_table *table;
|
||||||
|
|
||||||
@ -3191,7 +3192,7 @@ static void rib_update_handle_vrf(vrf_id_t vrf_id, rib_update_event_t event)
|
|||||||
rib_update_table(table, event);
|
rib_update_table(table, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rib_update_handle_vrf_all(rib_update_event_t event)
|
static void rib_update_handle_vrf_all(enum rib_update_event event)
|
||||||
{
|
{
|
||||||
struct zebra_router_table *zrt;
|
struct zebra_router_table *zrt;
|
||||||
|
|
||||||
@ -3205,13 +3206,13 @@ static void rib_update_handle_vrf_all(rib_update_event_t event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct rib_update_ctx {
|
struct rib_update_ctx {
|
||||||
rib_update_event_t event;
|
enum rib_update_event event;
|
||||||
bool vrf_all;
|
bool vrf_all;
|
||||||
vrf_id_t vrf_id;
|
vrf_id_t vrf_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct rib_update_ctx *rib_update_ctx_init(vrf_id_t vrf_id,
|
static struct rib_update_ctx *rib_update_ctx_init(vrf_id_t vrf_id,
|
||||||
rib_update_event_t event)
|
enum rib_update_event event)
|
||||||
{
|
{
|
||||||
struct rib_update_ctx *ctx;
|
struct rib_update_ctx *ctx;
|
||||||
|
|
||||||
@ -3251,7 +3252,7 @@ static int rib_update_handler(struct thread *thread)
|
|||||||
static struct thread *t_rib_update_threads[RIB_UPDATE_MAX];
|
static struct thread *t_rib_update_threads[RIB_UPDATE_MAX];
|
||||||
|
|
||||||
/* Schedule a RIB update event for specific vrf */
|
/* Schedule a RIB update event for specific vrf */
|
||||||
void rib_update_vrf(vrf_id_t vrf_id, rib_update_event_t event)
|
void rib_update_vrf(vrf_id_t vrf_id, enum rib_update_event event)
|
||||||
{
|
{
|
||||||
struct rib_update_ctx *ctx;
|
struct rib_update_ctx *ctx;
|
||||||
|
|
||||||
@ -3271,7 +3272,7 @@ void rib_update_vrf(vrf_id_t vrf_id, rib_update_event_t event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Schedule a RIB update event for all vrfs */
|
/* Schedule a RIB update event for all vrfs */
|
||||||
void rib_update(rib_update_event_t event)
|
void rib_update(enum rib_update_event event)
|
||||||
{
|
{
|
||||||
struct rib_update_ctx *ctx;
|
struct rib_update_ctx *ctx;
|
||||||
|
|
||||||
@ -3425,7 +3426,7 @@ unsigned long rib_score_proto(uint8_t proto, unsigned short instance)
|
|||||||
void rib_close_table(struct route_table *table)
|
void rib_close_table(struct route_table *table)
|
||||||
{
|
{
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
rib_table_info_t *info;
|
struct rib_table_info *info;
|
||||||
rib_dest_t *dest;
|
rib_dest_t *dest;
|
||||||
|
|
||||||
if (!table)
|
if (!table)
|
||||||
|
@ -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,
|
static void copy_state(struct rnh *rnh, const struct route_entry *re,
|
||||||
struct route_node *rn);
|
struct route_node *rn);
|
||||||
static int compare_state(struct route_entry *r1, struct route_entry *r2);
|
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,
|
static int send_client(struct rnh *rnh, struct zserv *client,
|
||||||
vrf_id_t vrf_id);
|
enum rnh_type type, vrf_id_t vrf_id);
|
||||||
static void print_rnh(struct route_node *rn, struct vty *vty);
|
static void print_rnh(struct route_node *rn, struct vty *vty);
|
||||||
static int zebra_client_cleanup_rnh(struct zserv *client);
|
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,
|
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 zebra_vrf *zvrf;
|
||||||
struct route_table *t = NULL;
|
struct route_table *t = NULL;
|
||||||
@ -148,7 +148,7 @@ static void zebra_rnh_store_in_routing_table(struct rnh *rnh)
|
|||||||
route_unlock_node(rn);
|
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)
|
bool *exists)
|
||||||
{
|
{
|
||||||
struct route_table *table;
|
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);
|
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_table *table;
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
@ -258,7 +259,7 @@ void zebra_free_rnh(struct rnh *rnh)
|
|||||||
XFREE(MTYPE_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;
|
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.
|
* and as such it will have a resolved rnh.
|
||||||
*/
|
*/
|
||||||
void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client,
|
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) {
|
if (IS_ZEBRA_DEBUG_NHT) {
|
||||||
char buf[PREFIX2STR_BUFFER];
|
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,
|
void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client,
|
||||||
rnh_type_t type)
|
enum rnh_type type)
|
||||||
{
|
{
|
||||||
if (IS_ZEBRA_DEBUG_NHT) {
|
if (IS_ZEBRA_DEBUG_NHT) {
|
||||||
char buf[PREFIX2STR_BUFFER];
|
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 */
|
/* Evaluate one tracked entry */
|
||||||
static void zebra_rnh_evaluate_entry(struct zebra_vrf *zvrf, afi_t afi,
|
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 route_node *nrn)
|
||||||
{
|
{
|
||||||
struct rnh *rnh;
|
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.
|
* covers multiple nexthops we are interested in.
|
||||||
*/
|
*/
|
||||||
static void zebra_rnh_clear_nhc_flag(struct zebra_vrf *zvrf, afi_t afi,
|
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 rnh *rnh;
|
||||||
struct route_entry *re;
|
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.
|
* of a particular VRF and address-family or a specific prefix.
|
||||||
*/
|
*/
|
||||||
void zebra_evaluate_rnh(struct zebra_vrf *zvrf, afi_t afi, int force,
|
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_table *rnh_table;
|
||||||
struct route_node *nrn;
|
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,
|
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_table *table;
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
@ -997,8 +998,8 @@ static int compare_state(struct route_entry *r1, struct route_entry *r2)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type,
|
static int send_client(struct rnh *rnh, struct zserv *client,
|
||||||
vrf_id_t vrf_id)
|
enum rnh_type type, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
struct route_entry *re;
|
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,
|
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_table *ntable;
|
||||||
struct route_node *nrn;
|
struct route_node *nrn;
|
||||||
|
@ -31,7 +31,7 @@ extern "C" {
|
|||||||
|
|
||||||
extern void zebra_rnh_init(void);
|
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) {
|
switch (type) {
|
||||||
case RNH_NEXTHOP_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,
|
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,
|
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_free_rnh(struct rnh *rnh);
|
||||||
extern void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client,
|
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_register_rnh_pseudowire(vrf_id_t, struct zebra_pw *);
|
||||||
extern void zebra_deregister_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,
|
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,
|
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,
|
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 char *rnh_str(struct rnh *rnh, char *buf, int size);
|
||||||
|
|
||||||
extern int rnh_resolve_via_default(struct zebra_vrf *zvrf, int family);
|
extern int rnh_resolve_via_default(struct zebra_vrf *zvrf, int family);
|
||||||
|
@ -93,7 +93,7 @@ struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf,
|
|||||||
{
|
{
|
||||||
struct zebra_router_table finder;
|
struct zebra_router_table finder;
|
||||||
struct zebra_router_table *zrt;
|
struct zebra_router_table *zrt;
|
||||||
rib_table_info_t *info;
|
struct rib_table_info *info;
|
||||||
|
|
||||||
memset(&finder, 0, sizeof(finder));
|
memset(&finder, 0, sizeof(finder));
|
||||||
finder.afi = afi;
|
finder.afi = afi;
|
||||||
@ -133,7 +133,7 @@ void zebra_router_show_table_summary(struct vty *vty)
|
|||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"---------------------------------------------------------------------------\n");
|
"---------------------------------------------------------------------------\n");
|
||||||
RB_FOREACH (zrt, zebra_router_table_head, &zrouter.tables) {
|
RB_FOREACH (zrt, zebra_router_table_head, &zrouter.tables) {
|
||||||
rib_table_info_t *info = route_table_get_info(zrt->table);
|
struct rib_table_info *info = route_table_get_info(zrt->table);
|
||||||
|
|
||||||
vty_out(vty, "%-16s%5d %9d %7s %15s %8d %10lu\n", info->zvrf->vrf->name,
|
vty_out(vty, "%-16s%5d %9d %7s %15s %8d %10lu\n", info->zvrf->vrf->name,
|
||||||
zrt->ns_id, info->zvrf->vrf->vrf_id,
|
zrt->ns_id, info->zvrf->vrf->vrf_id,
|
||||||
|
@ -33,10 +33,10 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* MPLS (Segment Routing) global block */
|
/* MPLS (Segment Routing) global block */
|
||||||
typedef struct mpls_srgb_t_ {
|
struct mpls_srgb {
|
||||||
uint32_t start_label;
|
uint32_t start_label;
|
||||||
uint32_t end_label;
|
uint32_t end_label;
|
||||||
} mpls_srgb_t;
|
};
|
||||||
|
|
||||||
struct zebra_rmap {
|
struct zebra_rmap {
|
||||||
char *name;
|
char *name;
|
||||||
@ -111,7 +111,7 @@ struct zebra_vrf {
|
|||||||
struct route_table *fec_table[AFI_MAX];
|
struct route_table *fec_table[AFI_MAX];
|
||||||
|
|
||||||
/* MPLS Segment Routing Global block */
|
/* MPLS Segment Routing Global block */
|
||||||
mpls_srgb_t mpls_srgb;
|
struct mpls_srgb mpls_srgb;
|
||||||
|
|
||||||
/* Pseudowires. */
|
/* Pseudowires. */
|
||||||
struct zebra_pw_head pseudowires;
|
struct zebra_pw_head pseudowires;
|
||||||
|
@ -357,7 +357,8 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
|
|||||||
|
|
||||||
const char *mcast_info = "";
|
const char *mcast_info = "";
|
||||||
if (mcast) {
|
if (mcast) {
|
||||||
rib_table_info_t *info = srcdest_rnode_table_info(rn);
|
struct rib_table_info *info =
|
||||||
|
srcdest_rnode_table_info(rn);
|
||||||
mcast_info = (info->safi == SAFI_MULTICAST)
|
mcast_info = (info->safi == SAFI_MULTICAST)
|
||||||
? " using Multicast RIB"
|
? " using Multicast RIB"
|
||||||
: " using Unicast RIB";
|
: " using Unicast RIB";
|
||||||
@ -978,7 +979,7 @@ static void do_show_ip_route_all(struct vty *vty, struct zebra_vrf *zvrf,
|
|||||||
unsigned short ospf_instance_id)
|
unsigned short ospf_instance_id)
|
||||||
{
|
{
|
||||||
struct zebra_router_table *zrt;
|
struct zebra_router_table *zrt;
|
||||||
rib_table_info_t *info;
|
struct rib_table_info *info;
|
||||||
|
|
||||||
RB_FOREACH (zrt, zebra_router_table_head,
|
RB_FOREACH (zrt, zebra_router_table_head,
|
||||||
&zrouter.tables) {
|
&zrouter.tables) {
|
||||||
@ -1059,7 +1060,7 @@ DEFPY (show_ip_nht,
|
|||||||
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
||||||
vrf_id_t vrf_id = VRF_DEFAULT;
|
vrf_id_t vrf_id = VRF_DEFAULT;
|
||||||
struct prefix prefix, *p = NULL;
|
struct prefix prefix, *p = NULL;
|
||||||
rnh_type_t rtype;
|
enum rnh_type rtype;
|
||||||
|
|
||||||
if (strcmp(type, "nht") == 0)
|
if (strcmp(type, "nht") == 0)
|
||||||
rtype = RNH_NEXTHOP_TYPE;
|
rtype = RNH_NEXTHOP_TYPE;
|
||||||
@ -1832,8 +1833,8 @@ static void vty_show_ip_route_summary(struct vty *vty,
|
|||||||
if (!use_json)
|
if (!use_json)
|
||||||
vty_out(vty, "%-20s %-20s %s (vrf %s)\n", "Route Source",
|
vty_out(vty, "%-20s %-20s %s (vrf %s)\n", "Route Source",
|
||||||
"Routes", "FIB",
|
"Routes", "FIB",
|
||||||
zvrf_name(((rib_table_info_t *)route_table_get_info(
|
zvrf_name(((struct rib_table_info *)
|
||||||
table))
|
route_table_get_info(table))
|
||||||
->zvrf));
|
->zvrf));
|
||||||
|
|
||||||
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
|
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
|
||||||
@ -1980,8 +1981,8 @@ static void vty_show_ip_route_summary_prefix(struct vty *vty,
|
|||||||
if (!use_json)
|
if (!use_json)
|
||||||
vty_out(vty, "%-20s %-20s %s (vrf %s)\n", "Route Source",
|
vty_out(vty, "%-20s %-20s %s (vrf %s)\n", "Route Source",
|
||||||
"Prefix Routes", "FIB",
|
"Prefix Routes", "FIB",
|
||||||
zvrf_name(((rib_table_info_t *)route_table_get_info(
|
zvrf_name(((struct rib_table_info *)
|
||||||
table))
|
route_table_get_info(table))
|
||||||
->zvrf));
|
->zvrf));
|
||||||
|
|
||||||
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
|
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user