0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-03 07:31:54 +00:00

Fixed unwanted reloads while reconfiguring protocols with import table on

This commit is contained in:
Maria Matejka 2023-03-08 13:44:18 +01:00
parent 97d2875e99
commit 90de93ca03
4 changed files with 14 additions and 13 deletions

View File

@ -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);

View File

@ -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); }

View File

@ -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) ||

View File

@ -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;
};