summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-07-31 01:58:27 +0200
committerPhil Sutter <phil@nwl.cc>2024-08-14 09:50:31 +0200
commit4e2baaee88de7e92b10e646b2756936b9784fdcb (patch)
tree4408a1588088d877b25daaaa445d35e714ebc9ae
parent1778e51e5bf670b96a139248f7a0df84ef5b61c2 (diff)
nft: ruleparse: Drop 'iter' variable in nft_rule_to_iptables_command_state
Use the same named field in 'ctx' instead, it has to carry the value anyway. Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--iptables/nft-ruleparse.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/iptables/nft-ruleparse.c b/iptables/nft-ruleparse.c
index 3b1cbe4f..1ee7a94d 100644
--- a/iptables/nft-ruleparse.c
+++ b/iptables/nft-ruleparse.c
@@ -891,7 +891,6 @@ bool nft_rule_to_iptables_command_state(struct nft_handle *h,
const struct nftnl_rule *r,
struct iptables_command_state *cs)
{
- struct nftnl_expr_iter *iter;
struct nftnl_expr *expr;
struct nft_xt_ctx ctx = {
.cs = cs,
@@ -900,12 +899,11 @@ bool nft_rule_to_iptables_command_state(struct nft_handle *h,
};
bool ret = true;
- iter = nftnl_expr_iter_create(r);
- if (iter == NULL)
+ ctx.iter = nftnl_expr_iter_create(r);
+ if (ctx.iter == NULL)
return false;
- ctx.iter = iter;
- expr = nftnl_expr_iter_next(iter);
+ expr = nftnl_expr_iter_next(ctx.iter);
while (expr != NULL) {
const char *name =
nftnl_expr_get_str(expr, NFTNL_EXPR_NAME);
@@ -941,10 +939,10 @@ bool nft_rule_to_iptables_command_state(struct nft_handle *h,
ret = false;
}
- expr = nftnl_expr_iter_next(iter);
+ expr = nftnl_expr_iter_next(ctx.iter);
}
- nftnl_expr_iter_destroy(iter);
+ nftnl_expr_iter_destroy(ctx.iter);
if (nftnl_rule_is_set(r, NFTNL_RULE_USERDATA)) {
const void *data;