Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2232014/?format=api
{ "id": 2232014, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2232014/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260502075639.7440-3-fw@strlen.de/", "project": { "id": 26, "url": "http://patchwork.ozlabs.org/api/1.2/projects/26/?format=api", "name": "Netfilter Development", "link_name": "netfilter-devel", "list_id": "netfilter-devel.vger.kernel.org", "list_email": "netfilter-devel@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260502075639.7440-3-fw@strlen.de>", "list_archive_url": null, "date": "2026-05-02T07:56:36", "name": "[nf,2/5] netfilter: x_tables: add and use xt_unregister_table_pre_exit", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "08312328b0dcc6e0dafded5115eefe042016c1ee", "submitter": { "id": 1025, "url": "http://patchwork.ozlabs.org/api/1.2/people/1025/?format=api", "name": "Florian Westphal", "email": "fw@strlen.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260502075639.7440-3-fw@strlen.de/mbox/", "series": [ { "id": 502515, "url": "http://patchwork.ozlabs.org/api/1.2/series/502515/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=502515", "date": "2026-05-02T07:56:34", "name": "netfilter: xtables: fix module unload and teardown races", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/502515/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2232014/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2232014/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <netfilter-devel+bounces-12391-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "netfilter-devel@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-12391-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=91.216.245.30", "smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=strlen.de", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc" ], "Received": [ "from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g70cF0bs4z1yJw\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 02 May 2026 17:57:01 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id CF6E0300B568\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 2 May 2026 07:56:58 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 1B41B2FF170;\n\tSat, 2 May 2026 07:56:58 +0000 (UTC)", "from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc\n [91.216.245.30])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 252B42FD1AA\n\tfor <netfilter-devel@vger.kernel.org>; Sat, 2 May 2026 07:56:56 +0000 (UTC)", "by Chamillionaire.breakpoint.cc (Postfix, from userid 1003)\n\tid 6EC42605BD; Sat, 02 May 2026 09:56:54 +0200 (CEST)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777708617; cv=none;\n b=sWzxJd0ba5GmfEJkAJcri0FPyqp3pICrP/Yq6A5tdQRI7qfsqchPeLkx/CutO9SUMx4Z6Q6+q6P2FJx6kMqA5nFqa1dP/9LnXKEc1GNUZ9F5/Cb6BqV/0QF3ungUqY7IoSSet0oNLS3HZeWOpbWJnoXAgPsqBUUu3p9J9QZX0dQ=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777708617; c=relaxed/simple;\n\tbh=Wj+pVr7P+0PPF0ANbpbmH1nqsWyFkHA90xPyIVlyOrw=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=KKYg/WcW/a3cHdcQfIpSP+mrGMRy0Lb1YjRDlmSl1DKOISAk70TvMETVCzwTiCwdP/WoMUXf0G1qgqGd+pHH3wWSKFdAzXidm6gBkU8/y+qu5ezs9H9/wmfVS5cLLn4rChDLF9nfi7o95dsQG9gOpsm3ZtijwISjyVWrmvAVZpo=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=strlen.de;\n spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc;\n arc=none smtp.client-ip=91.216.245.30", "From": "Florian Westphal <fw@strlen.de>", "To": "<netfilter-devel@vger.kernel.org>", "Cc": "tristan@talencesecurity.com,\n\tFlorian Westphal <fw@strlen.de>", "Subject": "[PATCH nf 2/5] netfilter: x_tables: add and use\n xt_unregister_table_pre_exit", "Date": "Sat, 2 May 2026 09:56:36 +0200", "Message-ID": "<20260502075639.7440-3-fw@strlen.de>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260502075639.7440-1-fw@strlen.de>", "References": "<20260502075639.7440-1-fw@strlen.de>", "Precedence": "bulk", "X-Mailing-List": "netfilter-devel@vger.kernel.org", "List-Id": "<netfilter-devel.vger.kernel.org>", "List-Subscribe": "<mailto:netfilter-devel+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:netfilter-devel+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "Remove the copypasted variants of _pre_exit and add one single\nfunction in the xtables core. ebtables is not compatible with\nx_tables and therefore unchanged.\n\nThis is a preparation patch to reduce noise in the followup\nbug fixes.\n\nSigned-off-by: Florian Westphal <fw@strlen.de>\n---\n include/linux/netfilter/x_tables.h | 1 +\n include/linux/netfilter_arp/arp_tables.h | 1 -\n include/linux/netfilter_ipv4/ip_tables.h | 1 -\n include/linux/netfilter_ipv6/ip6_tables.h | 1 -\n net/ipv4/netfilter/arp_tables.c | 9 -------\n net/ipv4/netfilter/arptable_filter.c | 2 +-\n net/ipv4/netfilter/ip_tables.c | 9 -------\n net/ipv4/netfilter/iptable_filter.c | 2 +-\n net/ipv4/netfilter/iptable_mangle.c | 2 +-\n net/ipv4/netfilter/iptable_nat.c | 1 +\n net/ipv4/netfilter/iptable_raw.c | 2 +-\n net/ipv4/netfilter/iptable_security.c | 2 +-\n net/ipv6/netfilter/ip6_tables.c | 9 -------\n net/ipv6/netfilter/ip6table_filter.c | 2 +-\n net/ipv6/netfilter/ip6table_mangle.c | 2 +-\n net/ipv6/netfilter/ip6table_nat.c | 1 +\n net/ipv6/netfilter/ip6table_raw.c | 2 +-\n net/ipv6/netfilter/ip6table_security.c | 2 +-\n net/netfilter/x_tables.c | 29 +++++++++++++++++++++++\n 19 files changed, 41 insertions(+), 39 deletions(-)", "diff": "diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h\nindex cb4b694dd9e4..74486714ae20 100644\n--- a/include/linux/netfilter/x_tables.h\n+++ b/include/linux/netfilter/x_tables.h\n@@ -309,6 +309,7 @@ struct xt_table *xt_register_table(struct net *net,\n \t\t\t\t struct xt_table_info *bootstrap,\n \t\t\t\t struct xt_table_info *newinfo);\n void *xt_unregister_table(struct xt_table *table);\n+void xt_unregister_table_pre_exit(struct net *net, u8 af, const char *name);\n \n struct xt_table_info *xt_replace_table(struct xt_table *table,\n \t\t\t\t unsigned int num_counters,\ndiff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h\nindex a40aaf645fa4..05631a25e622 100644\n--- a/include/linux/netfilter_arp/arp_tables.h\n+++ b/include/linux/netfilter_arp/arp_tables.h\n@@ -53,7 +53,6 @@ int arpt_register_table(struct net *net, const struct xt_table *table,\n \t\t\tconst struct arpt_replace *repl,\n \t\t\tconst struct nf_hook_ops *ops);\n void arpt_unregister_table(struct net *net, const char *name);\n-void arpt_unregister_table_pre_exit(struct net *net, const char *name);\n extern unsigned int arpt_do_table(void *priv, struct sk_buff *skb,\n \t\t\t\t const struct nf_hook_state *state);\n \ndiff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h\nindex 132b0e4a6d4d..13593391d605 100644\n--- a/include/linux/netfilter_ipv4/ip_tables.h\n+++ b/include/linux/netfilter_ipv4/ip_tables.h\n@@ -26,7 +26,6 @@ int ipt_register_table(struct net *net, const struct xt_table *table,\n \t\t const struct ipt_replace *repl,\n \t\t const struct nf_hook_ops *ops);\n \n-void ipt_unregister_table_pre_exit(struct net *net, const char *name);\n void ipt_unregister_table_exit(struct net *net, const char *name);\n \n /* Standard entry. */\ndiff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h\nindex 8b8885a73c76..c6d5b927830d 100644\n--- a/include/linux/netfilter_ipv6/ip6_tables.h\n+++ b/include/linux/netfilter_ipv6/ip6_tables.h\n@@ -27,7 +27,6 @@ extern void *ip6t_alloc_initial_table(const struct xt_table *);\n int ip6t_register_table(struct net *net, const struct xt_table *table,\n \t\t\tconst struct ip6t_replace *repl,\n \t\t\tconst struct nf_hook_ops *ops);\n-void ip6t_unregister_table_pre_exit(struct net *net, const char *name);\n void ip6t_unregister_table_exit(struct net *net, const char *name);\n extern unsigned int ip6t_do_table(void *priv, struct sk_buff *skb,\n \t\t\t\t const struct nf_hook_state *state);\ndiff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c\nindex c02e46a0271a..bd348b7bad2c 100644\n--- a/net/ipv4/netfilter/arp_tables.c\n+++ b/net/ipv4/netfilter/arp_tables.c\n@@ -1554,15 +1554,6 @@ int arpt_register_table(struct net *net,\n \treturn ret;\n }\n \n-void arpt_unregister_table_pre_exit(struct net *net, const char *name)\n-{\n-\tstruct xt_table *table = xt_find_table(net, NFPROTO_ARP, name);\n-\n-\tif (table)\n-\t\tnf_unregister_net_hooks(net, table->ops, hweight32(table->valid_hooks));\n-}\n-EXPORT_SYMBOL(arpt_unregister_table_pre_exit);\n-\n void arpt_unregister_table(struct net *net, const char *name)\n {\n \tstruct xt_table *table = xt_find_table(net, NFPROTO_ARP, name);\ndiff --git a/net/ipv4/netfilter/arptable_filter.c b/net/ipv4/netfilter/arptable_filter.c\nindex 78cd5ee24448..393d9a8c7739 100644\n--- a/net/ipv4/netfilter/arptable_filter.c\n+++ b/net/ipv4/netfilter/arptable_filter.c\n@@ -43,7 +43,7 @@ static int arptable_filter_table_init(struct net *net)\n \n static void __net_exit arptable_filter_net_pre_exit(struct net *net)\n {\n-\tarpt_unregister_table_pre_exit(net, \"filter\");\n+\txt_unregister_table_pre_exit(net, NFPROTO_ARP, \"filter\");\n }\n \n static void __net_exit arptable_filter_net_exit(struct net *net)\ndiff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c\nindex 488c5945ebb2..864489928fb5 100644\n--- a/net/ipv4/netfilter/ip_tables.c\n+++ b/net/ipv4/netfilter/ip_tables.c\n@@ -1756,14 +1756,6 @@ int ipt_register_table(struct net *net, const struct xt_table *table,\n \treturn ret;\n }\n \n-void ipt_unregister_table_pre_exit(struct net *net, const char *name)\n-{\n-\tstruct xt_table *table = xt_find_table(net, NFPROTO_IPV4, name);\n-\n-\tif (table)\n-\t\tnf_unregister_net_hooks(net, table->ops, hweight32(table->valid_hooks));\n-}\n-\n void ipt_unregister_table_exit(struct net *net, const char *name)\n {\n \tstruct xt_table *table = xt_find_table(net, NFPROTO_IPV4, name);\n@@ -1854,7 +1846,6 @@ static void __exit ip_tables_fini(void)\n }\n \n EXPORT_SYMBOL(ipt_register_table);\n-EXPORT_SYMBOL(ipt_unregister_table_pre_exit);\n EXPORT_SYMBOL(ipt_unregister_table_exit);\n EXPORT_SYMBOL(ipt_do_table);\n module_init(ip_tables_init);\ndiff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c\nindex 3ab908b74795..b2fbd9651d61 100644\n--- a/net/ipv4/netfilter/iptable_filter.c\n+++ b/net/ipv4/netfilter/iptable_filter.c\n@@ -61,7 +61,7 @@ static int __net_init iptable_filter_net_init(struct net *net)\n \n static void __net_exit iptable_filter_net_pre_exit(struct net *net)\n {\n-\tipt_unregister_table_pre_exit(net, \"filter\");\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV4, \"filter\");\n }\n \n static void __net_exit iptable_filter_net_exit(struct net *net)\ndiff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c\nindex 385d945d8ebe..a99e61996197 100644\n--- a/net/ipv4/netfilter/iptable_mangle.c\n+++ b/net/ipv4/netfilter/iptable_mangle.c\n@@ -96,7 +96,7 @@ static int iptable_mangle_table_init(struct net *net)\n \n static void __net_exit iptable_mangle_net_pre_exit(struct net *net)\n {\n-\tipt_unregister_table_pre_exit(net, \"mangle\");\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV4, \"mangle\");\n }\n \n static void __net_exit iptable_mangle_net_exit(struct net *net)\ndiff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c\nindex 625a1ca13b1b..8fc4912e790d 100644\n--- a/net/ipv4/netfilter/iptable_nat.c\n+++ b/net/ipv4/netfilter/iptable_nat.c\n@@ -129,6 +129,7 @@ static int iptable_nat_table_init(struct net *net)\n static void __net_exit iptable_nat_net_pre_exit(struct net *net)\n {\n \tipt_nat_unregister_lookups(net);\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV4, \"nat\");\n }\n \n static void __net_exit iptable_nat_net_exit(struct net *net)\ndiff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c\nindex 0e7f53964d0a..42511721e538 100644\n--- a/net/ipv4/netfilter/iptable_raw.c\n+++ b/net/ipv4/netfilter/iptable_raw.c\n@@ -53,7 +53,7 @@ static int iptable_raw_table_init(struct net *net)\n \n static void __net_exit iptable_raw_net_pre_exit(struct net *net)\n {\n-\tipt_unregister_table_pre_exit(net, \"raw\");\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV4, \"raw\");\n }\n \n static void __net_exit iptable_raw_net_exit(struct net *net)\ndiff --git a/net/ipv4/netfilter/iptable_security.c b/net/ipv4/netfilter/iptable_security.c\nindex d885443cb267..4646bf6d7d2b 100644\n--- a/net/ipv4/netfilter/iptable_security.c\n+++ b/net/ipv4/netfilter/iptable_security.c\n@@ -50,7 +50,7 @@ static int iptable_security_table_init(struct net *net)\n \n static void __net_exit iptable_security_net_pre_exit(struct net *net)\n {\n-\tipt_unregister_table_pre_exit(net, \"security\");\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV4, \"security\");\n }\n \n static void __net_exit iptable_security_net_exit(struct net *net)\ndiff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c\nindex dbe7c7acd702..edf50bc7787e 100644\n--- a/net/ipv6/netfilter/ip6_tables.c\n+++ b/net/ipv6/netfilter/ip6_tables.c\n@@ -1765,14 +1765,6 @@ int ip6t_register_table(struct net *net, const struct xt_table *table,\n \treturn ret;\n }\n \n-void ip6t_unregister_table_pre_exit(struct net *net, const char *name)\n-{\n-\tstruct xt_table *table = xt_find_table(net, NFPROTO_IPV6, name);\n-\n-\tif (table)\n-\t\tnf_unregister_net_hooks(net, table->ops, hweight32(table->valid_hooks));\n-}\n-\n void ip6t_unregister_table_exit(struct net *net, const char *name)\n {\n \tstruct xt_table *table = xt_find_table(net, NFPROTO_IPV6, name);\n@@ -1864,7 +1856,6 @@ static void __exit ip6_tables_fini(void)\n }\n \n EXPORT_SYMBOL(ip6t_register_table);\n-EXPORT_SYMBOL(ip6t_unregister_table_pre_exit);\n EXPORT_SYMBOL(ip6t_unregister_table_exit);\n EXPORT_SYMBOL(ip6t_do_table);\n \ndiff --git a/net/ipv6/netfilter/ip6table_filter.c b/net/ipv6/netfilter/ip6table_filter.c\nindex e8992693e14a..f05a9e4b2c67 100644\n--- a/net/ipv6/netfilter/ip6table_filter.c\n+++ b/net/ipv6/netfilter/ip6table_filter.c\n@@ -60,7 +60,7 @@ static int __net_init ip6table_filter_net_init(struct net *net)\n \n static void __net_exit ip6table_filter_net_pre_exit(struct net *net)\n {\n-\tip6t_unregister_table_pre_exit(net, \"filter\");\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV6, \"filter\");\n }\n \n static void __net_exit ip6table_filter_net_exit(struct net *net)\ndiff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c\nindex 8dd4cd0c47bd..afa4a5703e43 100644\n--- a/net/ipv6/netfilter/ip6table_mangle.c\n+++ b/net/ipv6/netfilter/ip6table_mangle.c\n@@ -89,7 +89,7 @@ static int ip6table_mangle_table_init(struct net *net)\n \n static void __net_exit ip6table_mangle_net_pre_exit(struct net *net)\n {\n-\tip6t_unregister_table_pre_exit(net, \"mangle\");\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV6, \"mangle\");\n }\n \n static void __net_exit ip6table_mangle_net_exit(struct net *net)\ndiff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c\nindex 5be723232df8..bb8aa3fc42b4 100644\n--- a/net/ipv6/netfilter/ip6table_nat.c\n+++ b/net/ipv6/netfilter/ip6table_nat.c\n@@ -131,6 +131,7 @@ static int ip6table_nat_table_init(struct net *net)\n static void __net_exit ip6table_nat_net_pre_exit(struct net *net)\n {\n \tip6t_nat_unregister_lookups(net);\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV6, \"nat\");\n }\n \n static void __net_exit ip6table_nat_net_exit(struct net *net)\ndiff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c\nindex fc9f6754028f..32d2da81c52a 100644\n--- a/net/ipv6/netfilter/ip6table_raw.c\n+++ b/net/ipv6/netfilter/ip6table_raw.c\n@@ -52,7 +52,7 @@ static int ip6table_raw_table_init(struct net *net)\n \n static void __net_exit ip6table_raw_net_pre_exit(struct net *net)\n {\n-\tip6t_unregister_table_pre_exit(net, \"raw\");\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV6, \"raw\");\n }\n \n static void __net_exit ip6table_raw_net_exit(struct net *net)\ndiff --git a/net/ipv6/netfilter/ip6table_security.c b/net/ipv6/netfilter/ip6table_security.c\nindex 4df14a9bae78..3dfd8d6ea4b9 100644\n--- a/net/ipv6/netfilter/ip6table_security.c\n+++ b/net/ipv6/netfilter/ip6table_security.c\n@@ -49,7 +49,7 @@ static int ip6table_security_table_init(struct net *net)\n \n static void __net_exit ip6table_security_net_pre_exit(struct net *net)\n {\n-\tip6t_unregister_table_pre_exit(net, \"security\");\n+\txt_unregister_table_pre_exit(net, NFPROTO_IPV6, \"security\");\n }\n \n static void __net_exit ip6table_security_net_exit(struct net *net)\ndiff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c\nindex 958b5a8b462d..ec72ba0da983 100644\n--- a/net/netfilter/x_tables.c\n+++ b/net/netfilter/x_tables.c\n@@ -1637,6 +1637,35 @@ void *xt_unregister_table(struct xt_table *table)\n \treturn private;\n }\n EXPORT_SYMBOL_GPL(xt_unregister_table);\n+\n+/**\n+ * xt_unregister_table_pre_exit - pre-shutdown unregister of a table\n+ * @net: network namespace\n+ * @af: address family (e.g., NFPROTO_IPV4, NFPROTO_IPV6)\n+ * @name: name of the table to unregister\n+ *\n+ * Unregisters the specified netfilter table from the given network namespace\n+ * and also unregisters the hooks from netfilter core: no new packets will be\n+ * processed.\n+ */\n+void xt_unregister_table_pre_exit(struct net *net, u8 af, const char *name)\n+{\n+\tstruct xt_pernet *xt_net = net_generic(net, xt_pernet_id);\n+\tstruct xt_table *t;\n+\n+\tmutex_lock(&xt[af].mutex);\n+\tlist_for_each_entry(t, &xt_net->tables[af], list) {\n+\t\tif (strcmp(t->name, name) == 0) {\n+\t\t\tmutex_unlock(&xt[af].mutex);\n+\n+\t\t\tif (t->ops) /* nat table registers with nat core, t->ops is NULL. */\n+\t\t\t\tnf_unregister_net_hooks(net, t->ops, hweight32(t->valid_hooks));\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\tmutex_unlock(&xt[af].mutex);\n+}\n+EXPORT_SYMBOL(xt_unregister_table_pre_exit);\n #endif\n \n #ifdef CONFIG_PROC_FS\n", "prefixes": [ "nf", "2/5" ] }