Skip to contentSkip to conversation

: add xt_RATEEST target

RFC In review Patrick McHardy 2 participants 3 messages Nov 25, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/4 : add xt_RATEEST target

commit 1b34dd10f004f7490b80ae52ec662d00c4c268e0

Author: Patrick McHardy <[email protected]>
Date:   Sun Nov 25 17:11:01 2007 +0100

[NETFILTER]: add xt_RATEEST target

include/linux/netfilter/Kbuild +1 -0
index b87e83a..e293ace 100644
@@ -10,6 +10,7 @@ header-y += xt_DSCP.h
 header-y += xt_MARK.h
 header-y += xt_NFLOG.h
 header-y += xt_NFQUEUE.h
+header-y += xt_RATEEST.h
 header-y += xt_SECMARK.h
 header-y += xt_TCPMSS.h
 header-y += xt_comment.h
include/linux/netfilter/xt_RATEEST.h new file +11 -0
new file mode 100644
index 0000000..ed9665f
@@ -0,0 +1,11 @@
+#ifndef _XT_RATEEST_TARGET_H
+#define _XT_RATEEST_TARGET_H
+
+struct xt_rateest_target_info {
+	char			name[IFNAMSIZ];
+	signed char		interval;
+	unsigned char		ewma_log;
+	struct xt_rateest	*est __attribute__((aligned(8)));
+};
+
+#endif /* _XT_RATEEST_TARGET_H */
include/net/netfilter/xt_rateest.h new file +17 -0
new file mode 100644
index 0000000..65d594d
@@ -0,0 +1,17 @@
+#ifndef _XT_RATEEST_H
+#define _XT_RATEEST_H
+
+struct xt_rateest {
+	struct hlist_node		list;
+	char				name[IFNAMSIZ];
+	unsigned int			refcnt;
+	spinlock_t			lock;
+	struct gnet_estimator		params;
+	struct gnet_stats_rate_est	rstats;
+	struct gnet_stats_basic		bstats;
+};
+
+extern struct xt_rateest *xt_rateest_lookup(const char *name);
+extern void xt_rateest_put(struct xt_rateest *est);
+
+#endif /* _XT_RATEEST_H */
net/netfilter/Kconfig +10 -0
index 21a9fcc..6685645 100644
@@ -353,6 +353,16 @@ config NETFILTER_XT_TARGET_NOTRACK
 	  If you want to compile it as a module, say M here and read
 	  <file:Documentation/kbuild/modules.txt>.  If unsure, say `N'.
 
+config NETFILTER_XT_TARGET_RATEEST
+	tristate '"RATEEST" target support'
+	depends on NETFILTER_XTABLES
+	help
+	  This option adds a `RATEEST' target, which allows to measure
+	  rates similar to TC estimators. The `rateest' match can be
+	  used to match on the measured rates.
+
+	  To compile it as a module, choose M here.  If unsure, say N.
+
 config NETFILTER_XT_TARGET_TRACE
 	tristate  '"TRACE" target support'
 	depends on NETFILTER_XTABLES
net/netfilter/Makefile +1 -0
index ad0e36e..e498282 100644
@@ -46,6 +46,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_NFLOG) += xt_NFLOG.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_NOTRACK) += xt_NOTRACK.o
+obj-$(CONFIG_NETFILTER_XT_TARGET_RATEEST) += xt_RATEEST.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_SECMARK) += xt_SECMARK.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_TCPMSS) += xt_TCPMSS.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_TRACE) += xt_TRACE.o
net/netfilter/xt_RATEEST.c new file +204 -0

204 lines not on this page · raw message

#1 lore raw
Quoted 7 lines · Patrick McHardy

Date: Sun, 25 Nov 2007 18:11:43 +0100
From: Patrick McHardy <[email protected]>
To: Netfilter Development Mailinglist <[email protected]>
Subject: [RFC NETFILTER 1/4]: add xt_RATEEST target

^^^ That's all pine gives on reply. :)
*Inline patches* preferred.

include/linux/netfilter/xt_RATEEST.h line 7

Quoted 8 lines
include/linux/netfilter/xt_RATEEST.h new file +7 -0
@@ -0,0 +1,11 @@
+#ifndef _XT_RATEEST_TARGET_H
+#define _XT_RATEEST_TARGET_H
+
+struct xt_rateest_target_info {
+	char			name[IFNAMSIZ];
+	signed char		interval;
+	unsigned char		ewma_log;

int8_t, uint8_t.

Quoted 4 lines
include/linux/netfilter/xt_RATEEST.h new file +4 -0
+	struct xt_rateest	*est __attribute__((aligned(8)));
+};
+
+#endif /* _XT_RATEEST_TARGET_H */
#2 lore raw
Quoted 11 lines · Jan Engelhardt
Quoted 7 lines · Patrick McHardy

Date: Sun, 25 Nov 2007 18:11:43 +0100
From: Patrick McHardy <[email protected]>
To: Netfilter Development Mailinglist <[email protected]>
Subject: [RFC NETFILTER 1/4]: add xt_RATEEST target

^^^ That's all pine gives on reply. :)

Yeah, I know, icedove really sucks in this regard, it not only somehow manages to break Content-Disposition: inline attachments, but also doesn't quote them itself. thunderbird did both correctly.

Quoted 10 lines

include/linux/netfilter/xt_RATEEST.h line 7

Quoted 8 lines
include/linux/netfilter/xt_RATEEST.h new file +7 -0
@@ -0,0 +1,11 @@
+#ifndef _XT_RATEEST_TARGET_H
+#define _XT_RATEEST_TARGET_H
+
+struct xt_rateest_target_info {
+	char			name[IFNAMSIZ];
+	signed char		interval;
+	unsigned char		ewma_log;

int8_t, uint8_t.

It matches the types from the tc headers, but sure, I'll change it.