diff options
author | 2024-04-19 09:15:01 +0200 | |
---|---|---|
committer | 2024-10-07 16:39:42 +0200 | |
commit | 860916617dde9fcc857f3542fbc55c67653638ca (patch) | |
tree | ab5c9ac442e8a1b6dbc06688a1d2932be72eae3d /src/vnet/ip/reass/ip4_sv_reass.h | |
parent | db7be85352a58ee3ef028a56cf66c0ac13975115 (diff) |
ip: add extended shallow reassembly
This patch adds some fixes and improvements:
Fixes bug where save_rewrite_length gets overwritten on reassembly
handoff.
Fixes bug where duplicate fragments could cause a reassembly context
to be lost, because the race losing thread would remove bihash entry
created by winning thread.
Improves tracing by adding more events.
Adds extended shallow reassembly. This is a toggleable option, which if
turned on will cause reassembly to wait for both first and last
fragments to calculate total IP payload length. Furthermore it'll store
a local copy of first fragment and necessary data to retrieve it in
vnet_buffer2. This allows downstream features to access full L3/L4
headers when dealing with fragments.
Type: fix
Change-Id: I81695070533410c5815291dbc65ea71c87e3ae05
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
Diffstat (limited to 'src/vnet/ip/reass/ip4_sv_reass.h')
-rw-r--r-- | src/vnet/ip/reass/ip4_sv_reass.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/vnet/ip/reass/ip4_sv_reass.h b/src/vnet/ip/reass/ip4_sv_reass.h index 3a684eb9809..a1e5659a9f1 100644 --- a/src/vnet/ip/reass/ip4_sv_reass.h +++ b/src/vnet/ip/reass/ip4_sv_reass.h @@ -23,6 +23,7 @@ #ifndef __included_ip4_sv_reass_h__ #define __included_ip4_sv_reass_h__ +#include <stdbool.h> #include <vnet/api_errno.h> #include <vnet/vnet.h> @@ -48,6 +49,33 @@ int ip4_sv_reass_enable_disable_with_refcnt (u32 sw_if_index, int is_enable); int ip4_sv_reass_output_enable_disable_with_refcnt (u32 sw_if_index, int is_enable); +/* + * Enable or disable extended reassembly. + * + * Extended reassembly means that fragments are cached until both first and + * last fragments are seen. Furthermore, first fragment buffer will be cloned + * and stored in reassembly context for later retrieval. + */ +void ip4_sv_reass_enable_disable_extended (bool is_enable); + +struct ip4_sv_lock_unlock_args +{ + u32 *total_ip_payload_length; + u32 *first_fragment_buffer_index; + u32 *first_fragment_total_ip_header_length; +}; + +/* + * Lock thread-level lock and fetch information from reassembly context. + * Uses vnet_buffer2 data filled by extended reassembly. + * + * Returns 0 on success, -1 otherwise. + */ +int ip4_sv_reass_extended_lock (vlib_buffer_t *b, + struct ip4_sv_lock_unlock_args *a); + +void ip4_sv_reass_extended_unlock (vlib_buffer_t *b); + uword ip4_sv_reass_custom_register_next_node (uword node_index); uword ip4_sv_reass_custom_context_register_next_node (uword node_index); |