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 1805798 - JSON parser fails with "prefix" inside "concat"
Summary: JSON parser fails with "prefix" inside "concat"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: nftables
Version: 8.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.3
Assignee: Phil Sutter
QA Contact: Jiri Peska
URL:
Whiteboard:
Depends On:
Blocks: 1685256 1807630
TreeView+ depends on / blocked
 
Reported: 2020-02-21 15:03 UTC by Eric Garver
Modified: 2020-11-04 02:00 UTC (History)
3 users (show)

Fixed In Version: nftables-0.9.3-13.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 01:58:24 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2020:4535 0 None None None 2020-11-04 01:58:38 UTC

Internal Links: 2154905

Description Eric Garver 2020-02-21 15:03:21 UTC
When testing sets with intervals and concatenations (bug 1795224) it was found that the JSON parser fails when a "prefix" occurs within "concat".

[root@rhel8-test1 shell]# dnf info nftables
Name         : nftables
Epoch        : 1
Version      : 0.9.3
Release      : 11.el8
Architecture : x86_64
Size         : 792 k
Source       : nftables-0.9.3-11.el8.src.rpm

--->8---


[root@rhel8-test1 shell]# cat ./testcases/sets/0044json_prefix_in_concat_0
#!/bin/bash

# JSON parsing "prefix" inside "concat" for a set element

RULESET='{"nftables": [{"metainfo": {"json_schema_version": 1}},
         {"add": {"table": {"family": "inet", "name": "foobar_table"}}},
         {"add": {"set": {"family": "inet", "name": "foobar_set", "table": "foobar_table", "type": ["ipv4_addr", "inet_proto", "inet_service"]}}},
         {"add": {"element": {"elem": [{"concat": [{"prefix": {"addr": "10.10.10.0", "len": 24}}, "sctp", "1234"]}], "family": "inet", "name": "foobar_set", "table": "foobar_table"}}}]}'

set -e
$NFT -j -f - <<< "$RULESET"


[root@rhel8-test1 shell]#  ./run-tests.sh ./testcases/sets/0044json_prefix_in_concat_0
I: using nft binary ./../../src/nft

I: [OK]         ./testcases/sets/0044json_prefix_in_concat_0

I: results: [OK] 1 [FAILED] 0 [TOTAL] 1


[root@rhel8-test1 shell]# NFT=/usr/sbin/nft ./run-tests.sh ./testcases/sets/0044json_prefix_in_concat_0
I: using nft binary /usr/sbin/nft

W: [FAILED]     ./testcases/sets/0044json_prefix_in_concat_0: got 1
internal:0:0-0: Error: Expression type prefix not allowed in context (RHS, PRIMARY).

internal:0:0-0: Error: Parsing expr at index 0 failed.

internal:0:0-0: Error: Invalid set elem at index 0.

internal:0:0-0: Error: Invalid set.

internal:0:0-0: Error: Parsing command array at index 3 failed.

I: results: [OK] 0 [FAILED] 1 [TOTAL] 1

Comment 1 Phil Sutter 2020-05-19 21:37:20 UTC
Upstream commit to backport:

commit 9475ca305a993751b05cf26ef8e785a00de98b94
Author: Phil Sutter <phil>
Date:   Fri Mar 6 16:15:48 2020 +0100

    parser_json: Support ranges in concat expressions
    
    Duplicate commit 8ac2f3b2fca38's changes to bison parser into JSON
    parser by introducing a new context flag signalling we're parsing
    concatenated expressions.
    
    Fixes: 8ac2f3b2fca38 ("src: Add support for concatenated set ranges")
    Signed-off-by: Phil Sutter <phil>
    Acked-by: Eric Garver <eric>

Comment 7 errata-xmlrpc 2020-11-04 01:58:24 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/RHEA-2020:4535


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