0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Config: Removed obsolete force_restart option when commiting

This commit is contained in:
Maria Matejka 2024-06-13 15:36:18 +02:00
parent ea996d8403
commit 397eee5a00
6 changed files with 15 additions and 24 deletions

View File

@ -243,11 +243,11 @@ config_del_obstacle(struct config *c)
ev_send_loop(&main_birdloop, &c->done_event); ev_send_loop(&main_birdloop, &c->done_event);
} }
static int static void
global_commit(struct config *new, struct config *old) global_commit(struct config *new, struct config *old)
{ {
if (!old) if (!old)
return 0; return;
if (!new->router_id) if (!new->router_id)
{ {
@ -262,8 +262,6 @@ global_commit(struct config *new, struct config *old)
new->router_id = id; new->router_id = id;
} }
} }
return 0;
} }
static int static int
@ -299,14 +297,14 @@ config_do_commit(struct config *c, int type)
DBG("filter_commit\n"); DBG("filter_commit\n");
filter_commit(c, old_config); filter_commit(c, old_config);
DBG("sysdep_commit\n"); DBG("sysdep_commit\n");
int force_restart = sysdep_commit(c, old_config); sysdep_commit(c, old_config);
DBG("global_commit\n"); DBG("global_commit\n");
force_restart |= global_commit(c, old_config); global_commit(c, old_config);
mpls_commit(c, old_config); mpls_commit(c, old_config);
DBG("rt_commit\n"); DBG("rt_commit\n");
rt_commit(c, old_config); rt_commit(c, old_config);
DBG("protos_commit\n"); DBG("protos_commit\n");
protos_commit(c, old_config, force_restart, type); protos_commit(c, old_config, type);
int obs = old_config ? int obs = old_config ?
atomic_fetch_sub_explicit(&old_config->obstacle_count, 1, memory_order_acq_rel) - 1 atomic_fetch_sub_explicit(&old_config->obstacle_count, 1, memory_order_acq_rel) - 1
: 0; : 0;

View File

@ -281,7 +281,7 @@ int cf_parse(void);
/* Sysdep hooks */ /* Sysdep hooks */
void sysdep_preconfig(struct config *); void sysdep_preconfig(struct config *);
int sysdep_commit(struct config *, struct config *); void sysdep_commit(struct config *, struct config *);
void sysdep_shutdown_done(void); void sysdep_shutdown_done(void);
#endif #endif

View File

