-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New command line argument: --version
- Loading branch information
1 parent
21b4498
commit 3cc047f
Showing
3 changed files
with
41 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/** | ||
* @file udp-redirect.c | ||
* @author Dan Podeanu <[email protected]> | ||
* @version 1.0 | ||
* @version 1.0.0 | ||
* | ||
* @section LICENSE | ||
* | ||
|
@@ -31,6 +31,11 @@ | |
#include <netdb.h> | ||
#include <time.h> | ||
|
||
/** | ||
* The udp-redirect version | ||
*/ | ||
#define UDP_REDIRECT_VERSION "1.0.0" | ||
|
||
/** | ||
* The delay in seconds between displaying statistics | ||
*/ | ||
|
@@ -120,6 +125,8 @@ static struct option longopts[] = { | |
|
||
{ "stats", no_argument, NULL, 'q' }, ///< Display stats every 60 seconds | ||
|
||
{ "version", no_argument, NULL, 'z' }, ///< Display the version | ||
|
||
{ NULL, 0, NULL, 0 } | ||
}; | ||
|
||
|
@@ -342,6 +349,11 @@ int main(int argc, char *argv[]) { | |
case 'q': /* --stats */ | ||
s.stats = 1; | ||
|
||
break; | ||
case 'z': /* --version */ | ||
fprintf(stderr, "udp-redirect v%s\n", UDP_REDIRECT_VERSION); | ||
exit(EXIT_SUCCESS); | ||
|
||
break; | ||
default: | ||
usage(argv0, NULL); | ||
|
@@ -825,36 +837,38 @@ void usage(const char *argv0, const char *message) { | |
|
||
fprintf(stderr, "Usage: %s\n", argv0); | ||
fprintf(stderr, " [--listen-address <address>] --listen-port <port> [--listen-interface <interface>]\n"); | ||
fprintf(stderr, " --connect-address <address> | --connect-host <hostname> --connect-port <port>\n"); | ||
fprintf(stderr, " [--connect-address <address> | --connect-host <hostname> --connect-port <port>\n"); | ||
fprintf(stderr, " [--send-address <address>] [--send-port <port>] [--send-interface <interface>]\n"); | ||
fprintf(stderr, " [--list-address-strict] [--connect-address-strict]\n"); | ||
fprintf(stderr, " [--lsten-sender-addr <address>] [--listen-sender-port <port>]\n"); | ||
fprintf(stderr, " [--ignore-errors] [--stop-errors]\n"); | ||
fprintf(stderr, " [--stats] [--verbose] [--debug]\n"); | ||
fprintf(stderr, " [--stats] [--verbose] [--debug] [--version]\n"); | ||
fprintf(stderr, "\n"); | ||
fprintf(stderr, "--verbose Verbose mode, can be specified multiple times (optional)\n"); | ||
fprintf(stderr, "--debug Debug mode (optional)\n"); | ||
fprintf(stderr, "--stats Display sent/received bytes statistics every 60 seconds (optional)\n"); | ||
fprintf(stderr, "--verbose Verbose mode, can be specified multiple times (optional)\n"); | ||
fprintf(stderr, "--debug Debug mode (optional)\n"); | ||
fprintf(stderr, "--version Display the version and exit\n"); | ||
fprintf(stderr, "\n"); | ||
fprintf(stderr, "--listen-address <address> Listen address (optional)\n"); | ||
fprintf(stderr, "--listen-port <port> Listen port (required)\n"); | ||
fprintf(stderr, "--listen-interface <interface> Listen interface name (optional)\n"); | ||
fprintf(stderr, "--listen-address-strict Only receive packets from the same source as the first packet (optional)\n"); | ||
fprintf(stderr, "--listen-address <ipv4 address> Listen address (optional)\n"); | ||
fprintf(stderr, "--listen-port <port> Listen port (required)\n"); | ||
fprintf(stderr, "--listen-interface <interface> Listen interface name (optional)\n"); | ||
fprintf(stderr, "--listen-address-strict Only receive packets from the same source as the first packet (optional)\n"); | ||
fprintf(stderr, "\n"); | ||
fprintf(stderr, "--connect-address <address> Connect address (required)\n"); | ||
fprintf(stderr, "--connect-host <hostname> Connect host, overwrites caddr if both are specified (required)\n"); | ||
fprintf(stderr, "--connect-port <port> Connect port (required)\n"); | ||
fprintf(stderr, "--connect-address-strict Only receive packets from the connect caddr / cport (optional)\n"); | ||
fprintf(stderr, "--connect-address <ipv4 address> Connect address (required)\n"); | ||
fprintf(stderr, "--connect-host <hostname> Connect host, overwrites --connect-address if both are specified (required)\n"); | ||
fprintf(stderr, "--connect-port <port> Connect port (required)\n"); | ||
fprintf(stderr, "--connect-address-strict Only receive packets from --connect-address / --connect-port (optional)\n"); | ||
fprintf(stderr, "\n"); | ||
fprintf(stderr, "--send-address <address> Send packets from address (optional)\n"); | ||
fprintf(stderr, "--send-port <port> Send packets from port (optional)\n"); | ||
fprintf(stderr, "--send-interface <interface> Send packets from interface (optional)\n"); | ||
fprintf(stderr, "--send-address <ipv4 address> Send packets from address (optional)\n"); | ||
fprintf(stderr, "--send-port <port> Send packets from port (optional)\n"); | ||
fprintf(stderr, "--send-interface <interface> Send packets from interface (optional)\n"); | ||
fprintf(stderr, "\n"); | ||
fprintf(stderr, "--listen-sender-address <address> Listen endpoint only accepts packets from this source address (optional)\n"); | ||
fprintf(stderr, "--listen-sender-port <port> Listen endpoint only accepts packets from this source port (optional)\n"); | ||
fprintf(stderr, " (must be set together, --listen-address-strict is implied)\n"); | ||
fprintf(stderr, "--listen-sender-address <ipv4 address> Listen endpoint only accepts packets from this source address (optional)\n"); | ||
fprintf(stderr, "--listen-sender-port <port> Listen endpoint only accepts packets from this source port (optional)\n"); | ||
fprintf(stderr, " (must be set together, --listen-address-strict is implied)\n"); | ||
fprintf(stderr, "\n"); | ||
fprintf(stderr, "--ignore-errors Ignore most receive or send errors (unreachable, etc.) instead of exiting (optional) (default)\n"); | ||
fprintf(stderr, "--stop-errors Exit on most receive or send errors (unreachable, etc.) (optional)\n"); | ||
fprintf(stderr, "--ignore-errors Ignore most receive or send errors (unreachable, etc.) instead of exiting (optional) (default)\n"); | ||
fprintf(stderr, "--stop-errors Exit on most receive or send errors (unreachable, etc.) (optional)\n"); | ||
fprintf(stderr, "\n"); | ||
|
||
exit(EXIT_FAILURE); | ||
|