summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip6_reassembly.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip/ip6_reassembly.c')
-rw-r--r--src/vnet/ip/ip6_reassembly.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/src/vnet/ip/ip6_reassembly.c b/src/vnet/ip/ip6_reassembly.c
index 01f76aa1f0e..10fc6f1f559 100644
--- a/src/vnet/ip/ip6_reassembly.c
+++ b/src/vnet/ip/ip6_reassembly.c
@@ -110,12 +110,10 @@ typedef struct
u32 data_len;
// trace operation counter
u32 trace_op_counter;
- // next index - used by non-feature node
+ // next index - used by custom apps (~0 if not set)
u32 next_index;
- // error next index - used by non-feature node
+ // error next index - used by custom apps (~0 if not set)
u32 error_next_index;
- // is_feature flag stored for non-inline code use
- bool is_feature;
// minimum fragment length for this reassembly - used to estimate MTU
u16 min_fragment_length;
// number of fragments for this reassembly
@@ -326,8 +324,7 @@ ip6_reass_free (ip6_reass_main_t * rm, ip6_reass_per_thread_t * rt,
always_inline void
ip6_reass_drop_all (vlib_main_t * vm, vlib_node_runtime_t * node,
- ip6_reass_main_t * rm, ip6_reass_t * reass,
- bool is_feature)
+ ip6_reass_main_t * rm, ip6_reass_t * reass)
{
u32 range_bi = reass->first_bi;
vlib_buffer_t *range_b;
@@ -355,7 +352,7 @@ ip6_reass_drop_all (vlib_main_t * vm, vlib_node_runtime_t * node,
range_bi = range_vnb->ip.reass.next_range_bi;
}
/* send to next_error_index */
- if (!(is_feature))
+ if (~0 != reass->error_next_index)
{
u32 n_left_to_next, *to_next, next_index;
@@ -393,13 +390,13 @@ ip6_reass_drop_all (vlib_main_t * vm, vlib_node_runtime_t * node,
always_inline void
ip6_reass_on_timeout (vlib_main_t * vm, vlib_node_runtime_t * node,
ip6_reass_main_t * rm, ip6_reass_t * reass,
- u32 * icmp_bi, bool is_feature)
+ u32 * icmp_bi)
{
if (~0 == reass->first_bi)
{
return;
}
- if (is_feature)
+ if (~0 == reass->next_index) // custom apps don't want icmp
{
vlib_buffer_t *b = vlib_get_buffer (vm, reass->first_bi);
if (0 == vnet_buffer (b)->ip.reass.fragment_first)
@@ -426,14 +423,13 @@ ip6_reass_on_timeout (vlib_main_t * vm, vlib_node_runtime_t * node,
0);
}
}
- ip6_reass_drop_all (vm, node, rm, reass, is_feature);
+ ip6_reass_drop_all (vm, node, rm, reass);
}
always_inline ip6_reass_t *
ip6_reass_find_or_create (vlib_main_t * vm, vlib_node_runtime_t * node,
ip6_reass_main_t * rm, ip6_reass_per_thread_t * rt,
- ip6_reass_kv_t * kv, u32 * icmp_bi, u8 * do_handoff,
- bool is_feature)
+ ip6_reass_kv_t * kv, u32 * icmp_bi, u8 * do_handoff)
{
ip6_reass_t *reass = NULL;
f64 now = vlib_time_now (rm->vlib_main);
@@ -450,7 +446,7 @@ ip6_reass_find_or_create (vlib_main_t * vm, vlib_node_runtime_t * node,
if (now > reass->last_heard + rm->timeout)
{
- ip6_reass_on_timeout (vm, node, rm, reass, icmp_bi, is_feature);
+ ip6_reass_on_timeout (vm, node, rm, reass, icmp_bi);
ip6_reass_free (rm, rt, reass);
reass = NULL;
}
@@ -476,7 +472,8 @@ ip6_reass_find_or_create (vlib_main_t * vm, vlib_node_runtime_t * node,
reass->first_bi = ~0;
reass->last_packet_octet = ~0;
reass->data_len = 0;
- reass->is_feature = is_feature;
+ reass->next_index = ~0;
+ reass->error_next_index = ~0;
++rt->reass_n;
}
@@ -503,7 +500,7 @@ always_inline ip6_reass_rc_t
ip6_reass_finalize (vlib_main_t * vm, vlib_node_runtime_t * node,
ip6_reass_main_t * rm, ip6_reass_per_thread_t * rt,
ip6_reass_t * reass, u32 * bi0, u32 * next0, u32 * error0,
- bool is_feature)
+ bool is_custom_app)
{
*bi0 = reass->first_bi;
*error0 = IP6_ERROR_NONE;
@@ -706,7 +703,7 @@ ip6_reass_finalize (vlib_main_t * vm, vlib_node_runtime_t * node,
while (0);
#endif
}
- if (is_feature)
+ if (!is_custom_app)
{
*next0 = IP6_REASSEMBLY_NEXT_INPUT;
}
@@ -754,13 +751,16 @@ always_inline ip6_reass_rc_t
ip6_reass_update (vlib_main_t * vm, vlib_node_runtime_t * node,
ip6_reass_main_t * rm, ip6_reass_per_thread_t * rt,
ip6_reass_t * reass, u32 * bi0, u32 * next0, u32 * error0,
- ip6_frag_hdr_t * frag_hdr, bool is_feature)
+ ip6_frag_hdr_t * frag_hdr, bool is_custom_app)
{
int consumed = 0;
vlib_buffer_t *fb = vlib_get_buffer (vm, *bi0);
vnet_buffer_opaque_t *fvnb = vnet_buffer (fb);
- reass->next_index = fvnb->ip.reass.next_index; // store next_index before it's overwritten
- reass->error_next_index = fvnb->ip.reass.error_next_index; // store error_next_index before it is overwritten
+ if (is_custom_app)
+ {
+ reass->next_index = fvnb->ip.reass.next_index; // store next_index before it's overwritten
+ reass->error_next_index = fvnb->ip.reass.error_next_index; // store error_next_index before it is overwritten
+ }
fvnb->ip.reass.ip6_frag_hdr_offset =
(u8 *) frag_hdr - (u8 *) vlib_buffer_get_current (fb);
@@ -837,7 +837,7 @@ ip6_reass_update (vlib_main_t * vm, vlib_node_runtime_t * node,
else
{
// overlapping fragment - not allowed by RFC 8200
- ip6_reass_drop_all (vm, node, rm, reass, is_feature);
+ ip6_reass_drop_all (vm, node, rm, reass);
ip6_reass_free (rm, rt, reass);
if (PREDICT_FALSE (fb->flags & VLIB_BUFFER_IS_TRACED))
{
@@ -863,7 +863,7 @@ check_if_done_maybe:
reass->data_len == reass->last_packet_octet + 1)
{
return ip6_reass_finalize (vm, node, rm, rt, reass, bi0, next0, error0,
- is_feature);
+ is_custom_app);
}
else
{
@@ -952,9 +952,9 @@ ip6_reass_verify_packet_size_lt_64k (vlib_main_t * vm,
}
always_inline uword
-ip6_reassembly_inline (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame, bool is_feature)
+ip6_reassembly_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame, bool is_feature,
+ bool is_custom_app)
{
u32 *from = vlib_frame_vector_args (frame);
u32 n_left_from, n_left_to_next, *to_next, next_index;
@@ -1027,7 +1027,7 @@ ip6_reassembly_inline (vlib_main_t * vm,
ip6_reass_t *reass =
ip6_reass_find_or_create (vm, node, rm, rt, &kv, &icmp_bi,
- &do_handoff, is_feature);
+ &do_handoff);
if (PREDICT_FALSE (do_handoff))
{
@@ -1042,7 +1042,7 @@ ip6_reassembly_inline (vlib_main_t * vm,
else if (reass)
{
switch (ip6_reass_update (vm, node, rm, rt, reass, &bi0, &next0,
- &error0, frag_hdr, is_feature))
+ &error0, frag_hdr, is_custom_app))
{
case IP6_REASS_RC_OK:
/* nothing to do here */
@@ -1051,14 +1051,14 @@ ip6_reassembly_inline (vlib_main_t * vm,
vlib_node_increment_counter (vm, node->node_index,
IP6_ERROR_REASS_FRAGMENT_CHAIN_TOO_LONG,
1);
- ip6_reass_drop_all (vm, node, rm, reass, is_feature);
+ ip6_reass_drop_all (vm, node, rm, reass);
ip6_reass_free (rm, rt, reass);
goto next_packet;
break;
case IP6_REASS_RC_NO_BUF:
vlib_node_increment_counter (vm, node->node_index,
IP6_ERROR_REASS_NO_BUF, 1);
- ip6_reass_drop_all (vm, node, rm, reass, is_feature);
+ ip6_reass_drop_all (vm, node, rm, reass);
ip6_reass_free (rm, rt, reass);
goto next_packet;
break;
@@ -1067,7 +1067,7 @@ ip6_reassembly_inline (vlib_main_t * vm,
vlib_node_increment_counter (vm, node->node_index,
IP6_ERROR_REASS_INTERNAL_ERROR,
1);
- ip6_reass_drop_all (vm, node, rm, reass, is_feature);
+ ip6_reass_drop_all (vm, node, rm, reass);
ip6_reass_free (rm, rt, reass);
goto next_packet;
break;
@@ -1135,7 +1135,8 @@ static char *ip6_reassembly_error_strings[] = {
VLIB_NODE_FN (ip6_reass_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
- return ip6_reassembly_inline (vm, node, frame, false /* is_feature */ );
+ return ip6_reassembly_inline (vm, node, frame, false /* is_feature */ ,
+ false /* is_custom_app */ );
}
/* *INDENT-OFF* */
@@ -1160,7 +1161,8 @@ VLIB_NODE_FN (ip6_reass_node_feature) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
- return ip6_reassembly_inline (vm, node, frame, true /* is_feature */ );
+ return ip6_reassembly_inline (vm, node, frame, true /* is_feature */ ,
+ false /* is_custom_app */ );
}
/* *INDENT-OFF* */
@@ -1407,7 +1409,7 @@ ip6_reass_walk_expired (vlib_main_t * vm,
b->flags &= ~VLIB_BUFFER_IS_TRACED;
}
}
- ip6_reass_on_timeout (vm, node, rm, reass, &icmp_bi, reass->is_feature);
+ ip6_reass_on_timeout (vm, node, rm, reass, &icmp_bi);
if (~0 != icmp_bi)
{
vec_add1 (vec_icmp_bi, icmp_bi);