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 1635238

Summary: nft export xml command does not work
Product: Red Hat Enterprise Linux 7 Reporter: Davide F Bragalone <dbragalo>
Component: nftablesAssignee: Phil Sutter <psutter>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 7.5CC: jmaxwell, todoleza
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1646330 1646336 1646339 (view as bug list) Environment:
Last Closed: 2019-03-15 14:23:13 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:    
Bug Blocks: 1646330, 1646336, 1646339, 1654714    

Description Davide F Bragalone 2018-10-02 12:49:41 UTC
Description of problem:

Man page states:
       export Print the ruleset in machine readable format. The mandatory format parameter may be either xml or json.

However, running 'nft export xml' doesn't return anything:
# nft export xml
# nft export xml | wc -m
1

While if exported in json, it works:
# nft export json | wc -m
9348

I would assume that the nft command accept xml as option but this is not enabled yet.

Version-Release number of selected component (if applicable):
# uname -r
3.10.0-862.el7.x86_64
# rpm -qa | grep nfta
nftables-0.8-10.el7.x86_64


Actual results:
Always reproducible

Expected results:
nft should be exported in xml as well


Additional info:
I tried on RHEL8 and clearly states that is not supported (for both xml and json):
# rpm -qa | grep nftables
nftables-0.8.3-1.el8+5.x86_64

# nft export xml
Error: this output type is not supported
export xml
^^^^^^^^^^^
# nft export json
Error: this output type is not supported
export json
^^^^^^^^^^^^

Comment 2 Phil Sutter 2018-10-22 11:19:56 UTC
Hi Davide,

(In reply to Davide F Bragalone from comment #0)
> Description of problem:
> 
> Man page states:
>        export Print the ruleset in machine readable format. The mandatory
> format parameter may be either xml or json.
> 
> However, running 'nft export xml' doesn't return anything:
> # nft export xml
> # nft export xml | wc -m
> 1
> 
> While if exported in json, it works:
> # nft export json | wc -m
> 9348
> 
> I would assume that the nft command accept xml as option but this is not
> enabled yet.

XML export has never been fully functional upstream and is meanwhile considered obsolete.

> Additional info:
> I tried on RHEL8 and clearly states that is not supported (for both xml and
> json):
> # rpm -qa | grep nftables
> nftables-0.8.3-1.el8+5.x86_64
> 
> # nft export xml
> Error: this output type is not supported
> export xml
> ^^^^^^^^^^^
> # nft export json
> Error: this output type is not supported
> export json
> ^^^^^^^^^^^^

Syntax has changed, the correct command is 'nft export vm json'. Though this as well should be considered deprecated. There is a new JSON input/output implementation which may be used by passing '-j' flag:

| nft -j list ruleset

This is not available in RHEL7, though. For that, I guess the most sensible thing to do is update the documentation to clean up this mess and maybe simply disable JSON export to nip complaints about compatibility issues between RHEL7 and RHEL8 in the bud.

Thanks, Phil

Comment 4 Phil Sutter 2019-03-15 14:23:13 UTC
XML export has never been functional upstream and never will be. Since removal of JSON export functionality in RHEL7 is tracked by bug 1646336, I'm closing this one as WONTFIX.