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

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
...@@ -27,9 +27,6 @@ struct nf_conntrack_l4proto { ...@@ -27,9 +27,6 @@ struct nf_conntrack_l4proto {
/* protoinfo nlattr size, closes a hole */ /* protoinfo nlattr size, closes a hole */
u16 nlattr_size; u16 nlattr_size;
/* Called when a conntrack entry is destroyed */
void (*destroy)(struct nf_conn *ct);
/* called by gc worker if table is full */ /* called by gc worker if table is full */
bool (*can_early_drop)(const struct nf_conn *ct); bool (*can_early_drop)(const struct nf_conn *ct);
......
...@@ -524,11 +524,18 @@ void nf_ct_tmpl_free(struct nf_conn *tmpl) ...@@ -524,11 +524,18 @@ void nf_ct_tmpl_free(struct nf_conn *tmpl)
} }
EXPORT_SYMBOL_GPL(nf_ct_tmpl_free); 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 static void
destroy_conntrack(struct nf_conntrack *nfct) destroy_conntrack(struct nf_conntrack *nfct)
{ {
struct nf_conn *ct = (struct nf_conn *)nfct; struct nf_conn *ct = (struct nf_conn *)nfct;
const struct nf_conntrack_l4proto *l4proto;
pr_debug("destroy_conntrack(%p)\n", ct); pr_debug("destroy_conntrack(%p)\n", ct);
WARN_ON(atomic_read(&nfct->use) != 0); WARN_ON(atomic_read(&nfct->use) != 0);
...@@ -537,9 +544,9 @@ destroy_conntrack(struct nf_conntrack *nfct) ...@@ -537,9 +544,9 @@ destroy_conntrack(struct nf_conntrack *nfct)
nf_ct_tmpl_free(ct); nf_ct_tmpl_free(ct);
return; return;
} }
l4proto = __nf_ct_l4proto_find(nf_ct_protonum(ct));
if (l4proto->destroy) if (unlikely(nf_ct_protonum(ct) == IPPROTO_GRE))
l4proto->destroy(ct); destroy_gre_conntrack(ct);
local_bh_disable(); local_bh_disable();
/* Expectations will have been removed in clean_from_lists, /* Expectations will have been removed in clean_from_lists,
......
...@@ -249,19 +249,6 @@ int nf_conntrack_gre_packet(struct nf_conn *ct, ...@@ -249,19 +249,6 @@ int nf_conntrack_gre_packet(struct nf_conn *ct,
return NF_ACCEPT; 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 #ifdef CONFIG_NF_CONNTRACK_TIMEOUT
#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink.h>
...@@ -329,7 +316,6 @@ const struct nf_conntrack_l4proto nf_conntrack_l4proto_gre = { ...@@ -329,7 +316,6 @@ const struct nf_conntrack_l4proto nf_conntrack_l4proto_gre = {
#ifdef CONFIG_NF_CONNTRACK_PROCFS #ifdef CONFIG_NF_CONNTRACK_PROCFS
.print_conntrack = gre_print_conntrack, .print_conntrack = gre_print_conntrack,
#endif #endif
.destroy = gre_destroy,
#if IS_ENABLED(CONFIG_NF_CT_NETLINK) #if IS_ENABLED(CONFIG_NF_CT_NETLINK)
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
.nlattr_tuple_size = nf_ct_port_nlattr_tuple_size, .nlattr_tuple_size = nf_ct_port_nlattr_tuple_size,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment