summaryrefslogtreecommitdiffstats
path: root/iptables/nft-cmd.h
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2023-11-21 23:14:47 +0100
committerPhil Sutter <phil@nwl.cc>2023-11-23 17:59:42 +0100
commitf340b7b6816beaeeebf6cefa819939cf70ae18f4 (patch)
tree39e955718b979a3038e710c3e1c4693f1261643c /iptables/nft-cmd.h
parentc0bd98c9339b4975c9d52739d638a3c2bdf9a7ff (diff)
ebtables: Implement --change-counters command
Treat it like --replace against the same rule with changed counters. The operation is obviously not atomic, so rule counters may change in kernel while the rule is fetched, modified and replaced. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/nft-cmd.h')
-rw-r--r--iptables/nft-cmd.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/iptables/nft-cmd.h b/iptables/nft-cmd.h
index ae5908d8..8163b82c 100644
--- a/iptables/nft-cmd.h
+++ b/iptables/nft-cmd.h
@@ -7,6 +7,13 @@
struct nftnl_rule;
+enum {
+ CTR_OP_INC_PKTS = 1 << 0,
+ CTR_OP_DEC_PKTS = 1 << 1,
+ CTR_OP_INC_BYTES = 1 << 2,
+ CTR_OP_DEC_BYTES = 1 << 3,
+};
+
struct nft_cmd {
struct list_head head;
int command;
@@ -22,6 +29,7 @@ struct nft_cmd {
} obj;
const char *policy;
struct xt_counters counters;
+ uint8_t counter_op;
const char *rename;
int counters_save;
struct {
@@ -77,6 +85,10 @@ int nft_cmd_rule_list_save(struct nft_handle *h, const char *chain,
const char *table, int rulenum, int counters);
int ebt_cmd_user_chain_policy(struct nft_handle *h, const char *table,
const char *chain, const char *policy);
+int nft_cmd_rule_change_counters(struct nft_handle *h,
+ const char *chain, const char *table,
+ struct iptables_command_state *cs,
+ int rule_nr, uint8_t counter_op, bool verbose);
void nft_cmd_table_new(struct nft_handle *h, const char *table);
#endif /* _NFT_CMD_H_ */