]> git.baikalelectronics.ru Git - kernel.git/commit
net: openvswitch: Fix ct_state nat flags for conns arriving from tc
authorPaul Blakey <paulb@nvidia.com>
Thu, 6 Jan 2022 15:38:04 +0000 (17:38 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 10 Jan 2022 00:24:12 +0000 (16:24 -0800)
commit653510b6267e6dddf903f113fecc43e80883ba36
treed551a30d87db083573f66dfc2756ce22c818fbed
parent3c6f79b57467df6d48db4152fe1501dba93ecef3
net: openvswitch: Fix ct_state nat flags for conns arriving from tc

Netfilter conntrack maintains NAT flags per connection indicating
whether NAT was configured for the connection. Openvswitch maintains
NAT flags on the per packet flow key ct_state field, indicating
whether NAT was actually executed on the packet.

When a packet misses from tc to ovs the conntrack NAT flags are set.
However, NAT was not necessarily executed on the packet because the
connection's state might still be in NEW state. As such, openvswitch
wrongly assumes that NAT was executed and sets an incorrect flow key
NAT flags.

Fix this, by flagging to openvswitch which NAT was actually done in
act_ct via tc_skb_ext and tc_skb_cb to the openvswitch module, so
the packet flow key NAT flags will be correctly set.

Fixes: 213cbf44d25b ("net/sched: Introduce action ct")
Signed-off-by: Paul Blakey <paulb@nvidia.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://lore.kernel.org/r/20220106153804.26451-1-paulb@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/skbuff.h
include/net/pkt_sched.h
net/openvswitch/flow.c
net/sched/act_ct.c
net/sched/cls_api.c