From 8321e71491fd2257db39966a511b1a1afcf44722 Mon Sep 17 00:00:00 2001 From: Benjamin Cama Date: Sun, 24 Jul 2011 13:49:11 +0200 Subject: [PATCH] Add a cli_bind_address configuration option. Signed-off-by: Benjamin Cama --- cli.c | 1 + etc/startup-config.default | 3 +++ l2tpns.c | 1 + l2tpns.h | 1 + 4 files changed, 6 insertions(+) diff --git a/cli.c b/cli.c index 8377339..9433106 100644 --- a/cli.c +++ b/cli.c @@ -283,6 +283,7 @@ void init_cli(char *hostname) fcntl(clifd, F_SETFL, flags | O_NONBLOCK); } addr.sin_family = AF_INET; + addr.sin_addr.s_addr = config->cli_bind_address; /* defaults to INADDR_ANY */ addr.sin_port = htons(23); if (bind(clifd, (void *) &addr, sizeof(addr)) < 0) { diff --git a/etc/startup-config.default b/etc/startup-config.default index 77425c8..d6488dc 100644 --- a/etc/startup-config.default +++ b/etc/startup-config.default @@ -53,6 +53,9 @@ set accounting_dir "/var/run/l2tpns/acct" # Listen address for L2TP #set bind_address 1.1.1.1 +# Listen address for CLI +#set cli_bind_address 1.1.1.1 + # Send a gratiuitous ARP for bind address #set send_garp no diff --git a/l2tpns.c b/l2tpns.c index 9947bd5..f966a78 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -157,6 +157,7 @@ config_descriptt config_values[] = { CONFIG("cluster_hb_timeout", cluster_hb_timeout, INT), CONFIG("cluster_master_min_adv", cluster_master_min_adv, INT), CONFIG("ipv6_prefix", ipv6_prefix, IPv6), + CONFIG("cli_bind_address", cli_bind_address, IPv4), { NULL, 0, 0, 0 }, }; diff --git a/l2tpns.h b/l2tpns.h index 032c237..76e9aa2 100644 --- a/l2tpns.h +++ b/l2tpns.h @@ -712,6 +712,7 @@ typedef struct int cluster_master_min_adv; // Master advertises routes while the number of up to date // slaves is less than this value. + in_addr_t cli_bind_address; // bind address for CLI // Guest change char guest_user[MAXUSER]; // Guest account username -- 2.20.1