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: rc   
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