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 1678111

Summary: ip rule list doesn't support sport/dport/ipproto
Product: Red Hat Enterprise Linux 8 Reporter: Jianlin Shi <jishi>
Component: iprouteAssignee: Andrea Claudi <aclaudi>
Status: CLOSED ERRATA QA Contact: Jaroslav Aster <jaster>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: atragler, haliu, jaster
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.1   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: iproute-4.18.0-12.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 22:26:40 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: 1679662    
Bug Blocks:    

Description Jianlin Shi 2019-02-18 06:54:46 UTC
Description of problem:
ip rule list doesn't support sport/dport/ipproto

Version-Release number of selected component (if applicable):
iproute-4.18.0-11.el8.x86_64

How reproducible:
Always

Steps to Reproduce:
1. ip rule list sport 12345
2.
3.

Actual results:
Error: inet prefix is expected rather than "sport".

Expected results:
the command should pass

Additional info:

[root@kvm-01-guest14 func]# rpm -q iproute     
iproute-4.18.0-11.el8.x86_64
[root@kvm-01-guest14 func]# ip rule help
Usage: ip rule { add | del } SELECTOR ACTION
       ip rule { flush | save | restore }
       ip rule [ list [ SELECTOR ]]
SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK[/MASK] ]
            [ iif STRING ] [ oif STRING ] [ pref NUMBER ] [ l3mdev ]
            [ uidrange NUMBER-NUMBER ]
            [ ipproto PROTOCOL ]
            [ sport [ NUMBER | NUMBER-NUMBER ]
            [ dport [ NUMBER | NUMBER-NUMBER ] ]

<=== help shows that ip rule list supports sport/dport/ipproto

ACTION := [ table TABLE_ID ]
          [ protocol PROTO ]
          [ nat ADDRESS ]
          [ realms [SRCREALM/]DSTREALM ]
          [ goto NUMBER ]
          SUPPRESSOR
SUPPRESSOR := [ suppress_prefixlength NUMBER ]
              [ suppress_ifgroup DEVGROUP ]
TABLE_ID := [ local | main | default | NUMBER ]

[root@kvm-01-guest14 func]# ip rule list sport 12345                                          
Error: inet prefix is expected rather than "sport".

Comment 1 Hangbin Liu 2019-02-18 13:06:10 UTC
We need

commit b2e8bf158460568ec5b48cba69f657f95891c901
Author: David Ahern <dsahern>
Date:   Tue Oct 30 15:03:30 2018 -0700

    ip rule: Add ipproto and port range to filter list

    Allow ip rule dumps and flushes to filter based on ipproto, sport
    and dport. Example:

    $ ip ru ls ipproto udp
    99:     from all to 8.8.8.8 ipproto udp dport 53 lookup 1001
    $ ip ru ls dport 53
    99:     from all to 8.8.8.8 ipproto udp dport 53 lookup 1001

    Signed-off-by: David Ahern <dsahern>

Comment 2 Phil Sutter 2019-02-18 13:46:26 UTC
Hey Hangbin,

(In reply to Hangbin Liu from comment #1)
> We need
> 
> commit b2e8bf158460568ec5b48cba69f657f95891c901
> Author: David Ahern <dsahern>
> Date:   Tue Oct 30 15:03:30 2018 -0700

I was about to note just that, you were faster! :)

Thanks, Phil

Comment 7 errata-xmlrpc 2019-11-05 22:26:40 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-2019:3602