OSDN Git Service

net/sched: act_ct: Fix ct template allocation for zone 0
authorAriel Levkovich <lariel@nvidia.com>
Wed, 26 May 2021 17:01:10 +0000 (20:01 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 27 May 2021 21:54:23 +0000 (14:54 -0700)
commitfb91702b743dec78d6507c53a2dec8a8883f509d
tree0e6688530f2bb08e602a631b9c50d9d2d84c8bfd
parent0cc254e5aa37cf05f65bcdcdc0ac5c58010feb33
net/sched: act_ct: Fix ct template allocation for zone 0

Fix current behavior of skipping template allocation in case the
ct action is in zone 0.

Skipping the allocation may cause the datapath ct code to ignore the
entire ct action with all its attributes (commit, nat) in case the ct
action in zone 0 was preceded by a ct clear action.

The ct clear action sets the ct_state to untracked and resets the
skb->_nfct pointer. Under these conditions and without an allocated
ct template, the skb->_nfct pointer will remain NULL which will
cause the tc ct action handler to exit without handling commit and nat
actions, if such exist.

For example, the following rule in OVS dp:
recirc_id(0x2),ct_state(+new-est-rel-rpl+trk),ct_label(0/0x1), \
in_port(eth0),actions:ct_clear,ct(commit,nat(src=10.11.0.12)), \
recirc(0x37a)

Will result in act_ct skipping the commit and nat actions in zone 0.

The change removes the skipping of template allocation for zone 0 and
treats it the same as any other zone.

Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct")
Signed-off-by: Ariel Levkovich <lariel@nvidia.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Link: https://lore.kernel.org/r/20210526170110.54864-1-lariel@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/act_ct.c