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 1763652

Summary: nft core dumps with "netlink_gen_raw_data: Assertion `len > 0' failed" messages when interface name "*" is used.
Product: Red Hat Enterprise Linux 8 Reporter: suresh kumar <surkumar>
Component: nftablesAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Jiri Peska <jpeska>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: jpeska, psutter, todoleza, yiche
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.2   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: nftables-0.9.3-10.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1801603 (view as bug list) Environment:
Last Closed: 2020-04-28 16:42:15 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 suresh kumar 2019-10-21 09:29:46 UTC
Description of problem:
nft core dumps with "netlink_gen_raw_data: Assertion `len > 0' failed"  messages when interface name "*" is used.

Version-Release number of selected component (if applicable):

nftables-0.9.0-8

How reproducible:

Always


Steps to Reproduce:
=======================

1. Create a configuration file with below rule:
      add rule ip filter input iifname "*" ct state new accept

2. # nft -f /tmp/rules.1
nft: netlink.c:354: netlink_gen_raw_data: Assertion `len > 0' failed.



Actual results:
nft fails with core dump


Expected results:
nft should not core dump


Additional info:
================

[1]
iptables can be used to add a rule  with interface "*".  When importing this rule to RHEL8, it fails with coredump.  Steps given below:


Eg:

//iptables.rules
# Generated by iptables-save v1.4.7 on Sun Oct 20 12:51:51 2019
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i * -p tcp -m tcp --dport 80 -j ACCEPT 
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
-A INPUT -p icmp -j ACCEPT 
-A INPUT -i lo -j ACCEPT 
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT 
-A INPUT -j REJECT --reject-with icmp-host-prohibited 
-A FORWARD -j REJECT --reject-with icmp-host-prohibited 
-A OUTPUT -d 192.168.122.5/32 -p icmp -j DROP 
COMMIT


# iptables-restore-translate -f /tmp/iptables.rules > /tmp/iptables.nft

# nft -f /tmp/iptables.nft
nft: netlink.c:354: netlink_gen_raw_data: Assertion `len > 0' failed.  <<<<
Aborted (core dumped)  <<<<


[2]

If you add the rule directly, then we get a meaningful error message:

# nft add rule ip filter input iifname "*" ct state new accept
Error: datatype mismatch, expected network interface name, expression has type integer
add rule ip filter input iifname * ct state new accept
                          ~~~~~~~ ^

Comment 2 Phil Sutter 2020-02-06 14:54:45 UTC
Experienced behaviour is caused by two problems at once:

* xtables-translate ignores asterisks in interface names - it should escape them.
* nft does not accept escaped asterisks as sole interface name

I sent patches upstream to address both issues. Once they are accepted, I'll clone this ticket for iptables.

iptables fix: https://lore.kernel.org/netfilter-devel/20200206144625.27616-1-phil@nwl.cc/
nftables fix: https://lore.kernel.org/netfilter-devel/20200206113828.7306-2-phil@nwl.cc/
suggested documentation enhancement for nftables: https://lore.kernel.org/netfilter-devel/20200206113828.7306-2-phil@nwl.cc/

Comment 3 Phil Sutter 2020-02-11 10:53:25 UTC
Upstream commits to backport:

commit 03d45ad330a25323610648bb05f550e0fb9d65b2
Author: Phil Sutter <phil>
Date:   Thu Feb 6 12:24:51 2020 +0100

    doc: nft.8: Mention wildcard interface matching
    
    Special meaning of asterisk in interface names wasn't described
    anywhere.
    
    Signed-off-by: Phil Sutter <phil>

commit 556c5a94b8067f33ef0a42836753dae0736b7524
Author: Phil Sutter <phil>
Date:   Thu Feb 6 12:31:56 2020 +0100

    scanner: Extend asteriskstring definition
    
    Accept escaped asterisks also mid-string and as only character.
    Especially the latter will help when translating from iptables where
    asterisk has no special meaning.
    
    Signed-off-by: Phil Sutter <phil>

Comment 15 errata-xmlrpc 2020-04-28 16:42:15 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:1774