diff options
Diffstat (limited to 'sysdep')
-rw-r--r-- | sysdep/unix/config.Y | 4 | ||||
-rw-r--r-- | sysdep/unix/krt.c | 2 | ||||
-rw-r--r-- | sysdep/unix/main.c | 15 | ||||
-rw-r--r-- | sysdep/unix/unix.h | 1 |
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 |