diff options
author | Maria Matejka <mq@ucw.cz> | 2019-07-03 11:09:52 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2019-07-03 11:12:25 +0200 |
commit | eac9250fd5b10809830361b94438339b3b31b270 (patch) | |
tree | 5c9ec2591f0baa462f5572f83e4c452c3a166c95 /sysdep | |
parent | 8816b6cdd98d24535eece6b5e35730aac57cd9f7 (diff) | |
parent | 026bfedb332d8c0dde28c693c177fe993b5df26d (diff) |
Merge branch 'master' into mq-filter-stack
Diffstat (limited to 'sysdep')
-rw-r--r-- | sysdep/unix/config.Y | 9 | ||||
-rw-r--r-- | sysdep/unix/io.c | 1 | ||||
-rw-r--r-- | sysdep/unix/krt.c | 2 | ||||
-rw-r--r-- | sysdep/unix/main.c | 37 | ||||
-rw-r--r-- | sysdep/unix/unix.h | 2 |
5 files changed, 47 insertions, 4 deletions
diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y index e7ecd735..b78e0e6c 100644 --- a/sysdep/unix/config.Y +++ b/sysdep/unix/config.Y @@ -18,7 +18,7 @@ static struct log_config *this_log; CF_DECLS CF_KEYWORDS(LOG, SYSLOG, ALL, DEBUG, TRACE, INFO, REMOTE, WARNING, ERROR, AUTH, FATAL, BUG, STDERR, SOFT) -CF_KEYWORDS(NAME, CONFIRM, UNDO, CHECK, TIMEOUT, DEBUG, LATENCY, LIMIT, WATCHDOG, WARNING) +CF_KEYWORDS(NAME, CONFIRM, UNDO, CHECK, TIMEOUT, DEBUG, LATENCY, LIMIT, WATCHDOG, WARNING, STATUS) %type <i> log_mask log_mask_list log_cat cfg_timeout %type <t> cfg_name @@ -124,12 +124,19 @@ CF_CLI(CONFIGURE CONFIRM,,, [[Confirm last configuration change - deactivate und CF_CLI(CONFIGURE UNDO,,, [[Undo last configuration change]]) { cmd_reconfig_undo(); } ; +CF_CLI(CONFIGURE STATUS,,, [[Show configuration status]]) +{ cmd_reconfig_status(); } ; + CF_CLI(CONFIGURE CHECK, cfg_name, [\"<file>\"], [[Parse configuration and check its validity]]) { cmd_check_config($3); } ; 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/io.c b/sysdep/unix/io.c index 5b0e49c1..c9fee3ab 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -1082,6 +1082,7 @@ sk_passive_connected(sock *s, int type) t->fd = fd; t->ttl = s->ttl; t->tos = s->tos; + t->vrf = s->vrf; t->rbsize = s->rbsize; t->tbsize = s->tbsize; diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 2cec2cae..27868fab 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 b0d764fa..05becbe7 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -338,6 +338,28 @@ cmd_reconfig_undo(void) cmd_reconfig_msg(r); } +void +cmd_reconfig_status(void) +{ + int s = config_status(); + btime t = config_timer_status(); + + switch (s) + { + case CONF_DONE: cli_msg(-3, "Daemon is up and running"); break; + case CONF_PROGRESS: cli_msg(-4, "Reconfiguration in progress"); break; + case CONF_QUEUED: cli_msg(-5, "Reconfiguration in progress, next one enqueued"); break; + case CONF_SHUTDOWN: cli_msg(-6, "Shutdown in progress"); break; + default: break; + } + + if (t >= 0) + cli_msg(-22, "Configuration unconfirmed, undo in %t s", t); + + cli_msg(0, ""); +} + + /* * Command-Line Interface */ @@ -542,14 +564,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 @@ -561,6 +583,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 0e1e98c0..bf0aedeb 100644 --- a/sysdep/unix/unix.h +++ b/sysdep/unix/unix.h @@ -26,7 +26,9 @@ void cmd_check_config(char *name); void cmd_reconfig(char *name, int type, uint timeout); 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 |