}
static void
-print_firewall(const struct iptables_command_state *cs, struct nft_rule *r,
- unsigned int num, unsigned int format)
+print_firewall(struct nft_rule *r, unsigned int num, unsigned int format)
{
+ struct iptables_command_state cs = {};
const struct xtables_target *target = NULL;
const char *targname = NULL;
const void *targinfo = NULL;
struct xt_entry_target *t;
size_t target_len = 0;
+ nft_rule_to_iptables_command_state(r, &cs);
+
iter = nft_rule_expr_iter_create(r);
if (iter == NULL)
return;
family = nft_rule_attr_get_u8(r, NFT_RULE_ATTR_FAMILY);
ops = nft_family_ops_lookup(family);
- flags = ops->print_firewall(cs, targname, num, format);
+ flags = ops->print_firewall(&cs, targname, num, format);
if (format & FMT_NOTABLE)
fputs(" ", stdout);
static int
__nft_rule_list(struct nft_handle *h, const char *chain, const char *table,
int rulenum, unsigned int format,
- void (*cb)(const struct iptables_command_state *cs,
- struct nft_rule *r, unsigned int num,
+ void (*cb)(struct nft_rule *r, unsigned int num,
unsigned int format))
{
struct nft_rule_list *list;
goto next;
}
- struct iptables_command_state cs = {};
- /* Show all rules case */
- nft_rule_to_iptables_command_state(r, &cs);
-
- cb(&cs, r, rule_ctr, format);
+ cb(r, rule_ctr, format);
if (rulenum > 0 && rule_ctr == rulenum) {
ret = 1;
break;
}
static void
-list_save(const struct iptables_command_state *cs, struct nft_rule *r,
- unsigned int num, unsigned int format)
+list_save(struct nft_rule *r, unsigned int num, unsigned int format)
{
nft_rule_print_save(r, NFT_RULE_APPEND, !(format & FMT_NOCOUNTS));
}