Re: [PATCH iproute2 v3 2/2] tc: pedit: add decrement operation
From: Asbjørn Sloth Tønnesen <hidden>
Date: 2021-06-25 19:22:23
Hi Jamal, Thank you for your review. On 6/24/21 8:24 PM, Jamal Hadi Salim wrote:
So you "add" essentially one's complement of the value you are trying to decrement with?
Almost (off by one), it's basically decrement by overflowing it, which is safe since the operation is masked. One should however have another rule, that matches on TTL == 1. so it can get a proper ICMP error. Decrementing TTL by one was actually the prime example presented when Amir Vadai introduced TCA_PEDIT_KEY_EX_CMD_ADD. kernel 853a14ba net/act_pedit: Introduce 'add' operation [1] iproute2 8d193d96 tc/pedit: p_ip: introduce editing ttl header [2] [1] https://git.kernel.org/torvalds/c/853a14ba [2] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=8d193d96
quoted
quoted
This feature was suggested by some pseudo tc examples in Mellanox's documentation[1], but wasn't present in neither their mlnx-iproute2 nor iproute2. Tested with skip_sw on Mellanox ConnectX-6 Dx. [1] https://docs.mellanox.com/pages/viewpage.action?pageId=47033989I didnt see an example which showed using "dec" but what you described above makes sense.
It is indeed a large document, so to be more specific: https://docs.mellanox.com/pages/viewpage.action?pageId=47033989#highlighter_159101 > Using TC rules: > IPv4: > tc filter add [..] munge ip ttl dec [..] > IPv6: > tc filter add [..] munge ipv6 hlimit dec [..] "ipv6 hlimit" should obviously be "ip6 hoplimit". -- Best regards Asbjørn Sloth Tønnesen