#endif
/* bgpd options, we use GNU getopt library. */
+#define OPTION_VTYSOCK 1000
static const struct option longopts[] =
{
{ "daemon", no_argument, NULL, 'd'},
{ "listenon", required_argument, NULL, 'l'},
{ "vty_addr", required_argument, NULL, 'A'},
{ "vty_port", required_argument, NULL, 'P'},
+ { "vty_socket", required_argument, NULL, OPTION_VTYSOCK },
{ "retain", no_argument, NULL, 'r'},
{ "no_kernel", no_argument, NULL, 'n'},
{ "user", required_argument, NULL, 'u'},
/* Configuration file and directory. */
char config_default[] = SYSCONFDIR BGP_DEFAULT_CONFIG;
+/* VTY Socket prefix */
+char vty_sock_path[MAXPATHLEN] = BGP_VTYSH_PATH;
+
/* Route retain mode flag. */
static int retain_mode = 0;
/* VTY port number and address. */
int vty_port = BGP_VTY_PORT;
char *vty_addr = NULL;
+char *vty_sock_name;
/* privileges */
static zebra_capabilities_t _caps_p [] =
-l, --listenon Listen on specified address (implies -n)\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\
-r, --retain When program terminates, retain added route by bgpd.\n\
-n, --no_kernel Do not install route to kernel.\n\
-u, --user User to run as\n\
vty_read_config (config_file, config_default);
/* Create VTY's socket */
- vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH);
+ vty_serv_sock (vty_addr, vty_port, vty_sock_path);
/* Try to return to normal operation. */
}
if (vty_port <= 0 || vty_port > 0xffff)
vty_port = BGP_VTY_PORT;
break;
+ case OPTION_VTYSOCK:
+ set_socket_path(vty_sock_path, BGP_VTYSH_PATH, optarg, sizeof (vty_sock_path));
+ break;
case 'r':
retain_mode = 1;
break;
pid_output (pid_file);
/* Make bgp vty socket. */
- vty_serv_sock (vty_addr, vty_port, BGP_VTYSH_PATH);
+ vty_serv_sock (vty_addr, vty_port, vty_sock_path);
/* Print banner. */
zlog_notice ("BGPd %s starting: vty@%d, bgp@%s:%d", FRR_COPYRIGHT,