@ -1456,20 +1456,17 @@ static struct protos_commit_request {
struct config *new; struct config *new;
struct config *old; struct config *old;
enum protocol_startup phase; enum protocol_startup phase;
int force_reconfig;
int type; int type;
} protos_commit_request; } protos_commit_request;
static int proto_rethink_goal_pending = 0; static int proto_rethink_goal_pending = 0;
static void protos_do_commit(struct config *new, struct config *old, int force_reconfig, int type); static void protos_do_commit(struct config *new, struct config *old, int type);
/** /**
* protos_commit - commit new protocol configuration * protos_commit - commit new protocol configuration
* @new: new configuration * @new: new configuration
* @old: old configuration or %NULL if it's boot time config * @old: old configuration or %NULL if it's boot time config
* @force_reconfig: force restart of all protocols (used for example
* when the router ID changes)
* @type: type of reconfiguration (RECONFIG_SOFT or RECONFIG_HARD) * @type: type of reconfiguration (RECONFIG_SOFT or RECONFIG_HARD)
* *
* Scan differences between @old and @new configuration and adjust all * Scan differences between @old and @new configuration and adjust all
@ -1493,21 +1490,20 @@ static void protos_do_commit(struct config *new, struct config *old, int force_r
* configuration after the shutdown is completed. * configuration after the shutdown is completed.
*/ */
void void
protos_commit(struct config *new, struct config *old, int force_reconfig, int type) protos_commit(struct config *new, struct config *old, int type)
{ {
protos_commit_request = (struct protos_commit_request) { protos_commit_request = (struct protos_commit_request) {
.new = new, .new = new,
.old = old, .old = old,
.phase = (new->shutdown && !new->gr_down) ? PROTOCOL_STARTUP_REGULAR : PROTOCOL_STARTUP_NECESSARY, .phase = (new->shutdown && !new->gr_down) ? PROTOCOL_STARTUP_REGULAR : PROTOCOL_STARTUP_NECESSARY,
.force_reconfig = force_reconfig,
.type = type, .type = type,
}; };
protos_do_commit(new, old, force_reconfig, type); protos_do_commit(new, old, type);
} }
static void static void
protos_do_commit(struct config *new, struct config *old, int force_reconfig, int type) protos_do_commit(struct config *new, struct config *old, int type)
{ {
enum protocol_startup phase = protos_commit_request.phase; enum protocol_startup phase = protos_commit_request.phase;
struct proto_config *oc, *nc; struct proto_config *oc, *nc;
@ -1558,7 +1554,7 @@ protos_do_commit(struct config *new, struct config *old, int force_reconfig, int
nc->proto = p; nc->proto = p;
/* We will try to reconfigure protocol p */ /* We will try to reconfigure protocol p */
if (!force_reconfig && proto_reconfigure(p, oc, nc, type)) if (proto_reconfigure(p, oc, nc, type))
{ {
PROTO_LEAVE_FROM_MAIN(proto_loop); PROTO_LEAVE_FROM_MAIN(proto_loop);
continue; continue;
@ -1643,7 +1639,7 @@ protos_do_commit(struct config *new, struct config *old, int force_reconfig, int
/* If something is pending, the next round will be called asynchronously from proto_rethink_goal(). */ /* If something is pending, the next round will be called asynchronously from proto_rethink_goal(). */
if (!proto_rethink_goal_pending) if (!proto_rethink_goal_pending)
protos_do_commit(new, old, force_reconfig, type); protos_do_commit(new, old, type);
} }
static void static void
@ -1701,7 +1697,6 @@ done:
protos_do_commit( protos_do_commit(
protos_commit_request.new, protos_commit_request.new,
protos_commit_request.old, protos_commit_request.old,
protos_commit_request.force_reconfig,
protos_commit_request.type protos_commit_request.type
); );
} }

View File

@ -76,7 +76,7 @@ struct protocol {
void protos_build(void); /* Called from sysdep to initialize protocols */ void protos_build(void); /* Called from sysdep to initialize protocols */
void proto_build(struct protocol *); /* Called from protocol to register itself */ void proto_build(struct protocol *); /* Called from protocol to register itself */
void protos_preconfig(struct config *); void protos_preconfig(struct config *);
void protos_commit(struct config *new, struct config *old, int force_restart, int type); void protos_commit(struct config *new, struct config *old, int type);
struct proto * proto_spawn(struct proto_config *cf, uint disabled); struct proto * proto_spawn(struct proto_config *cf, uint disabled);
void protos_dump_all(void); void protos_dump_all(void);

View File

@ -200,14 +200,13 @@ sysdep_preconfig(struct config *c)
#endif #endif
} }
int void
sysdep_commit(struct config *new, struct config *old) sysdep_commit(struct config *new, struct config *old)
{ {
if (!new->shutdown) if (!new->shutdown)
log_switch(0, &new->logfiles, new->syslog_name); log_switch(0, &new->logfiles, new->syslog_name);
bird_thread_commit(new, old); bird_thread_commit(new, old);
return 0;
} }
static int static int

View File

@ -559,10 +559,9 @@ void cmd_reconfig_undo_notify(void) {}
void sysdep_preconfig(struct config *c UNUSED) {} void sysdep_preconfig(struct config *c UNUSED) {}
void bird_thread_commit(struct config *new, struct config *old); void bird_thread_commit(struct config *new, struct config *old);
int sysdep_commit(struct config *new, struct config *old) void sysdep_commit(struct config *new, struct config *old)
{ {
bird_thread_commit(new, old); bird_thread_commit(new, old);
return 0;
} }
void sysdep_shutdown_done(void) {} void sysdep_shutdown_done(void) {}