All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 39/39]: PPTP conntrack: fix another GRE keymap leak
Date: Wed, 20 Sep 2006 10:24:42 +0200 (MEST)	[thread overview]
Message-ID: <20060920082533.14636.20420.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060920082442.14636.6806.sendpatchset@localhost.localdomain>

[NETFILTER]: PPTP conntrack: fix another GRE keymap leak

When the master PPTP connection times out while still having unfullfilled
expectations (and a GRE keymap entry) associated with it, the keymap entry
is not destroyed.

Add a destroy callback to struct ip_conntrack_helper and use it to destroy
PPTP siblings when the master is destroyed.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit cdd7e9b9a5974273373402873c86f8a349b630d2
tree 18a8f3ed4912aaa4ae2311ff65a87e9238a72712
parent 0646fc2fe542b914d8d379c26f773854d9628815
author Patrick McHardy <kaber@trash.net> Wed, 20 Sep 2006 09:39:07 +0200
committer Patrick McHardy <kaber@trash.net> Wed, 20 Sep 2006 09:39:07 +0200

 include/linux/netfilter_ipv4/ip_conntrack_helper.h |    2 ++
 net/ipv4/netfilter/ip_conntrack_core.c             |    5 +++++
 net/ipv4/netfilter/ip_conntrack_helper_pptp.c      |   12 ++----------
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
index 8d69279..77fe868 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
@@ -25,6 +25,8 @@ struct ip_conntrack_helper
 		    struct ip_conntrack *ct,
 		    enum ip_conntrack_info conntrackinfo);
 
+	void (*destroy)(struct ip_conntrack *ct);
+
 	int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct);
 };
 
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index 2b6f24f..c432b31 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -307,6 +307,7 @@ destroy_conntrack(struct nf_conntrack *n
 {
 	struct ip_conntrack *ct = (struct ip_conntrack *)nfct;
 	struct ip_conntrack_protocol *proto;
+	struct ip_conntrack_helper *helper;
 
 	DEBUGP("destroy_conntrack(%p)\n", ct);
 	IP_NF_ASSERT(atomic_read(&nfct->use) == 0);
@@ -315,6 +316,10 @@ destroy_conntrack(struct nf_conntrack *n
 	ip_conntrack_event(IPCT_DESTROY, ct);
 	set_bit(IPS_DYING_BIT, &ct->status);
 
+	helper = ct->helper;
+	if (helper && helper->destroy)
+		helper->destroy(ct);
+
 	/* To make sure we don't get any weird locking issues here:
 	 * destroy_conntrack() MUST NOT be called with a write lock
 	 * to ip_conntrack_lock!!! -HW */
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
index 98267b0..fb0aee6 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
+++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
@@ -553,15 +553,6 @@ conntrack_pptp_help(struct sk_buff **psk
 	nexthdr_off += tcph->doff * 4;
  	datalen = tcplen - tcph->doff * 4;
 
-	if (tcph->fin || tcph->rst) {
-		DEBUGP("RST/FIN received, timeouting GRE\n");
-		/* can't do this after real newnat */
-		info->cstate = PPTP_CALL_NONE;
-
-		/* untrack this call id, unexpect GRE packets */
-		pptp_destroy_siblings(ct);
-	}
-
 	pptph = skb_header_pointer(*pskb, nexthdr_off, sizeof(_pptph), &_pptph);
 	if (!pptph) {
 		DEBUGP("no full PPTP header, can't track\n");
@@ -640,7 +631,8 @@ static struct ip_conntrack_helper pptp =
 			   .protonum = 0xff
 		 	 }
 		},
-	.help = conntrack_pptp_help
+	.help = conntrack_pptp_help,
+	.destroy = pptp_destroy_siblings,
 };
 
 extern void ip_ct_proto_gre_fini(void);

  parent reply	other threads:[~2006-09-20  8:24 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-20  8:23 [NETFILTER 00/39]: Netfilter update for 2.6.19 Patrick McHardy
2006-09-20  8:23 ` [NETFILTER 01/39]: remove unused include file Patrick McHardy
2006-09-20  8:23 ` [NETFILTER 02/39]: kill listhelp.h Patrick McHardy
2006-09-20 16:54   ` Patrick McHardy
2006-09-20  8:23 ` [NETFILTER 03/39]: xt_conntrack: clean up overly long lines Patrick McHardy
2006-09-20  8:23 ` [NETFILTER 04/39]: ipt_TCPMSS: reformat Patrick McHardy
2006-09-20 11:03   ` Roberto Nibali
2006-09-20 18:19     ` David Miller
2006-09-20 21:11       ` Willy Tarreau
2006-09-20  8:23 ` [NETFILTER 05/39]: ipt_TCPMSS: remove impossible condition Patrick McHardy
2006-09-20 11:07   ` Roberto Nibali
2006-09-20 11:27     ` Patrick McHardy
2006-09-20  8:23 ` [NETFILTER 06/39]: ipt_TCPMSS: misc cleanup Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 07/39]: xt_limit: don't reset state on unrelated rule updates Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 08/39]: ip6table_mangle: reroute when nfmark changes in NF_IP6_LOCAL_OUT Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 09/39]: x_tables: small check_entry & module_refcount cleanup Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 10/39]: ctnetlink: simplify the code to dump the conntrack table Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 11/39]: conntrack: fix race condition in early_drop Patrick McHardy
2006-09-20 11:26   ` Roberto Nibali
2006-09-20 11:30     ` Patrick McHardy
2006-09-20 11:35       ` Roberto Nibali
2006-09-20 11:39         ` Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 12/39]: ipt_TTL: fix checksum update bug Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 13/39]: ip6t_HL: remove write-only variable Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 14/39]: xt_policy: remove dups in .family Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 15/39]: TCP conntrack: improve dead connection detection Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 16/39]: make some netfilter globals __read_mostly Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 17/39]: ip_tables: fix module refcount leaks in compat error paths Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 18/39]: ip_tables: revision support for compat code Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 19/39]: x_tables: simplify compat API Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 20/39]: xt_mark: add compat conversion functions Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 21/39]: xt_MARK: " Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 22/39]: xt_connmark: " Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 23/39]: xt_CONNMARK: " Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 24/39]: xt_limit: " Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 25/39]: ipt_hashlimit: " Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 26/39]: PPTP conntrack: fix whitespace errors Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 27/39]: PPTP conntrack: get rid of unnecessary byte order conversions Patrick McHardy
2006-09-20 11:46   ` Jones Desougi
2006-09-20 11:50     ` Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 28/39]: PPTP conntrack: remove dead code Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 29/39]: PPTP conntrack: remove more " Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 30/39]: PPTP conntrack: fix header definitions Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 31/39]: PPTP conntrack: remove unnecessary cid/pcid header pointers Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 32/39]: PPTP conntrack: simplify expectation handling Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 33/39]: PPTP conntrack: consolidate header size checks Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 34/39]: PPTP conntrack: consolidate header parsing Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 35/39]: PPTP conntrack: clean up debugging cruft Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 36/39]: PPTP conntrack: check call ID before changing state Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 37/39]: PPTP conntrack: fix PPTP_IN_CALL message types Patrick McHardy
2006-09-20  8:24 ` [NETFILTER 38/39]: PPTP conntrack: fix GRE keymap leak Patrick McHardy
2006-09-20  8:24 ` Patrick McHardy [this message]
2006-09-20 19:11 ` [NETFILTER 00/39]: Netfilter update for 2.6.19 David Miller

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=20060920082533.14636.20420.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.