summaryrefslogtreecommitdiffstats
path: root/iptables/xtables-monitor.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-07-19 18:31:55 +0200
committerFlorian Westphal <fw@strlen.de>2018-07-19 22:16:15 +0200
commitd9c6a5d0977a6d8bbe772dbc31a2c4f58eec1708 (patch)
tree6b7530dac45c0bbda47b483d547e71e298168b26 /iptables/xtables-monitor.c
parent87b5b9e2240e7cd5487d160cc3e059c61622ce75 (diff)
xtables: merge {ip,arp}tables_command_state structs
Differences between both structs are marginal (apart from arptables_command_state being much smaller), so merge them into one. Struct iptables_command_state is already shared between iptables, ip6tables and ebtables. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/xtables-monitor.c')
-rw-r--r--iptables/xtables-monitor.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/iptables/xtables-monitor.c b/iptables/xtables-monitor.c
index dd380300..e491b4db 100644
--- a/iptables/xtables-monitor.c
+++ b/iptables/xtables-monitor.c
@@ -73,12 +73,10 @@ static bool events;
static int rule_cb(const struct nlmsghdr *nlh, void *data)
{
- struct arptables_command_state cs_arp = {};
struct iptables_command_state cs = {};
uint32_t type = nlh->nlmsg_type & 0xFF;
const struct cb_arg *arg = data;
struct nftnl_rule *r;
- void *fw = NULL;
uint8_t family;
r = nftnl_rule_alloc();
@@ -99,19 +97,17 @@ static int rule_cb(const struct nlmsghdr *nlh, void *data)
case AF_INET6:
printf("-%c ", family == AF_INET ? '4' : '6');
nft_rule_to_iptables_command_state(r, &cs);
- fw = &cs;
break;
case NFPROTO_ARP:
printf("-0 ");
- nft_rule_to_arptables_command_state(r, &cs_arp);
- fw = &cs_arp;
+ nft_rule_to_arptables_command_state(r, &cs);
break;
default:
goto err_free;
}
printf("-t %s ", nftnl_rule_get_str(r, NFTNL_RULE_TABLE));
- nft_rule_print_save(fw, r,
+ nft_rule_print_save(&cs, r,
type == NFT_MSG_NEWRULE ? NFT_RULE_APPEND :
NFT_RULE_DEL,
counters ? 0 : FMT_NOCOUNTS);