mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
BGP: implement Adj-RIB-In
The patch implements optional internal import table to a channel and hooks it to BGP so it can be used as Adj-RIB-In. When enabled, all received (pre-filtered) routes are stored there and import filters can be re-evaluated without explicit route refresh. An import table can be examined using e.g. 'show route import table bgp1.ipv4'.
This commit is contained in:
@@ -306,8 +306,6 @@ rte_make_tmp_attrs(struct rte **rt, struct linpool *pool)
|
||||
(*rt)->attrs->eattrs = ea;
|
||||
}
|
||||
|
||||
/* Moved from route.h to avoid dependency conflicts */
|
||||
static inline void rte_update(struct proto *p, const net_addr *n, rte *new) { rte_update2(p->main_channel, n, new, p->main_source); }
|
||||
|
||||
extern pool *proto_pool;
|
||||
extern list proto_list;
|
||||
@@ -539,6 +537,11 @@ struct channel {
|
||||
|
||||
btime last_state_change; /* Time of last state transition */
|
||||
btime last_tx_filter_change;
|
||||
|
||||
struct rtable *in_table; /* Internal table for received routes */
|
||||
struct event *reload_event; /* Event responsible for reloading from in_table */
|
||||
struct fib_iterator reload_fit; /* Iterator in in_table used during reloading */
|
||||
u8 reload_active; /* Iterator reload_fit is linked */
|
||||
};
|
||||
|
||||
|
||||
@@ -606,6 +609,8 @@ struct channel *proto_add_channel(struct proto *p, struct channel_config *cf);
|
||||
int proto_configure_channel(struct proto *p, struct channel **c, struct channel_config *cf);
|
||||
|
||||
void channel_set_state(struct channel *c, uint state);
|
||||
void channel_setup_in_table(struct channel *c);
|
||||
void channel_schedule_reload(struct channel *c);
|
||||
|
||||
static inline void channel_init(struct channel *c) { channel_set_state(c, CS_START); }
|
||||
static inline void channel_open(struct channel *c) { channel_set_state(c, CS_UP); }
|
||||
@@ -617,4 +622,17 @@ void *channel_config_get(const struct channel_class *cc, const char *name, uint
|
||||
int channel_reconfigure(struct channel *c, struct channel_config *cf);
|
||||
|
||||
|
||||
/* Moved from route.h to avoid dependency conflicts */
|
||||
static inline void rte_update(struct proto *p, const net_addr *n, rte *new) { rte_update2(p->main_channel, n, new, p->main_source); }
|
||||
|
||||
static inline void
|
||||
rte_update3(struct channel *c, const net_addr *n, rte *new, struct rte_src *src)
|
||||
{
|
||||
if (c->in_table && !rte_update_in(c, n, new, src))
|
||||
return;
|
||||
|
||||
rte_update2(c, n, new, src);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user