Add a cli_bind_address configuration option.
authorBenjamin Cama <benoar@dolka.fr>
Sun, 24 Jul 2011 11:49:11 +0000 (13:49 +0200)
committerBenjamin Cama <benoar@dolka.fr>
Fri, 29 Jul 2011 10:54:25 +0000 (12:54 +0200)
Signed-off-by: Benjamin Cama <benoar@dolka.fr>
cli.c
etc/startup-config.default
l2tpns.c
l2tpns.h

diff --git a/cli.c b/cli.c
index 8377339..9433106 100644 (file)
--- 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)
        {
index 77425c8..d6488dc 100644 (file)
@@ -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
 
index 9947bd5..f966a78 100644 (file)
--- 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 },
 };
 
index 032c237..76e9aa2 100644 (file)
--- 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