mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 22:37:49 +00:00
bgpd: 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
48f8480d4c
commit
98bd8260b6
@ -59,6 +59,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
#endif
|
||||
|
||||
/* bgpd options, we use GNU getopt library. */
|
||||
#define OPTION_VTYSOCK 1000
|
||||
static const struct option longopts[] =
|
||||
{
|
||||
{ "daemon", no_argument, NULL, 'd'},
|
||||
@ -69,6 +70,7 @@ static const struct option longopts[] =
|
||||
{ "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'},
|
||||
@ -111,6 +113,9 @@ static struct quagga_signal_t bgp_signals[] =
|
||||
/* 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;
|
||||
|
||||
@ -123,6 +128,7 @@ static const char *pid_file = PATH_BGPD_PID;
|
||||
/* 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 [] =
|
||||
@ -165,6 +171,7 @@ redistribution between different routing protocols.\n\n\
|
||||
-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\
|
||||
@ -195,7 +202,7 @@ sighup (void)
|
||||
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. */
|
||||
}
|
||||
@ -469,6 +476,9 @@ main (int argc, char **argv)
|
||||
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;
|
||||
@ -544,7 +554,7 @@ main (int argc, char **argv)
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user