Re: [RFC NETFILTER 2/4]: Add xt_rateest match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Engelhardt wrote:
On Nov 25 2007 18:11, Patrick McHardy wrote:

Date: Sun, 25 Nov 2007 18:11:48 +0100
From: Patrick McHardy <kaber@xxxxxxxxx>
To: Netfilter Development Mailinglist <netfilter-devel@xxxxxxxxxxxxxxx>
Subject: [RFC NETFILTER 2/4]: Add xt_rateest match


index 0000000..e4e0653
--- /dev/null
+++ b/include/linux/netfilter/xt_rateest.h
@@ -0,0 +1,33 @@
+#ifndef _XT_RATEEST_MATCH_H
+#define _XT_RATEEST_MATCH_H
+
+enum xt_rateest_match_flags {
+	XT_RATEEST_MATCH_INVERT	= 0x01,
+	XT_RATEEST_MATCH_ABS	= 0x02,
+	XT_RATEEST_MATCH_REL	= 0x04,
+	XT_RATEEST_MATCH_DELTA	= 0x08,
+	XT_RATEEST_MATCH_BPS	= 0x10,
+	XT_RATEEST_MATCH_PPS	= 0x20,
+};

Perhaps 1<<0, 1<<1, 1<<2, ...?

I don't really care, so why not :)

+	spin_lock_bh(&info->est1->lock);
+	rstats	= &info->est1->rstats;
+	if (info->flags & XT_RATEEST_MATCH_DELTA) {
+		bps1	= info->bps1 >= rstats->bps ?
+					info->bps1 - rstats->bps : 0;
+		pps1	= info->pps1 >= rstats->pps ?
+					info->pps1 - rstats->pps : 0;
+	} else {
+		bps1	= rstats->bps;
+		pps1	= rstats->pps;
+	}
+	spin_unlock_bh(&info->est1->lock);
+
+	if (info->flags & XT_RATEEST_MATCH_ABS) {
+		bps2	= info->bps2;
+		pps2	= info->pps2;

I think you can cut down on the extra whitespace around = here,
it already lines up nicely anyway.

True, that needs some reformatting anyway, especially the ? .. : ..
looks weird.
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux