@@ -42,6 +42,7 @@ __u16 base_port;
const int overhead = 28;
int mtu = 65535;
+int mark = 0;
int hops_to = -1;
int hops_from = -1;
int no_resolve = 0;
@@ -285,7 +286,7 @@ static void usage(void) __attribute((noreturn));
static void usage(void)
{
- fprintf(stderr, "Usage: tracepath [-n] [-b] [-l <len>]
<destination>[/<port>]\n");
+ fprintf(stderr, "Usage: tracepath [-n] [-b] [-l <len>] [-m <mark>]
<destination>[/<port>]\n");
exit(-1);
}
@@ -299,7 +300,7 @@ main(int argc, char **argv)
char *p;
int ch;
- while ((ch = getopt(argc, argv, "nbh?l:")) != EOF) {
+ while ((ch = getopt(argc, argv, "nbh?l:m:")) != EOF) {
switch(ch) {
case 'n':
no_resolve = 1;
@@ -313,6 +314,9 @@ main(int argc, char **argv)
exit(1);
}
break;
+ case 'm':
+ mark = atoi(optarg);
+ break;
default:
usage();
}
@@ -345,6 +349,12 @@ main(int argc, char **argv)
}
memcpy(&target.sin_addr, he->h_addr, 4);
+ if (mark) {
+ if (setsockopt(fd, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) == -1) {
+ fprintf(stderr, "Warning: Failed to set mark %d\n", mark);
+ }
+ }
+
on = IP_PMTUDISC_PROBE;
if (setsockopt(fd, SOL_IP, IP_MTU_DISCOVER, &on, sizeof(on)) &&
(on = IP_PMTUDISC_DO,
@@ -52,6 +52,7 @@ socklen_t targetlen;
__u16 base_port;
int overhead = 48;
+int mark = 0;
int mtu = 128000;
int hops_to = -1;
int hops_from = -1;
@@ -359,7 +360,7 @@ static void usage(void) __attribute((noreturn));
static void usage(void)
{
- fprintf(stderr, "Usage: tracepath6 [-n] [-b] [-l <len>]
<destination>[/<port>]\n");
+ fprintf(stderr, "Usage: tracepath6 [-n] [-b] [-l <len>] [-m <mark>]
<destination>[/<port>]\n");
exit(-1);