Skip to content

net: handle the exp removal problem with ovs upcall properly

Xin Long netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 24 repliesApplied 3/3

Patches in v1 All 3 applied

#Subject and filesSizeRepliesApplied
1/3netfilter: allow exp not to be removed in nf_ct_find_expectationinclude/net/netfilter/nf_conntrack_expect.h net/netfilter/nf_conntrack_core.c net/netfilter/nf_conntrack_expect.c +1 more+6 -41 replyApplied
2/3net: sched: set IPS_CONFIRMED in tmpl status only when commit is set in act_ctnet/sched/act_ct.c+2 -12 repliesApplied
3/3openvswitch: set IPS_CONFIRMED in tmpl status only when commit is set in conntracknet/openvswitch/conntrack.c+10 -6817 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAaron ConoleFlorian WestphalDavide Caratti
SeriesA-b
1/3A-b
2/3A-b R-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH net-next 0/3] net: handle the exp removal problem with ovs upcall properly

With the OVS upcall, the original ct in the skb will be dropped, and when the skb comes back from userspace it has to create a new ct again through nf_conntrack_in() in either OVS __ovs_ct_lookup() or TC tcf_ct_act().

However, the new ct will not be able to have the exp as the original ct has taken it away from the hash table in nf_ct_find_expectation(). This will cause some flow never to be matched, like:

'ip,ct_state=-trk,in_port=1 actions=ct(zone=1)' 'ip,ct_state=+trk+new+rel,in_port=1 actions=ct(commit,zone=1)' 'ip,ct_state=+trk+new+rel,in_port=1 actions=ct(commit,zone=2),normal'

if the 2nd flow triggers the OVS upcall, the 3rd flow will never get matched.

OVS conntrack works around this by adding its own exp lookup function to not remove the exp from the hash table and saving the exp and its master info to the flow keys instead of create a real ct. But this way doesn't work for TC act_ct.

The patch 1/3 allows nf_ct_find_expectation() not to remove the exp from the hash table if tmpl is set with IPS_CONFIRMED when doing lookup. This allows both OVS conntrack and TC act_ct to have a simple and clear fix for this problem in the patch 2/3 and 3/3.

Xin Long (3):
netfilter: allow exp not to be removed in nf_ct_find_expectation
net: sched: set IPS_CONFIRMED in tmpl status only when commit is set
in act_ct
openvswitch: set IPS_CONFIRMED in tmpl status only when commit is set
in conntrack

 include/net/netfilter/nf_conntrack_expect.h |  2 +-
 net/netfilter/nf_conntrack_core.c           |  2 +-
 net/netfilter/nf_conntrack_expect.c         |  4 +-
 net/netfilter/nft_ct.c                      |  2 +
 net/openvswitch/conntrack.c                 | 78 +++------------------
 net/sched/act_ct.c                          |  3 +-
 6 files changed, 18 insertions(+), 73 deletions(-)
Signature · 1 line
2.39.1