Re: [PATCH iproute2] tc: pedit: add decrement operation
From: Asbjørn Sloth Tønnesen <hidden>
Date: 2021-06-14 22:57:55
Hi Stephen, On 6/14/21 9:25 PM, Stephen Hemminger wrote:
On Mon, 14 Jun 2021 20:33:24 +0000 Asbjørn Sloth Tønnesen [off-list ref] wrote:quoted
@@ -422,16 +434,21 @@ int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type, __u32 retain, goto done; } return -1; +Please no unnecessary whitespace changes.
No problem, I tried to give context by using format-patch -U4, so it didn't became it's own chunk. I included it to be consistent within the function, having a blank line above both label.
Also you are missing to print_pedit() to print the resulting change.
I didn't plan to since it is stored as TCA_PEDIT_KEY_EX_CMD_ADD,
hence it is printed as:
key #0 at ipv4+8: add ff000000 mask 00ffffff
or
key #0 at ipv6+4: add 000000ff mask ffffff00
If really needed I could detect this, and print something else,
but that would break FP and/or JSON compatibility, which I
don't think is worth it.
print_pedit() is generally not a direct representation of it's
input parameters.
tc filter add [...] action pedit ex \
munge eth dst set aa:00:42:00:00:33 \
munge eth src set aa:00:42:00:00:22 \
munge ip6 hoplimit dec action [..]
becomes:
key #0 at eth+0: val aa004200 mask 00000000
key #1 at eth+4: val 00330000 mask 0000ffff
key #2 at eth+4: val 0000aa00 mask ffff0000
key #3 at eth+8: val 42000022 mask 00000000
key #4 at ipv6+4: add 000000ff mask ffffff00
Note: key #1 and #2 could be consolidated.
Shortly after posting, I noticed that I forgot to amend explain(),
that will be in v2.
--
Best regards
Asbjørn Sloth Tønnesen