On Sun, Apr 23, 2017 at 01:44:51PM -0400, Jamal Hadi Salim wrote: > > Thanks for the excellent work. > > On 17-04-23 08:53 AM, Amir Vadai wrote: > > This command could be useful to increase/decrease fields value. > > > > Does this contradict the "retain" feature? Example rule to > retain the second nibble but set the first to 0xA > (essentially it X-ORs): > tc filter add dev lo parent ffff: protocol ip prio 10 \ > u32 match ip dst 127.0.0.1/32 flowid 1:1 \ > action pedit munge offset 0 u8 set 0x0A retain 0xF0
You mean, for example increasing a single nible in an ipv4 address? If so, then it should work: # tc filter add dev veth0 parent ffff: u32 \ match ip dport 23 0xffff \ action pedit ex \ munge ip src add 1.0.0.0 retain 0xff000000 # tc -s filter show dev veth0 parent ffff: filter protocol all pref 49151 u32 filter protocol all pref 49151 u32 fh 801: ht divisor 1 filter protocol all pref 49151 u32 fh 801::800 order 2048 key ht 801 bkt 0 terminal flowid ??? (rule hit 0 success 0) match 00000017/0000ffff at 20 (success 0 ) action order 1: pedit action pass keys 1 index 48 ref 1 bind 1 installed 1 sec used 1 sec key #0 at ipv4+12: add 01000000 mask 00ffffff Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 > > Mostly curious about hardware handling. As to hardware handling, Or did the implementation so he will answer better. AFAIK, current implementation doesn't allow partial field setting/adding, so such a rule can't be offloaded. I think it is only to make things simple and because there was no use case for that. To my knowledge, hardware should support such thing if needed. Amir > > cheers, > jamal >