Fix vty address handling and added pid file stuff.

This commit is contained in:
hasso 2004-02-20 18:44:21 +00:00
parent eb26037b73
commit c3aac6ff4f

View File

@ -78,6 +78,8 @@ struct option longopts[] =
{ {
{ "daemon", no_argument, NULL, 'd'}, { "daemon", no_argument, NULL, 'd'},
{ "config_file", required_argument, NULL, 'f'}, { "config_file", required_argument, NULL, 'f'},
{ "pid_file", required_argument, NULL, 'i'},
{ "vty_addr", required_argument, NULL, 'A'},
{ "vty_port", required_argument, NULL, 'P'}, { "vty_port", required_argument, NULL, 'P'},
{ "user", required_argument, NULL, 'u'}, { "user", required_argument, NULL, 'u'},
{ "version", no_argument, NULL, 'v'}, { "version", no_argument, NULL, 'v'},
@ -98,6 +100,8 @@ int daemon_mode = 0;
/* Master of threads. */ /* Master of threads. */
struct thread_master *master; struct thread_master *master;
/* Process ID saved for use by init system */
char *pid_file = PATH_ISISD_PID;
/* for reload */ /* for reload */
char _cwd[64]; char _cwd[64];
@ -119,6 +123,8 @@ usage (int status)
Daemon which manages IS-IS routing\n\n\ Daemon which manages IS-IS routing\n\n\
-d, --daemon Runs in daemon mode\n\ -d, --daemon Runs in daemon mode\n\
-f, --config_file Set configuration file name\n\ -f, --config_file Set configuration file name\n\
-i, --pid_file Set process identifier file name\n\
-A, --vty_addr Set vty's bind address\n\
-P, --vty_port Set vty's port number\n\ -P, --vty_port Set vty's port number\n\
-u, --user User and group to run as\n\ -u, --user User and group to run as\n\
-v, --version Print program version\n\ -v, --version Print program version\n\
@ -234,7 +240,7 @@ main (int argc, char **argv, char **envp)
/* Command line argument treatment. */ /* Command line argument treatment. */
while (1) while (1)
{ {
opt = getopt_long (argc, argv, "df:hAp:P:u:v", longopts, 0); opt = getopt_long (argc, argv, "df:i:hA:p:P:u:v", longopts, 0);
if (opt == EOF) if (opt == EOF)
break; break;
@ -249,6 +255,9 @@ main (int argc, char **argv, char **envp)
case 'f': case 'f':
config_file = optarg; config_file = optarg;
break; break;
case 'i':
pid_file = optarg;
break;
case 'A': case 'A':
vty_addr = optarg; vty_addr = optarg;
break; break;
@ -313,7 +322,7 @@ main (int argc, char **argv, char **envp)
daemon (0, 0); daemon (0, 0);
/* Process ID file creation. */ /* Process ID file creation. */
pid_output (PATH_ISISD_PID); pid_output (pid_file);
/* Make isis vty socket. */ /* Make isis vty socket. */
vty_serv_sock (vty_addr, vty_port, ISIS_VTYSH_PATH); vty_serv_sock (vty_addr, vty_port, ISIS_VTYSH_PATH);