netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: pablo@netfilter.org
To: netfilter-devel@vger.kernel.org
Subject: [PATCH 3/7] netfilter: nf_ct_gre: add unsigned int array to define timeouts
Date: Wed, 29 Feb 2012 03:39:28 +0100	[thread overview]
Message-ID: <1330483172-19159-4-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1330483172-19159-1-git-send-email-pablo@netfilter.org>

From: Pablo Neira Ayuso <pablo@netfilter.org>

This patch adds an array to define the default GRE timeouts.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_conntrack_proto_gre.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c
index f033879..8144f22 100644
--- a/net/netfilter/nf_conntrack_proto_gre.c
+++ b/net/netfilter/nf_conntrack_proto_gre.c
@@ -41,8 +41,16 @@
 #include <linux/netfilter/nf_conntrack_proto_gre.h>
 #include <linux/netfilter/nf_conntrack_pptp.h>
 
-#define GRE_TIMEOUT		(30 * HZ)
-#define GRE_STREAM_TIMEOUT	(180 * HZ)
+enum grep_conntrack {
+	GRE_CT_UNREPLIED,
+	GRE_CT_REPLIED,
+	GRE_CT_MAX
+};
+
+static unsigned int gre_timeouts[GRE_CT_MAX] = {
+	[GRE_CT_UNREPLIED]	= 30*HZ,
+	[GRE_CT_REPLIED]	= 180*HZ,
+};
 
 static int proto_gre_net_id __read_mostly;
 struct netns_proto_gre {
@@ -259,8 +267,8 @@ static bool gre_new(struct nf_conn *ct, const struct sk_buff *skb,
 
 	/* initialize to sane value.  Ideally a conntrack helper
 	 * (e.g. in case of pptp) is increasing them */
-	ct->proto.gre.stream_timeout = GRE_STREAM_TIMEOUT;
-	ct->proto.gre.timeout = GRE_TIMEOUT;
+	ct->proto.gre.stream_timeout = gre_timeouts[GRE_CT_REPLIED];
+	ct->proto.gre.timeout = gre_timeouts[GRE_CT_UNREPLIED];
 
 	return true;
 }
-- 
1.7.7.3


  parent reply	other threads:[~2012-02-29  2:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29  2:39 [PATCH 0/7] [RFC] new cttimeout infrastructure pablo
2012-02-29  2:39 ` [PATCH 1/7] netfilter: nf_ct_udp[lite]: convert UDP[lite] timeouts to array pablo
2012-02-29  2:39 ` [PATCH 2/7] netfilter: nf_ct_tcp: move retransmission and unacknowledged timeout " pablo
2012-02-29  2:39 ` pablo [this message]
2012-02-29  2:39 ` [PATCH 4/7] netfilter: nf_conntrack: pass timeout array to l4->new and l4->packet pablo
2012-02-29  2:39 ` [PATCH 5/7] netfilter: add cttimeout infrastructure for fine timeout tuning pablo
2012-02-29  2:39 ` [PATCH 6/7] netfilter: nf_ct_ext: add timeout extension pablo
2012-02-29  2:39 ` [PATCH 7/7] netfilter: xt_CT: allow to attach timeout policy + glue code pablo
2012-03-01 12:51 ` [PATCH 0/7] [RFC] new cttimeout infrastructure Changli Gao
2012-03-03 13:40   ` Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2012-03-04 11:27 [PATCH 0/7] [RFC] cttimeout v2 pablo
2012-03-04 11:27 ` [PATCH 3/7] netfilter: nf_ct_gre: add unsigned int array to define timeouts pablo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330483172-19159-4-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).