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 1807601 - libnftables: JSON: IPv6 addresses can not contain square brackets
Summary: libnftables: JSON: IPv6 addresses can not contain square brackets
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: nftables
Version: 8.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 8.0
Assignee: Phil Sutter
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-02-26 17:24 UTC by Eric Garver
Modified: 2020-06-22 13:57 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-06-22 13:57:46 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Eric Garver 2020-02-26 17:24:47 UTC
If an IPv6 address has square brackets it will be rejected by libnftables JSON parsing. The CLI (bison) parser happily accepts the square bracket syntax. Square brackets are also accepted by ipset and iptables.

Found when working on bug 1779835. Also see RFC 2732 [1].

[1] https://tools.ietf.org/rfc/rfc2732.txt

-->8--

# nft delete table ip foobar; cat /tmp/json | nft -j -f -
internal:0:0-0: Error: Could not resolve hostname: Name or service not known

# nft delete table ip foobar; sed -e 's/[[]1234::[]]/1234::/' /tmp/json | nft -j -f -
** no error **

# nft add element ip foobar myset '{ [4321::]/64 }'
** no error **

# cat /tmp/json  | python3 -m json.tool
{
    "nftables": [
        {
            "metainfo": {
                "version": "0.9.3",
                "release_name": "Topsy",
                "json_schema_version": 1
            }
        },
        {
            "table": {
                "family": "ip",
                "name": "foobar"
            }
        },
        {
            "set": {
                "family": "ip",
                "name": "myset",
                "table": "foobar",
                "type": "ipv6_addr",
                "flags": [
                    "interval"
                ],
                "elem": [
                    {
                        "prefix": {
                            "addr": "[1234::]",
                            "len": 64
                        }
                    }
                ]
            }
        }
    ]
}

Comment 2 Eric Garver 2020-02-26 18:07:11 UTC
Correction: ip6tables-nft also appears to reject the square bracket syntax.

Comment 3 Phil Sutter 2020-06-22 13:57:46 UTC
Bracket syntax is accepted by bison due to flex detecting patterns that look
like IPv6 addresses and if surrounded by brackets skipping the latter. For the
CLI interface I think that's feasible to provide some flexibility to users, but
for JSON I don't. Filtering any undefined string through IPv6 address detection
is pretty tedious and I would rather consider introducing an object defining an
IPv6 address if ambiguity is a concern.

Given that firewalld is fine without a change on nft side, I'm closing this as WONTFIX.


Note You need to log in before you can comment on or make changes to this bug.