add "shutdown" and "reload" CLI commands (Daryl Tester)
This commit is contained in:
parent
32ab43cf29
commit
5c8a7b96ca
2 changed files with 33 additions and 9 deletions
1
Changes
1
Changes
|
|
@ -15,6 +15,7 @@
|
|||
- Security [CVE-2006-5873]: Rhys Kidd identified a vulnerability in the
|
||||
handling of heartbeat packets. Drop oversize heartbeat packets.
|
||||
- Don't send interim records before session start (Daryl Tester).
|
||||
- Add "shutdown" and "reload" CLI commands (Daryl Tester).
|
||||
|
||||
* Tue Apr 18 2006 Brendan O'Dea <bod@optus.net> 2.1.18
|
||||
- Don't shutdown on TerminateReq, wait for CDN.
|
||||
|
|
|
|||
25
cli.c
25
cli.c
|
|
@ -2,7 +2,7 @@
|
|||
// vim: sw=8 ts=8
|
||||
|
||||
char const *cvs_name = "$Name: $";
|
||||
char const *cvs_id_cli = "$Id: cli.c,v 1.75 2006/08/02 13:35:39 bodea Exp $";
|
||||
char const *cvs_id_cli = "$Id: cli.c,v 1.76 2006/12/18 12:08:28 bodea Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
|
@ -100,6 +100,9 @@ static int cmd_set(struct cli_def *cli, char *command, char **argv, int argc);
|
|||
static int cmd_load_plugin(struct cli_def *cli, char *command, char **argv, int argc);
|
||||
static int cmd_remove_plugin(struct cli_def *cli, char *command, char **argv, int argc);
|
||||
static int cmd_uptime(struct cli_def *cli, char *command, char **argv, int argc);
|
||||
static int cmd_shutdown(struct cli_def *cli, char *command, char **argv, int argc);
|
||||
static int cmd_reload(struct cli_def *cli, char *command, char **argv, int argc);
|
||||
|
||||
|
||||
static int regular_stuff(struct cli_def *cli);
|
||||
|
||||
|
|
@ -176,6 +179,8 @@ void init_cli(char *hostname)
|
|||
#endif
|
||||
|
||||
cli_register_command(cli, NULL, "uptime", cmd_uptime, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, "Show uptime and bandwidth utilisation");
|
||||
cli_register_command(cli, NULL, "shutdown", cmd_shutdown, PRIVILEGE_PRIVILEGED, MODE_EXEC, "Shutdown l2tpns daemon and exit");
|
||||
cli_register_command(cli, NULL, "reload", cmd_reload, PRIVILEGE_PRIVILEGED, MODE_EXEC, "Reload configuration");
|
||||
|
||||
c = cli_register_command(cli, NULL, "write", NULL, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, NULL);
|
||||
cli_register_command(cli, c, "memory", cmd_write_memory, PRIVILEGE_PRIVILEGED, MODE_EXEC, "Save the running config to flash");
|
||||
|
|
@ -3077,3 +3082,21 @@ static int cmd_show_access_list(struct cli_def *cli, char *command, char **argv,
|
|||
|
||||
return CLI_OK;
|
||||
}
|
||||
|
||||
static int cmd_shutdown(struct cli_def *cli, char *command, char **argv, int argc)
|
||||
{
|
||||
if (CLI_HELP_REQUESTED)
|
||||
return CLI_HELP_NO_ARGS;
|
||||
|
||||
kill(getppid(), SIGQUIT);
|
||||
return CLI_OK;
|
||||
}
|
||||
|
||||
static int cmd_reload(struct cli_def *cli, char *command, char **argv, int argc)
|
||||
{
|
||||
if (CLI_HELP_REQUESTED)
|
||||
return CLI_HELP_NO_ARGS;
|
||||
|
||||
kill(getppid(), SIGHUP);
|
||||
return CLI_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue