diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-09-27 22:57:55 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-12-12 14:46:24 +0100 |
commit | 682d3f7de0905ca2e853844734cce7ff65f7d77d (patch) | |
tree | e84ab31b4c5b7e99a283cf4c2faf2523dd5d884c /nest/protocol.h | |
parent | 01fd00f5ed9298ab5829403cd7a8a9ba22bcc96a (diff) |
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'.
Diffstat (limited to 'nest/protocol.h')
-rw-r--r-- | nest/protocol.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/nest/protocol.h b/nest/protocol.h index 3008087b..aa836f38 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -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 |