Bug 1468280

Summary: TestOnly: TC pedit action: Support offset relative to L2 and L4
Product: Red Hat Enterprise Linux 7 Reporter: Simon Horman <simon.horman>
Component: iprouteAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Jaroslav Aster <jaster>
Severity: medium Docs Contact: Ioanna Gkioka <igkioka>
Priority: medium    
Version: 7.5CC: aloughla, atragler, jaster, mark.guinther, nick.viljoen, pasik, psutter, rkhan, sukulkar
Target Milestone: rcKeywords: TestOnly
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: iproute-4.11.0-5.el7 Doc Type: Enhancement
Doc Text:
The `tc-pedit` action now supports "offset" relative to Layer `2` and Layer `4` The `tc-pedit` action allows modification of packet data. This update adds support for specifying the "offset" options relative to the Layer `2`, `3` and `4` headers to `tc-pedit`. This makes `pedit header` handling more robust and flexible. As a result, editing Ethernet header is more convenient and accessing the Layer `4` header works independently to the Layer `3` header size.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 14:28:47 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: 1435647    
Bug Blocks: 1470965    

Description Simon Horman 2017-07-06 14:42:42 UTC
Preface:

The intention of this bug is to provide insight into a feature proposed by Netronome for inclusion in RHEL 7.5.

Description:

Pedit allows modification of packet data. Historically this has been done
relative to an offset from the start of the L3 header with a negative offset used to modify the L2 header. This is, however, not robust in the presence of variable length headers.

Status:

To alleviate this problem pedit has been updated to allow offsets relative to the start of L2 and L4 headers. This is provided by the following upstream patch which was included in v4.11.

7c71a40cbd31 ("tc/pedit: Extend pedit to specify offset relative to mac/transport headers")

The following patches build on the above to provide helper-type facilities to allow easier use by users. They are also included in v4.11.

3d2a7781ec0b ("tc/pedit: p_udp: introduce pedit udp support")
2c6eb12ab825 ("tc/pedit: p_tcp: introduce pedit tcp support")
3cd5149ecd78 ("tc/pedit: p_eth: ETH header editor")
fa4652ff3b5d ("tc/pedit: Support fields bigger than 32 bits")
8d193d96074b ("tc/pedit: p_ip: introduce editing ttl header")

The above patches relate to a new kernel feature introduced in v4.11 and described in BZ1468278. The kernel feature may be used independently of the user-space updates described here. And the user-space updates described here are expected to be independent of use of this feature in conjunction with OvS.

Comment 5 Jaroslav Aster 2017-12-04 15:52:47 UTC
Hi Phil,

I suppose this bug was fixed by re-base, so I can't review patches and find out what has been changed :-).

Could you please send me some example, old and new way?

I read examples, but I'm not sure, how to test it. Thanks.

Comment 6 Phil Sutter 2017-12-05 19:59:16 UTC
Hi Jaroslav,

(In reply to Jaroslav Aster from comment #5)
> I suppose this bug was fixed by re-base, so I can't review patches and find
> out what has been changed :-).

Yes, it was. Hence why it is TestOnly.

> Could you please send me some example, old and new way?
> 
> I read examples, but I'm not sure, how to test it. Thanks.

It is all about 'ex' flag in pedit arguments. The example shown in tc-pedit.8 suits quite well - it performs destination port redirection.

Old style:

# tc filter add dev eth0 parent 1: u32 \
     match ip dport 23 0xffff \
     action pedit munge ip dport set 22

New style:

# tc filter add dev eth0 parent 1: u32 \
     match ip dport 23 0xffff \
     action pedit ex munge tcp dport set 22

Both of the above commands will redirect TCP packets with destination port 23
to destination port 22. The difference is that old style also matches UDP and
breaks if IP header options are present.

Cheers, Phil

Comment 7 Jaroslav Aster 2018-01-16 15:30:57 UTC
Hi Phil,

thank you for your update. My original point was, I would like to be sure that without using ex param everything is the same for users as was before update, no broken scripts because start point of offset is different. I can't test every possibilities :-).

Comment 8 Phil Sutter 2018-01-17 17:12:56 UTC
Hi Jaroslav,

(In reply to Jaroslav Aster from comment #7)
> thank you for your update. My original point was, I would like to be sure
> that without using ex param everything is the same for users as was before
> update, no broken scripts because start point of offset is different. I
> can't test every possibilities :-).

So does my answer help you with that or do you need any further information? I think the old syntax should continue to work just as before. If it doesn't, we have a bug. :)

Cheers, Phil

Comment 9 Jaroslav Aster 2018-02-21 15:15:14 UTC
Hi Phil,

it helped. I just needed information that old syntax has not been changed. Thanks.

Comment 13 errata-xmlrpc 2018-04-10 14:28:47 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-2018:0815