From 868aa6ee376a05064862b94b8782c6bed6ada2ca Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Sun, 26 Jul 2009 17:28:22 +0000 Subject: [PATCH] Added the --source-ip argument to build SPA packets with 0.0.0.0 (the fwknopd server can wrap access controls around this) git-svn-id: file:///home/mbr/svn/fwknop/trunk@119 510a4753-2344-4c79-9c09-4d669213fbeb --- ChangeLog | 3 +++ src/config_init.c | 9 ++++++++- src/config_init.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1b3167d9..c4c738a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ 2009-07-26 Michael Rash + * Implemented -s command line argument on the fwknop client command line + so that the IP "0.0.0.0" can be sent within an SPA packet. The fwknopd + server can wrap access requirements around this IP. * Initial public release of fwknop-c-0.62. 2009-07-23 Michael Rash diff --git a/src/config_init.c b/src/config_init.c index bb847e03..92a2167c 100644 --- a/src/config_init.c +++ b/src/config_init.c @@ -250,7 +250,7 @@ config_init(fko_cli_options_t *options, int argc, char **argv) options->fw_timeout = -1; while ((cmd_arg = getopt_long(argc, argv, - "a:A:bB:C:D:f:gG:hIm:nN:p:P:qQ:rS:TU:vV", cmd_opts, &index)) != -1) { + "a:A:bB:C:D:f:gG:hIm:nN:p:P:qQ:rsS:TU:vV", cmd_opts, &index)) != -1) { switch(cmd_arg) { case 'a': @@ -343,6 +343,9 @@ config_init(fko_cli_options_t *options, int argc, char **argv) case SHOW_LAST_ARGS: options->show_last_command = 1; break; + case 's': + strlcpy(options->allow_ip_str, "0.0.0.0", MAX_IP_STR_LEN); + break; case 'S': options->spa_src_port = atoi(optarg); if (options->spa_src_port < 0 || options->spa_src_port > 65535) { @@ -445,6 +448,10 @@ usage(void) " and 'icmp' modes use raw sockets and thus\n" " require root access to run.\n" " -S, --source-port - Set the source port for outgoing SPA packet.\n" + " -s, --source-ip - Tell the fwknopd server to accept whatever\n" + " source IP the SPA packet has as the IP that\n" + " needs access (not recommended, and the\n" + " fwknopd server can ignore such requests).\n" " -Q, --spoof-source - Set the source IP for outgoing SPA packet.\n" " -U, --spoof-user - Set the username within outgoing SPA packet.\n" " -q, --quiet - Perform fwknop functions quietly.\n" diff --git a/src/config_init.h b/src/config_init.h index 7676ac8c..982fdc06 100644 --- a/src/config_init.h +++ b/src/config_init.h @@ -80,6 +80,7 @@ static struct option cmd_opts[] = {"rand-port", 0, NULL, 'r'}, {"spoof-src", 1, NULL, 'Q'}, {"show-last", 0, NULL, SHOW_LAST_ARGS}, + {"source-ip", 0, NULL, 's'}, {"source-port", 1, NULL, 'S'}, {"test", 0, NULL, 'T'}, {"time-offset-plus", 1, NULL, TIME_OFFSET_PLUS},