On Wed 22 May 2019 at 20:24, Jamal Hadi Salim <j...@mojatatu.com> wrote: > On 2019-05-22 11:08 a.m., Vlad Buslov wrote: >> >> On Tue 21 May 2019 at 16:23, Vlad Buslov <vla...@mellanox.com> wrote: > >> >> It seems that culprit in this case is tc_action->order field. It is used >> as nla attrtype when dumping actions. Initially it is set according to >> ordering of actions of filter that creates them. However, it is >> overwritten in tca_action_gd() each time action is dumped through action >> API (according to action position in tb array) and when new filter is >> attached to shared action (according to action order on the filter). >> With this we have another way to reproduce the bug: >> >> sudo tc qdisc add dev lo ingress >> >> #shared action is the first action (order 1) >> sudo tc filter add dev lo parent ffff: protocol ip prio 8 u32 \ >> match ip dst 127.0.0.8/32 flowid 1:10 \ >> action drop index 104 \ >> action vlan push id 100 protocol 802.1q >> >> #shared action is the the second action (order 2) >> sudo tc filter add dev lo parent ffff: protocol ip prio 8 u32 \ >> match ip dst 127.0.0.10/32 flowid 1:10 \ >> action vlan push id 101 protocol 802.1q \ >> action drop index 104 >> >> # Now action is only visible on one filter >> sudo tc -s filter ls dev lo parent ffff: protocol ip >> > > Ok, thanks for chasing this. A test case i had in mind is to > maybe have 3 actions. Add the drop in the middle for one > and at the begging for another and see if they are visible > with the patch. > If you dont have time I can test maybe AM tommorow.
Works with my patch: ~$ sudo tc qdisc del dev lo ingress ~$ sudo tc qdisc add dev lo ingress ~$ sudo tc filter add dev lo parent ffff: protocol ip prio 8 u32 \ > match ip dst 127.0.0.8/32 flowid 1:10 \ > action drop index 104 \ > mirred egress redirect dev ens1f0 \ > action vlan push id 100 protocol 802.1q ~$ sudo tc filter add dev lo parent ffff: protocol ip prio 8 u32 \ > match ip dst 127.0.0.10/32 flowid 1:10 \ > action vlan push id 101 protocol 802.1q \ > action drop index 104 \ > mirred egress redirect dev ens1f0 ~$ sudo tc -s filter ls dev lo parent ffff: protocol ip filter pref 8 u32 chain 0 filter pref 8 u32 chain 0 fh 800: ht divisor 1 filter pref 8 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:10 not_in_hw (rule hit 0 success 0) match 7f000008/ffffffff at 16 (success 0 ) action order 1: gact action drop random type none pass val 0 index 104 ref 2 bind 2 installed 8 sec used 8 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 action order 2: mirred (Egress Redirect to device ens1f0) stolen index 1 ref 1 bind 1 installed 8 sec used 8 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 action order 3: vlan push id 100 protocol 802.1Q priority 0 pipe index 1 ref 1 bind 1 installed 8 sec used 8 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 filter pref 8 u32 chain 0 fh 800::801 order 2049 key ht 800 bkt 0 flowid 1:10 not_in_hw (rule hit 0 success 0) match 7f00000a/ffffffff at 16 (success 0 ) action order 1: vlan push id 101 protocol 802.1Q priority 0 pipe index 2 ref 1 bind 1 installed 4 sec used 4 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 action order 2: gact action drop random type none pass val 0 index 104 ref 2 bind 2 installed 8 sec used 8 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 action order 3: mirred (Egress Redirect to device ens1f0) stolen index 2 ref 1 bind 1 installed 4 sec used 4 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0