lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 10 Aug 2010 13:17:43 +0400
From:	Антон Д. <littlesmilingcloud@...il.com>
To:	netdev@...r.kernel.org
Subject: [PATCH] iputils: firewall mark option in tracepath/tracepath6

diff --git a/tracepath.c b/tracepath.c
index 81c22e9..6675f14 100644
--- a/tracepath.c
+++ b/tracepath.c
@@ -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,
diff --git a/tracepath6.c b/tracepath6.c
index 5cc7424..5d08c62 100644
--- a/tracepath6.c
+++ b/tracepath6.c
@@ -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);
 }

@@ -375,7 +376,7 @@ int main(int argc, char **argv)
 	int gai;
 	char pbuf[NI_MAXSERV];

-	while ((ch = getopt(argc, argv, "nbh?l:")) != EOF) {
+	while ((ch = getopt(argc, argv, "nbh?l:m:")) != EOF) {
 		switch(ch) {
 		case 'n':
 			no_resolve = 1;
@@ -389,6 +390,9 @@ int main(int argc, char **argv)
 				exit(1);
 			}
 			break;
+		case 'm':
+			mark = atoi(optarg);
+			break;
 		default:
 			usage();
 		}
@@ -439,6 +443,12 @@ int main(int argc, char **argv)
 	}
 	freeaddrinfo(ai0);

+	if (mark) {
+		if (setsockopt(fd, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) == -1) {
+			fprintf(stderr, "Warning: Failed to set mark %d\n", mark);
+		}
+	}
+
 	switch (family) {
 	case AF_INET6:
 		mtu = 128000;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists