Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1790793

Summary: Output duplicate when Reset object counter
Product: Red Hat Enterprise Linux 8 Reporter: yiche <yiche>
Component: nftablesAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: yiche <yiche>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.1CC: todoleza
Target Milestone: rcKeywords: Regression
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nftables-0.9.3-8.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:42:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description yiche 2020-01-14 08:29:53 UTC
Description of problem:
Output duplicate when Reset object counter

Version-Release number of selected component (if applicable):
nftables-0.9.3-4.el8.x86_64

How reproducible:
always

Steps to Reproduce:
1.
nft -f - <<-EOF
table ip filter {
	counter tcp_count {
		packets 234 bytes 19097
	}

	chain input {
		type filter hook input priority filter; policy accept;
		meta l4proto tcp counter name "tcp_coun"
	}
}
EOF
nft reset counter filter tcp_count
table ip filter {
	counter tcp_coun {
		packets 324 bytes 25361
	}
	counter tcp_coun {
		packets 324 bytes 25361
	}
}

2.
3.

Actual results:
Duplicate output but functional

Expected results:
counter do not repeat show.

Additional info:
This is a regression

Comment 1 Phil Sutter 2020-01-14 16:50:43 UTC
Fix sent upstream along with a minor testsuite rework (which should be pulled in as well):

https://lore.kernel.org/netfilter-devel/20200114164630.2492-1-phil@nwl.cc/
https://lore.kernel.org/netfilter-devel/20200114164630.2492-2-phil@nwl.cc/

Comment 2 Phil Sutter 2020-01-16 17:36:53 UTC
Upstream commits to backport:

commit 68310ba0f9c2066f7463d66a1a1938b66fb8a4c4
Author: Phil Sutter <phil>
Date:   Tue Jan 14 16:50:35 2020 +0100

    tests: shell: Search diff tool once and for all
    
    Instead of calling 'which diff' over and over again, just detect the
    tool's presence in run-tests.sh and pass $DIFF to each testcase just
    like with nft binary.
    
    Fall back to using 'true' command to avoid the need for any conditional
    calling in test cases.
    
    While being at it, unify potential diff calls so that a string
    comparison in shell happens irrespective of diff presence.
    
    Signed-off-by: Phil Sutter <phil>
    Acked-by: Pablo Neira Ayuso <pablo>

commit 7def18395d118e22a009de7e2e8de7f77906580b
Author: Phil Sutter <phil>
Date:   Tue Jan 14 17:25:35 2020 +0100

    cache: Fix for doubled output after reset command
    
    Reset command causes a dump of the objects to reset and adds those to
    cache. Yet it ignored if the object in question was already there and up
    to now CMD_RESET was flagged as NFT_CACHE_FULL.
    
    Tackle this from two angles: First, reduce cache requirements of reset
    command to the necessary bits which is table cache. This alone would
    suffice if there wasn't interactive mode (and other libnftables users):
    A cache containing the objects to reset might be in place already, so
    add dumped objects to cache only if they don't exist already.
    
    Signed-off-by: Phil Sutter <phil>
    Acked-by: Pablo Neira Ayuso <pablo>


Yiche, will you cover QA for this ticket?

Comment 3 yiche 2020-01-17 01:33:11 UTC
Yes I will take it,grant qa_ack.

Comment 5 yiche 2020-01-19 03:22:30 UTC
Verify on nftables-0.9.3-8.el8.x86_64
# nft reset counter filter tcp_count
table ip filter {
	counter tcp_count {
		packets 278 bytes 22169
	}
}
No doubled output. TEST PASS

Comment 7 errata-xmlrpc 2020-04-28 16:42:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:1774