summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mausezahn.83
-rw-r--r--mausezahn.zsh1
-rw-r--r--staging/cli.c2
-rw-r--r--staging/cli.h1
-rw-r--r--staging/mausezahn.c9
5 files changed, 13 insertions, 3 deletions
diff --git a/mausezahn.8 b/mausezahn.8
index 87959c6..1037737 100644
--- a/mausezahn.8
+++ b/mausezahn.8
@@ -73,6 +73,9 @@ Start mausezahn in interactive mode with a Cisco-like CLI. Use telnet to log
into the local mausezahn instance. If no port has been specified, port 25542
is used by default.
.PP
+.SS -l <IP>
+Specify the IP address mausezahn should bind to when in interactive mode, default: 0.0.0.0.
+.PP
.SS -v
Verbose mode. Capital \-V is even more verbose.
.PP
diff --git a/mausezahn.zsh b/mausezahn.zsh
index b6934db..57a56a1 100644
--- a/mausezahn.zsh
+++ b/mausezahn.zsh
@@ -42,6 +42,7 @@ _interfaces () {
_arguments -s -S \
"-x[Interactive mode with telnet CLI, default port: 25542]" \
+ "-l[Listen address in interactive mode, default: 0.0.0.0]" \
"(-6)-4[IPv4 mode (default)]" \
"(-4)-6[IPv6 mode]" \
"-c[Send packet count times, default:1, infinite:0]" \
diff --git a/staging/cli.c b/staging/cli.c
index ad040a1..7d8e2ce 100644
--- a/staging/cli.c
+++ b/staging/cli.c
@@ -532,7 +532,7 @@ int cli()
// Listen on port mz_port (default: 25542, towel day)
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
- servaddr.sin_addr.s_addr = htonl(INADDR_ANY); // TODO: specified interface
+ inet_aton(mz_listen_addr, &servaddr.sin_addr);
servaddr.sin_port = htons(mz_port);
bind(s, (struct sockaddr *)&servaddr, sizeof(servaddr));
diff --git a/staging/cli.h b/staging/cli.h
index 5762de4..dd8e5e1 100644
--- a/staging/cli.h
+++ b/staging/cli.h
@@ -59,6 +59,7 @@ struct cli_def *gcli;
char mz_username[32];
char mz_password[32];
char mz_enable[32];
+char mz_listen_addr[15];
int mz_port;
struct mops *clipkt; // actual packet used by CLI thread
diff --git a/staging/mausezahn.c b/staging/mausezahn.c
index 759ac28..8b2c499 100644
--- a/staging/mausezahn.c
+++ b/staging/mausezahn.c
@@ -33,7 +33,7 @@
int verbose_level = 0;
-static const char *short_options = "46hqvVSxra:A:b:B:c:d:E:f:F:p:P:t:T:M:Q:X:";
+static const char *short_options = "46hqvVSxra:A:b:B:c:d:E:f:F:l:p:P:t:T:M:Q:X:";
static void signal_handler(int number)
{
@@ -109,6 +109,7 @@ static void help(void)
"Usage: mausezahn [options] [interface] <keyword>|<arg-string>|<hex-string>\n"
"Options:\n"
" -x <port> Interactive mode with telnet CLI, default port: 25542\n"
+ " -l <ip> Listen address to bind to when in interactive mode, default: 0.0.0.0\n"
" -4 IPv4 mode (default)\n"
" -6 IPv6 mode\n"
" -c <count> Send packet count times, default:1, infinite:0\n"
@@ -208,8 +209,9 @@ int reset()
fp2 = NULL;
mz_port = 0;
mz_rand = 0;
+ char mz_listen_addr[15] = "0.0.0.0";
mp_head = NULL;
-
+
for (i=0;i<TIME_COUNT_MAX;i++) jitter[i] = 0;
time0_flag = 0; // If set then time0 has valid data
@@ -395,6 +397,9 @@ int getopts (int argc, char *argv[])
case 'x':
mz_port = MZ_DEFAULT_PORT;
break;
+ case 'l':
+ strncpy (mz_listen_addr, optarg, sizeof(mz_listen_addr));
+ break;
case 'a':
strncpy (tx.eth_src_txt, optarg, 32);
tx.packet_mode = 0;