summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c67acf4)
raw | patch | inline | side by side (parent: c67acf4)
author | Daniel Collins <daniel.collins@smoothwall.net> | |
Thu, 9 Jan 2014 11:38:54 +0000 (11:38 +0000) | ||
committer | Florian Forster <ff@octo.it> | |
Fri, 13 Feb 2015 11:54:19 +0000 (12:54 +0100) |
This exposes the new "MARK" functionatlity to command line users.
src/oping.c | patch | blob | history |
diff --git a/src/oping.c b/src/oping.c
index 28f761cfffaad55418d7103eb7f9e69de835971d..5442d6039c29dc11557ed5b8b2a4c65cc6823bbb 100644 (file)
--- a/src/oping.c
+++ b/src/oping.c
static int opt_addrfamily = PING_DEF_AF;
static char *opt_srcaddr = NULL;
static char *opt_device = NULL;
+static char *opt_mark = NULL;
static char *opt_filename = NULL;
static int opt_count = -1;
static int opt_send_ttl = 64;
" Use \"-Q help\" for a list of valid options.\n"
" -I srcaddr source address\n"
" -D device outgoing interface name\n"
+ " -m mark mark to set on outgoing packets\n"
" -f filename filename to read hosts from\n"
#if USE_NCURSES
" -u / -U force / disable UTF-8 output\n"
while (1)
{
- optchar = getopt (argc, argv, "46c:hi:I:t:Q:f:D:Z:P:"
+ optchar = getopt (argc, argv, "46c:hi:I:t:Q:f:D:Z:P:m:"
#if USE_NCURSES
"uUg:"
#endif
opt_device = optarg;
break;
+ case 'm':
+ opt_mark = optarg;
+ break;
+
case 't':
{
int new_send_ttl;
}
}
+ if(opt_mark != NULL)
+ {
+ char *endp;
+ int mark = strtoul(opt_mark, &endp, 0);
+ if(opt_mark[0] != '\0' && *endp == '\0')
+ {
+ if(ping_setopt(ping, PING_OPT_MARK, (void*)(&mark)) != 0)
+ {
+ fprintf (stderr, "Setting mark failed: %s\n",
+ ping_get_error (ping));
+ }
+ }
+ else{
+ fprintf(stderr, "Ignoring invalid mark: %s\n", optarg);
+ }
+ }
+
if (opt_filename != NULL)
{
FILE *infile;