mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-12-08 09:48:50 +00:00
ripd: Add vty_socket cli option to override the compiled-in location for the VTY Socket
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
This commit is contained in:
parent
66f7d8303c
commit
a5c83e7aca
@ -39,6 +39,7 @@
|
|||||||
#include "ripd/ripd.h"
|
#include "ripd/ripd.h"
|
||||||
|
|
||||||
/* ripd options. */
|
/* ripd options. */
|
||||||
|
#define OPTION_VTYSOCK 1000
|
||||||
static struct option longopts[] =
|
static struct option longopts[] =
|
||||||
{
|
{
|
||||||
{ "daemon", no_argument, NULL, 'd'},
|
{ "daemon", no_argument, NULL, 'd'},
|
||||||
@ -49,6 +50,7 @@ static struct option longopts[] =
|
|||||||
{ "dryrun", no_argument, NULL, 'C'},
|
{ "dryrun", no_argument, NULL, 'C'},
|
||||||
{ "vty_addr", required_argument, NULL, 'A'},
|
{ "vty_addr", required_argument, NULL, 'A'},
|
||||||
{ "vty_port", required_argument, NULL, 'P'},
|
{ "vty_port", required_argument, NULL, 'P'},
|
||||||
|
{ "vty_socket", required_argument, NULL, OPTION_VTYSOCK},
|
||||||
{ "retain", no_argument, NULL, 'r'},
|
{ "retain", no_argument, NULL, 'r'},
|
||||||
{ "user", required_argument, NULL, 'u'},
|
{ "user", required_argument, NULL, 'u'},
|
||||||
{ "group", required_argument, NULL, 'g'},
|
{ "group", required_argument, NULL, 'g'},
|
||||||
@ -85,6 +87,9 @@ char *config_file = NULL;
|
|||||||
|
|
||||||
/* ripd program name */
|
/* ripd program name */
|
||||||
|
|
||||||
|
/* VTY Socket prefix */
|
||||||
|
char vty_sock_path[MAXPATHLEN] = RIP_VTYSH_PATH;
|
||||||
|
|
||||||
/* Route retain mode flag. */
|
/* Route retain mode flag. */
|
||||||
int retain_mode = 0;
|
int retain_mode = 0;
|
||||||
|
|
||||||
@ -116,6 +121,7 @@ Daemon which manages RIP version 1 and 2.\n\n\
|
|||||||
-z, --socket Set path of zebra socket\n\
|
-z, --socket Set path of zebra socket\n\
|
||||||
-A, --vty_addr Set vty's bind address\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\
|
||||||
|
--vty_socket Override vty socket path\n\
|
||||||
-C, --dryrun Check configuration for validity and exit\n\
|
-C, --dryrun Check configuration for validity and exit\n\
|
||||||
-r, --retain When program terminates, retain added route by ripd.\n\
|
-r, --retain When program terminates, retain added route by ripd.\n\
|
||||||
-u, --user User to run as\n\
|
-u, --user User to run as\n\
|
||||||
@ -142,7 +148,7 @@ sighup (void)
|
|||||||
vty_read_config (config_file, config_default);
|
vty_read_config (config_file, config_default);
|
||||||
|
|
||||||
/* Create VTY's socket */
|
/* Create VTY's socket */
|
||||||
vty_serv_sock (vty_addr, vty_port, RIP_VTYSH_PATH);
|
vty_serv_sock (vty_addr, vty_port, vty_sock_path);
|
||||||
|
|
||||||
/* Try to return to normal operation. */
|
/* Try to return to normal operation. */
|
||||||
}
|
}
|
||||||
@ -195,6 +201,7 @@ main (int argc, char **argv)
|
|||||||
int dryrun = 0;
|
int dryrun = 0;
|
||||||
char *progname;
|
char *progname;
|
||||||
struct thread thread;
|
struct thread thread;
|
||||||
|
char *vty_sock_name;
|
||||||
|
|
||||||
/* Set umask before anything for security */
|
/* Set umask before anything for security */
|
||||||
umask (0027);
|
umask (0027);
|
||||||
@ -251,6 +258,9 @@ main (int argc, char **argv)
|
|||||||
if (vty_port <= 0 || vty_port > 0xffff)
|
if (vty_port <= 0 || vty_port > 0xffff)
|
||||||
vty_port = RIP_VTY_PORT;
|
vty_port = RIP_VTY_PORT;
|
||||||
break;
|
break;
|
||||||
|
case OPTION_VTYSOCK:
|
||||||
|
set_socket_path(vty_sock_path, RIP_VTYSH_PATH, optarg, sizeof (vty_sock_path));
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
retain_mode = 1;
|
retain_mode = 1;
|
||||||
break;
|
break;
|
||||||
@ -311,7 +321,7 @@ main (int argc, char **argv)
|
|||||||
pid_output (pid_file);
|
pid_output (pid_file);
|
||||||
|
|
||||||
/* Create VTY's socket */
|
/* Create VTY's socket */
|
||||||
vty_serv_sock (vty_addr, vty_port, RIP_VTYSH_PATH);
|
vty_serv_sock (vty_addr, vty_port, vty_sock_path);
|
||||||
|
|
||||||
/* Print banner. */
|
/* Print banner. */
|
||||||
zlog_notice ("RIPd %s starting: vty@%d", FRR_VERSION, vty_port);
|
zlog_notice ("RIPd %s starting: vty@%d", FRR_VERSION, vty_port);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user