Commit e5689435 authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso
Browse files

netfilter: conntrack: remove l4proto destroy hook



Only one user (gre), add a direct call and remove this facility.

Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 2a389de8
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -27,9 +27,6 @@ struct nf_conntrack_l4proto {
	/* protoinfo nlattr size, closes a hole */
	u16 nlattr_size;

	/* Called when a conntrack entry is destroyed */
	void (*destroy)(struct nf_conn *ct);

	/* called by gc worker if table is full */
	bool (*can_early_drop)(const struct nf_conn *ct);

+11 −4
Original line number Diff line number Diff line
@@ -524,11 +524,18 @@ void nf_ct_tmpl_free(struct nf_conn *tmpl)
}
EXPORT_SYMBOL_GPL(nf_ct_tmpl_free);

static void destroy_gre_conntrack(struct nf_conn *ct)
{
	struct nf_conn *master = ct->master;

	if (master)
		nf_ct_gre_keymap_destroy(master);
}

static void
destroy_conntrack(struct nf_conntrack *nfct)
{
	struct nf_conn *ct = (struct nf_conn *)nfct;
	const struct nf_conntrack_l4proto *l4proto;

	pr_debug("destroy_conntrack(%p)\n", ct);
	WARN_ON(atomic_read(&nfct->use) != 0);
@@ -537,9 +544,9 @@ destroy_conntrack(struct nf_conntrack *nfct)
		nf_ct_tmpl_free(ct);
		return;
	}
	l4proto = __nf_ct_l4proto_find(nf_ct_protonum(ct));
	if (l4proto->destroy)
		l4proto->destroy(ct);

	if (unlikely(nf_ct_protonum(ct) == IPPROTO_GRE))
		destroy_gre_conntrack(ct);

	local_bh_disable();
	/* Expectations will have been removed in clean_from_lists,
+0 −14
Original line number Diff line number Diff line
@@ -249,19 +249,6 @@ int nf_conntrack_gre_packet(struct nf_conn *ct,
	return NF_ACCEPT;
}

/* Called when a conntrack entry has already been removed from the hashes
 * and is about to be deleted from memory */
static void gre_destroy(struct nf_conn *ct)
{
	struct nf_conn *master = ct->master;
	pr_debug(" entering\n");

	if (!master)
		pr_debug("no master !?!\n");
	else
		nf_ct_gre_keymap_destroy(master);
}

#ifdef CONFIG_NF_CONNTRACK_TIMEOUT

#include <linux/netfilter/nfnetlink.h>
@@ -329,7 +316,6 @@ const struct nf_conntrack_l4proto nf_conntrack_l4proto_gre = {
#ifdef CONFIG_NF_CONNTRACK_PROCFS
	.print_conntrack = gre_print_conntrack,
#endif
	.destroy	 = gre_destroy,
#if IS_ENABLED(CONFIG_NF_CT_NETLINK)
	.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
	.nlattr_tuple_size = nf_ct_port_nlattr_tuple_size,