version 1.1.1.1, 2017/08/22 12:33:54
|
version 1.1.1.2, 2021/03/17 19:50:23
|
Line 12
|
Line 12
|
#include "lib/lists.h" |
#include "lib/lists.h" |
#include "lib/resource.h" |
#include "lib/resource.h" |
#include "lib/timer.h" |
#include "lib/timer.h" |
|
#include "nest/route.h" |
#include "conf/conf.h" |
#include "conf/conf.h" |
|
|
struct iface; |
struct iface; |
Line 75 void protos_dump_all(void);
|
Line 76 void protos_dump_all(void);
|
*/ |
*/ |
|
|
extern struct protocol |
extern struct protocol |
proto_device, proto_radv, proto_rip, proto_static, | proto_device, proto_radv, proto_rip, proto_static, proto_mrt, |
proto_ospf, proto_pipe, proto_bgp, proto_bfd, proto_babel; |
proto_ospf, proto_pipe, proto_bgp, proto_bfd, proto_babel; |
|
|
/* |
/* |
Line 92 struct proto_config {
|
Line 93 struct proto_config {
|
int class; /* SYM_PROTO or SYM_TEMPLATE */ |
int class; /* SYM_PROTO or SYM_TEMPLATE */ |
u32 debug, mrtdump; /* Debugging bitfields, both use D_* constants */ |
u32 debug, mrtdump; /* Debugging bitfields, both use D_* constants */ |
unsigned preference, disabled; /* Generic parameters */ |
unsigned preference, disabled; /* Generic parameters */ |
|
int vrf_set; /* Related VRF instance (below) is defined */ |
int in_keep_filtered; /* Routes rejected in import filter are kept */ |
int in_keep_filtered; /* Routes rejected in import filter are kept */ |
u32 router_id; /* Protocol specific router ID */ |
u32 router_id; /* Protocol specific router ID */ |
|
struct iface *vrf; /* Related VRF instance, NULL if global */ |
struct rtable_config *table; /* Table we're attached to */ |
struct rtable_config *table; /* Table we're attached to */ |
struct filter *in_filter, *out_filter; /* Attached filters */ |
struct filter *in_filter, *out_filter; /* Attached filters */ |
struct proto_limit *rx_limit; /* Limit for receiving routes from protocol |
struct proto_limit *rx_limit; /* Limit for receiving routes from protocol |
Line 147 struct proto {
|
Line 150 struct proto {
|
unsigned preference; /* Default route preference */ |
unsigned preference; /* Default route preference */ |
byte accept_ra_types; /* Which types of route announcements are accepted (RA_OPTIMAL or RA_ANY) */ |
byte accept_ra_types; /* Which types of route announcements are accepted (RA_OPTIMAL or RA_ANY) */ |
byte disabled; /* Manually disabled */ |
byte disabled; /* Manually disabled */ |
|
byte vrf_set; /* Related VRF instance (above) is defined */ |
byte proto_state; /* Protocol state machine (PS_*, see below) */ |
byte proto_state; /* Protocol state machine (PS_*, see below) */ |
byte core_state; /* Core state machine (FS_*, see below) */ |
byte core_state; /* Core state machine (FS_*, see below) */ |
byte export_state; /* Route export state (ES_*, see below) */ |
byte export_state; /* Route export state (ES_*, see below) */ |
Line 162 struct proto {
|
Line 166 struct proto {
|
u32 hash_key; /* Random key used for hashing of neighbors */ |
u32 hash_key; /* Random key used for hashing of neighbors */ |
bird_clock_t last_state_change; /* Time of last state transition */ |
bird_clock_t last_state_change; /* Time of last state transition */ |
char *last_state_name_announced; /* Last state name we've announced to the user */ |
char *last_state_name_announced; /* Last state name we've announced to the user */ |
|
char *message; /* State-change message, allocated from proto_pool */ |
struct proto_stats stats; /* Current protocol statistics */ |
struct proto_stats stats; /* Current protocol statistics */ |
|
|
/* |
/* |
Line 210 struct proto {
|
Line 215 struct proto {
|
int (*rte_better)(struct rte *, struct rte *); |
int (*rte_better)(struct rte *, struct rte *); |
int (*rte_same)(struct rte *, struct rte *); |
int (*rte_same)(struct rte *, struct rte *); |
int (*rte_mergable)(struct rte *, struct rte *); |
int (*rte_mergable)(struct rte *, struct rte *); |
|
struct rte * (*rte_modify)(struct rte *, struct linpool *); |
void (*rte_insert)(struct network *, struct rte *); |
void (*rte_insert)(struct network *, struct rte *); |
void (*rte_remove)(struct network *, struct rte *); |
void (*rte_remove)(struct network *, struct rte *); |
|
|
|
struct iface *vrf; /* Related VRF instance, NULL if global */ |
struct rtable *table; /* Our primary routing table */ |
struct rtable *table; /* Our primary routing table */ |
struct rte_src *main_source; /* Primary route source */ |
struct rte_src *main_source; /* Primary route source */ |
struct announce_hook *main_ahook; /* Primary announcement hook */ |
struct announce_hook *main_ahook; /* Primary announcement hook */ |
Line 247 struct proto_spec {
|
Line 254 struct proto_spec {
|
void *proto_new(struct proto_config *, unsigned size); |
void *proto_new(struct proto_config *, unsigned size); |
void *proto_config_new(struct protocol *, int class); |
void *proto_config_new(struct protocol *, int class); |
void proto_copy_config(struct proto_config *dest, struct proto_config *src); |
void proto_copy_config(struct proto_config *dest, struct proto_config *src); |
|
void proto_set_message(struct proto *p, char *msg, int len); |
void proto_request_feeding(struct proto *p); |
void proto_request_feeding(struct proto *p); |
|
|
static inline void |
static inline void |
Line 264 void proto_graceful_restart_unlock(struct proto *p);
|
Line 272 void proto_graceful_restart_unlock(struct proto *p);
|
void proto_show_limit(struct proto_limit *l, const char *dsc); |
void proto_show_limit(struct proto_limit *l, const char *dsc); |
void proto_show_basic_info(struct proto *p); |
void proto_show_basic_info(struct proto *p); |
|
|
void proto_cmd_show(struct proto *, uint, int); | void proto_cmd_show(struct proto *, uintptr_t, int); |
void proto_cmd_disable(struct proto *, uint, int); | void proto_cmd_disable(struct proto *, uintptr_t, int); |
void proto_cmd_enable(struct proto *, uint, int); | void proto_cmd_enable(struct proto *, uintptr_t, int); |
void proto_cmd_restart(struct proto *, uint, int); | void proto_cmd_restart(struct proto *, uintptr_t, int); |
void proto_cmd_reload(struct proto *, uint, int); | void proto_cmd_reload(struct proto *, uintptr_t, int); |
void proto_cmd_debug(struct proto *, uint, int); | void proto_cmd_debug(struct proto *, uintptr_t, int); |
void proto_cmd_mrtdump(struct proto *, uint, int); | void proto_cmd_mrtdump(struct proto *, uintptr_t, int); |
|
|
void proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, uint, int), int restricted, uint arg); | void proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, uintptr_t, int), int restricted, uintptr_t arg); |
struct proto *proto_get_named(struct symbol *, struct protocol *); |
struct proto *proto_get_named(struct symbol *, struct protocol *); |
|
|
#define CMD_RELOAD 0 |
#define CMD_RELOAD 0 |
Line 285 proto_get_router_id(struct proto_config *pc)
|
Line 293 proto_get_router_id(struct proto_config *pc)
|
return pc->router_id ? pc->router_id : pc->global->router_id; |
return pc->router_id ? pc->router_id : pc->global->router_id; |
} |
} |
|
|
|
static inline struct ea_list * |
|
rte_make_tmp_attrs(struct rte *rt, struct linpool *pool) |
|
{ |
|
struct ea_list *(*mta)(struct rte *rt, struct linpool *pool); |
|
mta = rt->attrs->src->proto->make_tmp_attrs; |
|
return mta ? mta(rt, pool) : NULL; |
|
} |
|
|
|
/* Moved from route.h to avoid dependency conflicts */ |
|
static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_ahook, net, new, p->main_source); } |
|
|
extern list active_proto_list; |
extern list active_proto_list; |
|
|
/* |
/* |
Line 455 struct announce_hook {
|
Line 474 struct announce_hook {
|
struct proto_stats *stats; /* Per-table protocol statistics */ |
struct proto_stats *stats; /* Per-table protocol statistics */ |
struct announce_hook *next; /* Next hook for the same protocol */ |
struct announce_hook *next; /* Next hook for the same protocol */ |
int in_keep_filtered; /* Routes rejected in import filter are kept */ |
int in_keep_filtered; /* Routes rejected in import filter are kept */ |
|
bird_clock_t last_out_filter_change; /* Last time when out_filter _changed_ */ |
}; |
}; |
|
|
struct announce_hook *proto_add_announce_hook(struct proto *p, struct rtable *t, struct proto_stats *stats); |
struct announce_hook *proto_add_announce_hook(struct proto *p, struct rtable *t, struct proto_stats *stats); |