[iptables PATCH 10/17] xtables: Eliminate nft_ipv{4,6}_rule_find()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Both functions just pass their parameters 1:1 to nft_ipv46_rule_find, so
replace them by the latter after minor adjustment to match expected
callback signature.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 iptables/nft-ipv4.c   | 10 +---------
 iptables/nft-ipv6.c   | 10 +---------
 iptables/nft-shared.c |  4 ++--
 iptables/nft-shared.h |  2 +-
 4 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/iptables/nft-ipv4.c b/iptables/nft-ipv4.c
index 2afb1453bdc86..2ca3155eae69e 100644
--- a/iptables/nft-ipv4.c
+++ b/iptables/nft-ipv4.c
@@ -414,14 +414,6 @@ static void nft_ipv4_post_parse(int command,
 			      " source or destination IP addresses");
 }
 
-static bool nft_ipv4_rule_find(struct nft_family_ops *ops,
-			       struct nftnl_rule *r, void *data)
-{
-	struct iptables_command_state *cs = data;
-
-	return nft_ipv46_rule_find(ops, r, cs);
-}
-
 static void nft_ipv4_save_counters(const void *data)
 {
 	const struct iptables_command_state *cs = data;
@@ -506,6 +498,6 @@ struct nft_family_ops nft_family_ops_ipv4 = {
 	.parse_target		= nft_ipv46_parse_target,
 	.rule_to_cs		= nft_rule_to_iptables_command_state,
 	.clear_cs		= nft_clear_iptables_command_state,
-	.rule_find		= nft_ipv4_rule_find,
+	.rule_find		= nft_ipv46_rule_find,
 	.xlate			= nft_ipv4_xlate,
 };
diff --git a/iptables/nft-ipv6.c b/iptables/nft-ipv6.c
index ddaeb2b4264ed..29b50878bef47 100644
--- a/iptables/nft-ipv6.c
+++ b/iptables/nft-ipv6.c
@@ -367,14 +367,6 @@ static void nft_ipv6_post_parse(int command, struct iptables_command_state *cs,
 			      " source or destination IP addresses");
 }
 
-static bool nft_ipv6_rule_find(struct nft_family_ops *ops,
-			       struct nftnl_rule *r, void *data)
-{
-	struct iptables_command_state *cs = data;
-
-	return nft_ipv46_rule_find(ops, r, cs);
-}
-
 static void nft_ipv6_save_counters(const void *data)
 {
 	const struct iptables_command_state *cs = data;
@@ -461,6 +453,6 @@ struct nft_family_ops nft_family_ops_ipv6 = {
 	.parse_target		= nft_ipv46_parse_target,
 	.rule_to_cs		= nft_rule_to_iptables_command_state,
 	.clear_cs		= nft_clear_iptables_command_state,
-	.rule_find		= nft_ipv6_rule_find,
+	.rule_find		= nft_ipv46_rule_find,
 	.xlate			= nft_ipv6_xlate,
 };
diff --git a/iptables/nft-shared.c b/iptables/nft-shared.c
index 7abe158bdc55f..45e308679925f 100644
--- a/iptables/nft-shared.c
+++ b/iptables/nft-shared.c
@@ -932,9 +932,9 @@ void nft_ipv46_parse_target(struct xtables_target *t, void *data)
 }
 
 bool nft_ipv46_rule_find(struct nft_family_ops *ops,
-			 struct nftnl_rule *r, struct iptables_command_state *cs)
+			 struct nftnl_rule *r, void *data)
 {
-	struct iptables_command_state this = {};
+	struct iptables_command_state *cs = data, this = {};
 
 	nft_rule_to_iptables_command_state(r, &this);
 
diff --git a/iptables/nft-shared.h b/iptables/nft-shared.h
index deded06b633ac..e4c021e1ac69e 100644
--- a/iptables/nft-shared.h
+++ b/iptables/nft-shared.h
@@ -176,7 +176,7 @@ struct nft_family_ops *nft_family_ops_lookup(int family);
 struct nft_handle;
 void nft_ipv46_parse_target(struct xtables_target *t, void *data);
 bool nft_ipv46_rule_find(struct nft_family_ops *ops, struct nftnl_rule *r,
-			 struct iptables_command_state *cs);
+			 void *data);
 
 bool compare_matches(struct xtables_rule_match *mt1, struct xtables_rule_match *mt2);
 bool compare_targets(struct xtables_target *tg1, struct xtables_target *tg2);
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux