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 1801834

Summary: Fix iptables-restore --noflush with empty lines in input
Product: Red Hat Enterprise Linux 8 Reporter: Phil Sutter <psutter>
Component: iptablesAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Jiri Peska <jpeska>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: iptables-maint-list, jpeska, todoleza
Target Milestone: rcKeywords: Regression
Target Release: 8.2Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: iptables-1.8.4-8.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 17:00:30 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 Phil Sutter 2020-02-11 17:28:38 UTC
Same problem as described here:

https://bugzilla.netfilter.org/show_bug.cgi?id=1400

Fix sent upstream: 

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

Comment 1 Phil Sutter 2020-02-12 14:19:23 UTC
Upstream commit to backport:

commit 8e76391096f12212985c401ee83a67990aa27a29 (HEAD -> upstream, origin-rw/master)
Author: Phil Sutter <phil>
Date:   Tue Feb 11 16:52:59 2020 +0100

    xtables-restore: fix for --noflush and empty lines
    
    Lookahead buffer used for cache requirements estimate in restore
    --noflush separates individual lines with nul-chars. Two consecutive
    nul-chars are interpreted as end of buffer and remaining buffer content
    is skipped.
    
    Sadly, reading an empty line (i.e., one containing a newline character
    only) caused double nul-chars to appear in buffer as well, leading to
    premature stop when reading cached lines from buffer.
    
    To fix that, make use of xtables_restore_parse_line() skipping empty
    lines without calling strtok() and just leave the newline character in
    place. A more intuitive approach, namely skipping empty lines while
    buffering, is deliberately not chosen as that would cause wrong values
    in 'line' variable.
    
    Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1400
    Fixes: 09cb517949e69 ("xtables-restore: Improve performance of --noflush operation")
    Signed-off-by: Phil Sutter <phil>
    Acked-by: Arturo Borrero Gonzalez <arturo>

Comment 8 errata-xmlrpc 2020-04-28 17:00:30 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:1889