The FDP team is no longer accepting new bugs in Bugzilla. Please report your issues under FDP project in Jira. Thanks.
Bug 2176635 - OVN incorrectly relies on conntrack to reassemble IP fragments
Summary: OVN incorrectly relies on conntrack to reassemble IP fragments
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux Fast Datapath
Classification: Red Hat
Component: OVN
Version: FDP 23.B
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
: ---
Assignee: Ales Musil
QA Contact: Jianlin Shi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-08 21:47 UTC by Ilya Maximets
Modified: 2024-10-29 20:31 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-10-29 20:30:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FD-2724 0 None None None 2023-03-08 21:48:35 UTC
Red Hat Issue Tracker FD-3299 0 None None None 2024-10-29 20:31:12 UTC

Description Ilya Maximets 2023-03-08 21:47:20 UTC
Current version of OVN pipelines relies on L4 port matching in some
of the OpenFlow rules.  But matching on them is not possible in case
of later IP fragments.  For that reason OVN even has a special stage
called 'lr_in_defrag' that is passing all the traffic through conntrack
in hopes that conntrack will re-assemble the packet.  But that is not
a generally correct assumption.

OpenFlow defines several operation modes for a switch:
 - OFPC_FRAG_NORMAL   = 0,  /* No special handling for fragments. */
 - OFPC_FRAG_DROP     = 1,  /* Drop fragments. */
 - OFPC_FRAG_REASM    = 2,  /* Reassemble (only if OFPC_IP_REASM set). */ 

Open vSwitch has a following extension for the list:
 - OFPC_FRAG_NX_MATCH = 3,  /* Make first fragments available for matching. */

OFPC_FRAG_NX_MATCH is default mode in OVS and it does not support
OFPC_FRAG_REASM.

So, from the OpenFlow point of view, users cannot use L4 information
on later fragments and users cannot expect Open vSwitch to reassemble
fragmented IP packets.

The fact that kernel conntrack does reassemble IP fragments is an
unfortunate side effect of re-using kernel connection tracking
implementation.  And it is causing a lot of issues for OVS pipeline.
A few examples are: Necessity to re-fragment reassembled packets
back on egress.  This is a problem, because re-fragmentation in theory
has to slice the packets in the exact fragments it was sliced before.
It's hard to do that, and current implementation can lead to forwarding
back NEEDS_FRAG replies for fragments never sent from the source.
Also, OVS actions like truncated output and check_pkt_len may not work
correctly, because reassembled packet obviously have different length.
See some lengthy discussions on this patch:
  https://lore.kernel.org/all/20210319204307.3128280-1-aconole@redhat.com/

And the final point is that userspace conntrack behaves differently. :)
It doesn't reassemble fragmented packets, but releases all the fragments
back to the datapath in exactly same form they came into it.  So, after
ct() action these packets have a conntrack state, but they are still
separate IP fragments, so L4 information cannot be matched.

So, ability to reassemble IP fragments is not backed up by neither
OpenFlow specification nor different datapath implementations.

In general, OVN cannot rely on IP fragments being reassembled and needs
to build pipelines accordingly.  One potential solution could be to
use ct mark/label to store required L4 information, so it will be available
to later fragments, or ct_tp_src/dst might be utilized somehow.  But I
didn't think this through.

Alternative might be to make userspace datapath mimic the kernel conntrack.
However, that might be not acceptable due to, likely, noticeable performance
drop and potential requirement to re-work the whole dp-packet management
in order to accommodate multi-buffer packets, which was unsuccessfully
tried before several times.

Comment 1 Ales Musil 2023-03-09 09:38:12 UTC
Just to give more context using userspace datapath currently fails the test in following patch:

https://patchwork.ozlabs.org/project/ovn/patch/20230309062144.726961-1-amusil@redhat.com/

Comment 2 Ales Musil 2023-11-02 12:04:32 UTC
We need to resolve https://issues.redhat.com/browse/FDP-124 first before proceeding.

Comment 3 Mark Michelson 2024-10-29 20:30:28 UTC
THis issue is being closed because it is one of three open OVN Bugzilla issues. If this issue is still a problem in modern OVN versions, please create a Jira issue.


Note You need to log in before you can comment on or make changes to this bug.