mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +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
|
#endif
|
||||||
|
|
||||||
/* bgpd options, we use GNU getopt library. */
|
/* bgpd options, we use GNU getopt library. */
|
||||||
|
#define OPTION_VTYSOCK 1000
|
||||||
static const struct option longopts[] =
|
static const struct option longopts[] =
|
||||||
{
|
{
|
||||||
{ "daemon", no_argument, NULL, 'd'},
|
{ "daemon", no_argument, NULL, 'd'},
|
||||||
@ -69,6 +70,7 @@ static const struct option longopts[] =
|
|||||||
{ "listenon", required_argument, NULL, 'l'},
|
{ "listenon", required_argument, NULL, 'l'},
|
||||||
{ "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'},
|
||||||
{ "no_kernel", no_argument, NULL, 'n'},
|
{ "no_kernel", no_argument, NULL, 'n'},
|
||||||
{ "user", required_argument, NULL, 'u'},
|
{ "user", required_argument, NULL, 'u'},
|
||||||
@ -111,6 +113,9 @@ static struct quagga_signal_t bgp_signals[] =
|
|||||||
/* Configuration file and directory. */
|
/* Configuration file and directory. */
|
||||||
char config_default[] = SYSCONFDIR BGP_DEFAULT_CONFIG;
|
char config_default[] = SYSCONFDIR BGP_DEFAULT_CONFIG;
|
||||||
|
|
||||||
|
/* VTY Socket prefix */
|
||||||
|
char vty_sock_path[MAXPATHLEN] = BGP_VTYSH_PATH;
|
||||||
|
|
||||||
/* Route retain mode flag. */
|
/* Route retain mode flag. */
|
||||||
static int retain_mode = 0;
|
static int retain_mode = 0;
|
||||||
|
|
||||||
@ -123,6 +128,7 @@ static const char *pid_file = PATH_BGPD_PID;
|
|||||||
/* VTY port number and address. */
|
/* VTY port number and address. */
|
||||||
int vty_port = BGP_VTY_PORT;
|
int vty_port = BGP_VTY_PORT;
|
||||||
char *vty_addr = NULL;
|
char *vty_addr = NULL;
|
||||||
|
char *vty_sock_name;
|
||||||
|
|
||||||
/* privileges */
|
/* privileges */
|
||||||
static zebra_capabilities_t _caps_p [] =
|
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\
|
-l, --listenon Listen on specified address (implies -n)\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\
|
||||||
-r, --retain When program terminates, retain added route by bgpd.\n\
|
-r, --retain When program terminates, retain added route by bgpd.\n\
|
||||||
-n, --no_kernel Do not install route to kernel.\n\
|
-n, --no_kernel Do not install route to kernel.\n\
|
||||||
-u, --user User to run as\n\
|
-u, --user User to run as\n\
|
||||||
@ -195,7 +202,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, BGP_VTYSH_PATH);
|
vty_serv_sock (vty_addr, vty_port, vty_sock_path);
|
||||||
|
|
||||||
/* Try to return to normal operation. */
|
/* Try to return to normal operation. */
|
||||||
}
|
}
|
||||||
@ -469,6 +476,9 @@ main (int argc, char **argv)
|
|||||||
if (vty_port <= 0 || vty_port > 0xffff)
|
if (vty_port <= 0 || vty_port > 0xffff)
|
||||||
vty_port = BGP_VTY_PORT;
|
vty_port = BGP_VTY_PORT;
|
||||||
break;
|
break;
|
||||||
|
case OPTION_VTYSOCK:
|
||||||
|
set_socket_path(vty_sock_path, BGP_VTYSH_PATH, optarg, sizeof (vty_sock_path));
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
retain_mode = 1;
|
retain_mode = 1;
|
||||||
break;
|
break;
|
||||||
@ -544,7 +554,7 @@ main (int argc, char **argv)
|
|||||||
pid_output (pid_file);
|
pid_output (pid_file);
|
||||||
|
|
||||||
/* Make bgp vty socket. */
|
/* 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. */
|
/* Print banner. */
|
||||||
zlog_notice ("BGPd %s starting: vty@%d, bgp@%s:%d", FRR_COPYRIGHT,
|
zlog_notice ("BGPd %s starting: vty@%d, bgp@%s:%d", FRR_COPYRIGHT,
|
||||||
|
Loading…
Reference in New Issue
Block a user