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]
Message-Id: <1256055721-22065-1-git-send-email-gilad@codefidence.com>
Date:	Tue, 20 Oct 2009 18:22:01 +0200
From:	Gilad Ben-Yossef <gilad@...efidence.com>
To:	netdev@...r.kernel.org
Cc:	ori@...sleep.com, ilpo.jarvinen@...sinki.fi,
	Gilad Ben-Yossef <gilad@...efidence.com>
Subject: [PATCH TESTING] Add support for configuring route entry features

This is needed to test my previous per route entry TCP options patch.

Feature display is still numeric, so this is not the final version yet.

To use: add "features nows nots nosack nodsack to a route entry.

Based loosley on original patch by Ilpo Järvinen.

Signed-off-by: Gilad Ben-Yossef <gilad@...efidence.com>

CC: Ilpo Järvinen <ilpo.jarvinen@...sinki.fi>

---
 include/linux/rtnetlink.h |   10 ++++++----
 ip/iproute.c              |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 63d1c69..35964d4 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -376,10 +376,12 @@ enum
 
 #define RTAX_MAX (__RTAX_MAX - 1)
 
-#define RTAX_FEATURE_ECN	0x00000001
-#define RTAX_FEATURE_SACK	0x00000002
-#define RTAX_FEATURE_TIMESTAMP	0x00000004
-#define RTAX_FEATURE_ALLFRAG	0x00000008
+#define RTAX_FEATURE_ECN        0x00000001
+#define RTAX_FEATURE_NO_SACK    0x00000002
+#define RTAX_FEATURE_NO_TSTAMP  0x00000004
+#define RTAX_FEATURE_ALLFRAG    0x00000008
+#define RTAX_FEATURE_NO_WSCALE  0x00000010
+#define RTAX_FEATURE_NO_DSACK   0x00000020
 
 struct rta_session
 {
diff --git a/ip/iproute.c b/ip/iproute.c
index aeea93d..9dcc0e0 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -54,6 +54,22 @@ static const char *mx_names[RTAX_MAX+1] = {
 	[RTAX_FEATURES] = "features",
 	[RTAX_RTO_MIN]	= "rto_min",
 };
+
+struct valname {
+	unsigned int	val;
+	const char	*name;
+};
+
+static const struct valname features[] = {
+	{ RTAX_FEATURE_NO_SACK, "nosack" },
+	{ RTAX_FEATURE_NO_TSTAMP, "notimestamps" },
+	{ RTAX_FEATURE_NO_TSTAMP, "nots" },
+	{ RTAX_FEATURE_NO_WSCALE, "nowindowscale" },
+	{ RTAX_FEATURE_NO_WSCALE, "nows" },
+	{ RTAX_FEATURE_NO_DSACK, "nodsack" },
+	
+};
+
 static void usage(void) __attribute__((noreturn));
 
 static void usage(void)
@@ -75,7 +91,8 @@ static void usage(void)
 	fprintf(stderr, "           [ rtt TIME ] [ rttvar TIME ] [reordering NUMBER ]\n");
 	fprintf(stderr, "           [ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]\n");
 	fprintf(stderr, "           [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n");
-	fprintf(stderr, "           [ rto_min TIME ] [ hoplimit NUMBER ] \n");
+	fprintf(stderr, "           [ rto_min TIME ] [ hoplimit NUMBER ]\n"); 
+	fprintf(stderr, "           [ features DISABLED_FEATURES ]\n");
 	fprintf(stderr, "TYPE := [ unicast | local | broadcast | multicast | throw |\n");
 	fprintf(stderr, "          unreachable | prohibit | blackhole | nat ]\n");
 	fprintf(stderr, "TABLE_ID := [ local | main | default | all | NUMBER ]\n");
@@ -85,6 +102,8 @@ static void usage(void)
 	fprintf(stderr, "NHFLAGS := [ onlink | pervasive ]\n");
 	fprintf(stderr, "RTPROTO := [ kernel | boot | static | NUMBER ]\n");
 	fprintf(stderr, "TIME := NUMBER[s|ms|us|ns|j]\n");
+	fprintf(stderr, "DISABLED_FEATURES := sack | timestamps | ts | ecn | frto |\n");
+	fprintf(stderr, "                     [ DISABLED_FEATURES ]\n");
 	exit(-1);
 }
 
@@ -877,6 +896,30 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
 			if (get_unsigned(&win, *argv, 0))
 				invarg("\"ssthresh\" value is invalid\n", *argv);
 			rta_addattr32(mxrta, sizeof(mxbuf), RTAX_SSTHRESH, win);
+		} else if (matches(*argv, "features") == 0) {
+			int j;
+			unsigned int f = 0;
+			NEXT_ARG();
+			while (1) {
+				for (j = 0; j < ARRAY_SIZE(features); j++) {
+					if (strcmp(*argv, features[j].name) == 0) {
+						f |= features[j].val;
+						if (!NEXT_ARG_OK())
+							goto feat_out;
+						NEXT_ARG();
+						break;
+					}
+				}
+				if (j == ARRAY_SIZE(features)) {
+					if (f)
+						PREV_ARG();
+					break;
+				}
+			}
+feat_out:
+			if (!f)
+				invarg("\"features\" list is invalid\n", *argv);
+			rta_addattr32(mxrta, sizeof(mxbuf), RTAX_FEATURES, f);
 		} else if (matches(*argv, "realms") == 0) {
 			__u32 realm;
 			NEXT_ARG();
-- 
1.5.6.3

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