aboutsummaryrefslogtreecommitdiffstats
path: root/sysdep
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 /sysdep
parentbdf2e55d98636eacaac8188ee0bd000cc10d217c (diff)
downloadbird-8a68316eb96be1fecf91ca395f3321aa99997ad2.tar.gz
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 'sysdep')
-rw-r--r--sysdep/unix/config.Y4
-rw-r--r--sysdep/unix/krt.c2
-rw-r--r--sysdep/unix/main.c15
-rw-r--r--sysdep/unix/unix.h1
4 files changed, 19 insertions, 3 deletions
diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y
index 2895a69e..b78e0e6c 100644
--- a/sysdep/unix/config.Y
+++ b/sysdep/unix/config.Y
@@ -133,6 +133,10 @@ CF_CLI(CONFIGURE CHECK, cfg_name, [\"<file>\"], [[Parse configuration and check
CF_CLI(DOWN,,, [[Shut the daemon down]])
{ cmd_shutdown(); } ;
+CF_CLI(GRACEFUL DOWN,,, [[Shut the daemon down for graceful restart]])
+{ cmd_graceful_restart(); } ;
+
+
cfg_name:
/* empty */ { $$ = NULL; }
| TEXT
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index 3aee3fe2..f0e78442 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -1129,7 +1129,7 @@ krt_shutdown(struct proto *P)
krt_scan_timer_stop(p);
/* FIXME we should flush routes even when persist during reconfiguration */
- if (p->initialized && !KRT_CF->persist)
+ if (p->initialized && !KRT_CF->persist && (P->down_code != PDC_CMD_GR_DOWN))
krt_flush_routes(p);
p->ready = 0;
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index c381b44f..39465aa8 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -565,14 +565,14 @@ cmd_shutdown(void)
return;
cli_msg(7, "Shutdown requested");
- order_shutdown();
+ order_shutdown(0);
}
void
async_shutdown(void)
{
DBG("Shutting down...\n");
- order_shutdown();
+ order_shutdown(0);
}
void
@@ -584,6 +584,17 @@ sysdep_shutdown_done(void)
exit(0);
}
+void
+cmd_graceful_restart(void)
+{
+ if (cli_access_restricted())
+ return;
+
+ cli_msg(25, "Graceful restart requested");
+ order_shutdown(1);
+}
+
+
/*
* Signals
*/
diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h
index d5ce8ff9..bf0aedeb 100644
--- a/sysdep/unix/unix.h
+++ b/sysdep/unix/unix.h
@@ -28,6 +28,7 @@ void cmd_reconfig_confirm(void);
void cmd_reconfig_undo(void);
void cmd_reconfig_status(void);
void cmd_shutdown(void);
+void cmd_graceful_restart(void);
#define UNIX_DEFAULT_CONFIGURE_TIMEOUT 300