summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2019-06-18 16:27:21 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2019-06-30 21:29:24 +0200
commit8a68316eb96be1fecf91ca395f3321aa99997ad2 (patch)
treec38f9ef7d4733585c4658af5badbfa5f1a5e2ede /conf
parentbdf2e55d98636eacaac8188ee0bd000cc10d217c (diff)
Nest: Add command to request graceful restart
When 'graceful down' command is entered, protocols are shut down with regard to graceful restart. Namely Kernel protocol does not remove routes and BGP protocol does not send notification, just closes the connection.
Diffstat (limited to 'conf')
-rw-r--r--conf/conf.c9
-rw-r--r--conf/conf.h3
2 files changed, 9 insertions, 3 deletions
diff --git a/conf/conf.c b/conf/conf.c
index d6b3e8e8..0b797dec 100644
--- a/conf/conf.c
+++ b/conf/conf.c
@@ -492,19 +492,24 @@ config_init(void)
* for switching to an empty configuration.
*/
void
-order_shutdown(void)
+order_shutdown(int gr)
{
struct config *c;
if (shutting_down)
return;
- log(L_INFO "Shutting down");
+ if (!gr)
+ log(L_INFO "Shutting down");
+ else
+ log(L_INFO "Shutting down for graceful restart");
+
c = lp_alloc(config->mem, sizeof(struct config));
memcpy(c, config, sizeof(struct config));
init_list(&c->protos);
init_list(&c->tables);
c->shutdown = 1;
+ c->gr_down = gr;
config_commit(c, RECONFIG_HARD, 0);
shutting_down = 1;
diff --git a/conf/conf.h b/conf/conf.h
index 51dcb989..777a1fca 100644
--- a/conf/conf.h
+++ b/conf/conf.h
@@ -55,6 +55,7 @@ struct config {
struct sym_scope *root_scope; /* Scope for root symbols */
int obstacle_count; /* Number of items blocking freeing of this config */
int shutdown; /* This is a pseudo-config for daemon shutdown */
+ int gr_down; /* This is a pseudo-config for graceful restart */
btime load_time; /* When we've got this configuration */
};
@@ -75,7 +76,7 @@ void config_init(void);
void cf_error(const char *msg, ...) NORET;
void config_add_obstacle(struct config *);
void config_del_obstacle(struct config *);
-void order_shutdown(void);
+void order_shutdown(int gr);
#define RECONFIG_NONE 0
#define RECONFIG_HARD 1