diff options
-rw-r--r-- | nest/proto.c | 9 | ||||
-rw-r--r-- | nest/protocol.h | 1 | ||||
-rw-r--r-- | proto/bgp/bgp.c | 14 | ||||
-rw-r--r-- | proto/bgp/config.Y | 3 |
4 files changed, 14 insertions, 13 deletions
diff --git a/nest/proto.c b/nest/proto.c index 6c6d4ed3..3a8c938e 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -690,7 +690,7 @@ channel_reload_dump_req(struct rt_export_request *req) void channel_reload_export_bulk(struct rt_export_request *req, const net_addr *net, struct rt_pending_export *rpe, rte **feed, uint count); /* Called by protocol to activate in_table */ -void +static void channel_setup_in_table(struct channel *c) { c->reload_req = (struct rt_export_request) { @@ -701,8 +701,6 @@ channel_setup_in_table(struct channel *c) .dump_req = channel_reload_dump_req, .log_state_change = channel_reload_log_state_change, }; - - c->in_keep |= RIK_PREFILTER; } @@ -711,6 +709,9 @@ channel_do_start(struct channel *c) { c->proto->active_channels++; + if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER) + channel_setup_in_table(c); + CALL(c->channel->start, c); channel_start_import(c); @@ -882,7 +883,7 @@ channel_request_reload(struct channel *c) CD(c, "Reload requested"); - if (c->in_keep & RIK_PREFILTER) + if ((c->in_keep & RIK_PREFILTER) == RIK_PREFILTER) channel_schedule_reload(c); else c->proto->reload_routes(c); diff --git a/nest/protocol.h b/nest/protocol.h index f9f89c06..fe987d17 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -642,7 +642,6 @@ 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); } diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index 26fccdc3..851167b6 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -651,7 +651,7 @@ bgp_conn_enter_established_state(struct bgp_conn *conn) int active = loc->ready && rem->ready; c->c.disabled = !active; - c->c.reloadable = p->route_refresh || c->cf->import_table; + c->c.reloadable = p->route_refresh || ((c->c.in_keep & RIK_PREFILTER) == RIK_PREFILTER); c->index = active ? num++ : 0; @@ -1868,9 +1868,6 @@ bgp_channel_start(struct channel *C) c->pool = p->p.pool; // XXXX - if (c->cf->import_table) - channel_setup_in_table(C); - if (c->cf->export_table) bgp_setup_out_table(c); @@ -2283,7 +2280,6 @@ bgp_channel_reconfigure(struct channel *C, struct channel_config *CC, int *impor (new->llgr_time != old->llgr_time) || (new->ext_next_hop != old->ext_next_hop) || (new->add_path != old->add_path) || - (new->import_table != old->import_table) || (new->export_table != old->export_table) || (TABLE(new, igp_table_ip4) != TABLE(old, igp_table_ip4)) || (TABLE(new, igp_table_ip6) != TABLE(old, igp_table_ip6)) || @@ -2298,11 +2294,13 @@ bgp_channel_reconfigure(struct channel *C, struct channel_config *CC, int *impor (new->aigp != old->aigp) || (new->cost != old->cost)) { - /* import_changed itself does not force ROUTE_REFRESH when import_table is active */ - if ((c->c.in_keep & RIK_PREFILTER) && (c->c.channel_state == CS_UP)) + /* If import table is active and route refresh is possible, we just ask for route refresh */ + if ((c->c.in_keep & RIK_PREFILTER) && (c->c.channel_state == CS_UP) && p->route_refresh) bgp_schedule_packet(p->conn, c, PKT_ROUTE_REFRESH); - *import_changed = 1; + /* Otherwise we do complete reload */ + else + *import_changed = 1; } if (!ipa_equal(new->next_hop_addr, old->next_hop_addr) || diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y index 66d97e3b..a51c82bd 100644 --- a/proto/bgp/config.Y +++ b/proto/bgp/config.Y @@ -329,6 +329,9 @@ bgp_channel_end: if (!this_channel->table) cf_error("Routing table not specified"); + if (BGP_CC->import_table) + this_channel->in_keep |= RIK_PREFILTER; + this_channel = NULL; }; |