forked from Mirror/frr
pimd: 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
9cbb96304c
commit
a8cdea56f4
|
@ -52,6 +52,8 @@ extern struct host host;
|
|||
|
||||
char config_default[] = SYSCONFDIR PIMD_DEFAULT_CONFIG;
|
||||
|
||||
/* pimd options */
|
||||
#define OPTION_VTYSOCK 1000
|
||||
struct option longopts[] = {
|
||||
{ "daemon", no_argument, NULL, 'd'},
|
||||
{ "config_file", required_argument, NULL, 'f'},
|
||||
|
@ -59,12 +61,16 @@ struct option longopts[] = {
|
|||
{ "socket", required_argument, NULL, 'z'},
|
||||
{ "vty_addr", required_argument, NULL, 'A'},
|
||||
{ "vty_port", required_argument, NULL, 'P'},
|
||||
{ "vty_socket", required_argument, NULL, OPTION_VTYSOCK},
|
||||
{ "version", no_argument, NULL, 'v'},
|
||||
{ "debug_zclient", no_argument, NULL, 'Z'},
|
||||
{ "help", no_argument, NULL, 'h'},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
/* VTY Socket prefix */
|
||||
char vty_sock_path[MAXPATHLEN] = PIM_VTYSH_PATH;
|
||||
|
||||
/* pimd privileges */
|
||||
zebra_capabilities_t _caps_p [] =
|
||||
{
|
||||
|
@ -104,6 +110,7 @@ Daemon which manages PIM.\n\n\
|
|||
-z, --socket Set path of zebra socket\n\
|
||||
-A, --vty_addr Set vty's bind address\n\
|
||||
-P, --vty_port Set vty's port number\n\
|
||||
--vty_socket Override vty socket path\n\
|
||||
-v, --version Print program version\n\
|
||||
"
|
||||
|
||||
|
@ -126,6 +133,7 @@ Report bugs to %s\n", progname, PIMD_BUG_ADDRESS);
|
|||
int main(int argc, char** argv, char** envp) {
|
||||
char *p;
|
||||
char *vty_addr = NULL;
|
||||
char *vty_sock_name;
|
||||
int vty_port = -1;
|
||||
int daemon_mode = 0;
|
||||
char *config_file = NULL;
|
||||
|
@ -173,6 +181,9 @@ int main(int argc, char** argv, char** envp) {
|
|||
case 'P':
|
||||
vty_port = atoi (optarg);
|
||||
break;
|
||||
case OPTION_VTYSOCK:
|
||||
set_socket_path(vty_sock_path, PIM_VTYSH_PATH, optarg, sizeof (vty_sock_path));
|
||||
break;
|
||||
case 'v':
|
||||
printf(PIMD_PROGNAME " version %s\n", PIMD_VERSION);
|
||||
print_version(progname);
|
||||
|
@ -239,7 +250,7 @@ int main(int argc, char** argv, char** envp) {
|
|||
/* Create pimd VTY socket */
|
||||
if (vty_port < 0)
|
||||
vty_port = PIMD_VTY_PORT;
|
||||
vty_serv_sock(vty_addr, vty_port, PIM_VTYSH_PATH);
|
||||
vty_serv_sock(vty_addr, vty_port, vty_sock_path);
|
||||
|
||||
zlog_notice("Quagga %s " PIMD_PROGNAME " %s starting, VTY interface at port TCP %d",
|
||||
FRR_VERSION, PIMD_VERSION, vty_port);
|
||||
|
|
Loading…
Reference in a new issue