Bug 1658716

Summary: nftables fails to accept some names for tables and chains
Product: Red Hat Enterprise Linux 9 Reporter: Akhil John <ajohn>
Component: nftablesAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Jiri Peska <jpeska>
Severity: high Docs Contact:
Priority: medium    
Version: 9.1CC: egarver, jmaxwell, jpeska, rkhan, sukulkar, todoleza
Target Milestone: rcKeywords: Reopened, TestOnly, Triaged
Target Release: 9.1Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nftables-1.0.4-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2108674 (view as bug list) Environment:
Last Closed: 2022-11-15 11:22:16 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:
Bug Depends On: 1682337    
Bug Blocks:    
Deadline: 2022-06-13   

Description Akhil John 2018-12-12 17:52:50 UTC
Description of problem:
nftables is not accepting the names like 'second' 'hour', 'day' or 'minute' for table or chains

Version-Release number of selected component (if applicable):
all versions. (nftables v0.8 and nftables v 0.9)

How reproducible:
Always

Steps to Reproduce:
# nft list ruleset
table ip ABC {
}


# nft add table minute
Error: syntax error, unexpected minute, expecting string
add table minute
          ^^^^^^
# nft add table hour
Error: syntax error, unexpected hour, expecting string
add table hour
          ^^^^
# nft add table day
Error: syntax error, unexpected day, expecting string
add table day
          ^^^
# nft add table second
Error: syntax error, unexpected second, expecting string
add table second
          ^^^^^^


# nft add chain ABC second
Error: syntax error, unexpected second, expecting string
add chain ABC second
              ^^^^^^
# nft add chain ABC minute
Error: syntax error, unexpected minute, expecting string
add chain ABC minute
              ^^^^^^
# nft add chain ABC hour
Error: syntax error, unexpected hour, expecting string
add chain ABC hour
              ^^^^
# nft add chain ABC day
Error: syntax error, unexpected day, expecting string
add chain ABC day
              ^^^

Comment 1 Tomas Dolezal 2018-12-12 17:57:12 UTC
addidtionally, quoted strings are also refused:

# nft add table '"day"'
Error: syntax error, unexpected quoted string, expecting string
add table "day"
          ^^^^^

and for the record:
# nft add table "'day'"
Error: syntax error, unexpected junk, expecting string
add table 'day'
          ^

Comment 2 Phil Sutter 2019-01-16 17:27:11 UTC
Yes, quotes are the suggested method of ensuring a name doesn't clash with a keyword. Sadly, this seems broken here.

Comment 3 Phil Sutter 2019-01-16 19:09:25 UTC
Fix sent upstream: https://marc.info/?l=netfilter-devel&m=154766438526122&w=2

Comment 5 Phil Sutter 2019-08-26 17:24:18 UTC
Upstream rejected my initial solution. Problem was discussed at Netfilter Workshop, a potential workaround identified there needs further investigation.

Comment 10 Phil Sutter 2020-03-26 20:10:04 UTC
*** Bug 1816300 has been marked as a duplicate of this bug. ***

Comment 11 Phil Sutter 2020-03-26 20:12:05 UTC
As described in bug 1816300, the problem tends to become worse as new keywords are introduced, potentially breaking existing setups if they use them as names by accident.

Comment 15 Phil Sutter 2020-08-03 11:05:37 UTC
Still no progress upstream, moving to 8.4.

Comment 16 sushil kulkarni 2020-08-03 12:53:12 UTC
Taking this off of the 8.3 RPL.

Thanks!
Sushil

Comment 20 RHEL Program Management 2021-02-01 07:31:09 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 21 Phil Sutter 2021-02-01 13:59:46 UTC
Still relevant.

Comment 24 Tomas Dolezal 2021-03-24 23:28:29 UTC
keyword 'in' also causes problems:
:: [ 19:21:49 ] :: [  BEGIN   ] :: create nft table :: actually running 'nft -f - <<EOF
table ip filter {
        map foo {
                type inet_service : ifname
        }
        chain in {
        }
}
EOF'
/dev/stdin:5:8-9: Error: syntax error, unexpected in, expecting string
        chain in {
              ^^
/dev/stdin:7:1-1: Error: syntax error, unexpected '}'
}
^
:: [ 19:21:49 ] :: [   FAIL   ] :: create nft table (Expected 0, got 1)

Comment 26 RHEL Program Management 2021-08-01 07:26:53 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 27 Phil Sutter 2021-08-30 13:49:39 UTC
Still relevant.

Comment 32 RHEL Program Management 2022-03-02 07:27:20 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 33 Phil Sutter 2022-03-02 17:13:41 UTC
The problem is still relevant, but given that it is also still WiP upstream we'll schedule this for RHEL9.

Comment 36 Phil Sutter 2022-04-26 11:58:07 UTC
*** Bug 2077521 has been marked as a duplicate of this bug. ***

Comment 39 Phil Sutter 2022-06-09 16:24:43 UTC
Likely fixed implicitly by package rebase (bug 1917398), mark as TestOnly?

Comment 42 Phil Sutter 2022-06-17 12:56:53 UTC
The problem is still somewhat work in progress upstream as the accepted
solution is incomplete, may require attention as new keywords are added and
becomes increasingly complicated to maintain the more keywords are protected
from misinterpretation.

I'll still assume this is "good enough" in v1.0.4 so setting Fixed In Version
field accordingly and setting up for QE to decide whether it fails QA or not.

Comment 52 errata-xmlrpc 2022-11-15 11:22:16 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 (nftables bug fix and enhancement update), 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/RHBA-2022:8381