netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iptables PATCH] iptables: Fix setting of ipv6 counters
@ 2023-06-19 10:44 Jacek Tomasiak
  2023-06-21 11:52 ` Phil Sutter
  0 siblings, 1 reply; 2+ messages in thread
From: Jacek Tomasiak @ 2023-06-19 10:44 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Jacek Tomasiak, Jacek Tomasiak

When setting counters using ip6tables-nft -c X Y the X and Y values were
not stored.

This is a fix based on 9baf3bf0e77dab6ca4b167554ec0e57b65d0af01 but
applied to the nft variant of ipv6 not the legacy.

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1647
Signed-off-by: Jacek Tomasiak <jtomasiak@arista.com>
Signed-off-by: Jacek Tomasiak <jacek.tomasiak@gmail.com>
---
 iptables/xshared.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/iptables/xshared.c b/iptables/xshared.c
index 17aed04e..71ee94d6 100644
--- a/iptables/xshared.c
+++ b/iptables/xshared.c
@@ -1992,6 +1992,9 @@ void ipv6_post_parse(int command, struct iptables_command_state *cs,
 	if (args->goto_set)
 		cs->fw6.ipv6.flags |= IP6T_F_GOTO;
 
+	/* nft-variants use cs->counters, legacy uses cs->fw6.counters */
+	cs->counters.pcnt = args->pcnt_cnt;
+	cs->counters.bcnt = args->bcnt_cnt;
 	cs->fw6.counters.pcnt = args->pcnt_cnt;
 	cs->fw6.counters.bcnt = args->bcnt_cnt;
 
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-21 11:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-19 10:44 [iptables PATCH] iptables: Fix setting of ipv6 counters Jacek Tomasiak
2023-06-21 11:52 ` Phil Sutter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).