summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-06-19 23:49:34 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-06-19 23:49:34 +0200
commitbf1aec970e9ac0600266fe7a045847a62f18ac3b (patch)
tree4b6a27829ddded655066f135a8e23da598e1d59a /conf
parent789772ed4586213d6a7fbb867b9296a01ce1b9c0 (diff)
Adds support for soft reconfiguration.
Diffstat (limited to 'conf')
-rw-r--r--conf/conf.c15
-rw-r--r--conf/conf.h4
2 files changed, 11 insertions, 8 deletions
diff --git a/conf/conf.c b/conf/conf.c
index 71e81b5c..710d5c20 100644
--- a/conf/conf.c
+++ b/conf/conf.c
@@ -189,7 +189,7 @@ global_commit(struct config *new, struct config *old)
}
static int
-config_do_commit(struct config *c)
+config_do_commit(struct config *c, int type)
{
int force_restart, nobs;
@@ -205,7 +205,7 @@ config_do_commit(struct config *c)
DBG("rt_commit\n");
rt_commit(c, old_config);
DBG("protos_commit\n");
- protos_commit(c, old_config, force_restart);
+ protos_commit(c, old_config, force_restart, type);
new_config = NULL; /* Just to be sure nobody uses that now */
if (old_config)
nobs = --old_config->obstacle_count;
@@ -236,7 +236,7 @@ config_done(void *unused UNUSED)
c = future_config;
future_config = NULL;
log(L_INFO "Switching to queued configuration...");
- if (!config_do_commit(c))
+ if (!config_do_commit(c, RECONFIG_HARD))
break;
}
}
@@ -244,6 +244,7 @@ config_done(void *unused UNUSED)
/**
* config_commit - commit a configuration
* @c: new configuration
+ * @type: type of reconfiguration (RECONFIG_SOFT or RECONFIG_HARD)
*
* When a configuration is parsed and prepared for use, the
* config_commit() function starts the process of reconfiguration.
@@ -263,11 +264,11 @@ config_done(void *unused UNUSED)
* are accepted.
*/
int
-config_commit(struct config *c)
+config_commit(struct config *c, int type)
{
if (!config) /* First-time configuration */
{
- config_do_commit(c);
+ config_do_commit(c, RECONFIG_HARD);
return CONF_DONE;
}
if (old_config) /* Reconfiguration already in progress */
@@ -288,7 +289,7 @@ config_commit(struct config *c)
future_config = c;
return CONF_QUEUED;
}
- if (config_do_commit(c))
+ if (config_do_commit(c, type))
{
config_done(NULL);
return CONF_DONE;
@@ -321,7 +322,7 @@ order_shutdown(void)
init_list(&c->tables);
c->shutdown = 1;
shutting_down = 1;
- config_commit(c);
+ config_commit(c, RECONFIG_HARD);
shutting_down = 2;
}
diff --git a/conf/conf.h b/conf/conf.h
index ef27f3f4..8c2d5491 100644
--- a/conf/conf.h
+++ b/conf/conf.h
@@ -50,7 +50,9 @@ struct config *config_alloc(byte *name);
int config_parse(struct config *);
int cli_parse(struct config *);
void config_free(struct config *);
-int config_commit(struct config *);
+int config_commit(struct config *, int type);
+#define RECONFIG_HARD 0
+#define RECONFIG_SOFT 1
void cf_error(char *msg, ...) NORET;
void config_add_obstacle(struct config *);
void config_del_obstacle(struct config *);