nat: make usage of vnet_buffer2 transparent
Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I50df248afb3f6b46c49e6695b3f124cfd584f016
This commit is contained in:
Klement Sekera
committed by
Ole Trøan
parent
82192ca4dc
commit
5581de6d6d
@ -1027,11 +1027,11 @@ nat44_ed_in2out_fast_path_node_fn_inline (vlib_main_t * vm,
|
||||
|
||||
if (is_output_feature)
|
||||
{
|
||||
vnet_feature_next (&nat_buffer_opaque (b0)->arc_next, b0);
|
||||
vnet_feature_next (&vnet_buffer2 (b0)->nat.arc_next, b0);
|
||||
iph_offset0 = vnet_buffer (b0)->ip.reass.save_rewrite_length;
|
||||
}
|
||||
|
||||
next0 = nat_buffer_opaque (b0)->arc_next;
|
||||
next0 = vnet_buffer2 (b0)->nat.arc_next;
|
||||
|
||||
ip0 = (ip4_header_t *) ((u8 *) vlib_buffer_get_current (b0) +
|
||||
iph_offset0);
|
||||
@ -1232,7 +1232,7 @@ nat44_ed_in2out_fast_path_node_fn_inline (vlib_main_t * vm,
|
||||
t->session_index = ~0;
|
||||
}
|
||||
|
||||
pkts_processed += next0 == nat_buffer_opaque (b0)->arc_next;
|
||||
pkts_processed += next0 == vnet_buffer2 (b0)->nat.arc_next;
|
||||
/* verify speculative enqueue, maybe switch current next frame */
|
||||
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
|
||||
to_next, n_left_to_next,
|
||||
@ -1312,7 +1312,7 @@ nat44_ed_in2out_slow_path_node_fn_inline (vlib_main_t * vm,
|
||||
if (is_output_feature)
|
||||
iph_offset0 = vnet_buffer (b0)->ip.reass.save_rewrite_length;
|
||||
|
||||
next0 = nat_buffer_opaque (b0)->arc_next;
|
||||
next0 = vnet_buffer2 (b0)->nat.arc_next;
|
||||
|
||||
ip0 = (ip4_header_t *) ((u8 *) vlib_buffer_get_current (b0) +
|
||||
iph_offset0);
|
||||
@ -1536,7 +1536,7 @@ nat44_ed_in2out_slow_path_node_fn_inline (vlib_main_t * vm,
|
||||
t->session_index = ~0;
|
||||
}
|
||||
|
||||
pkts_processed += next0 == nat_buffer_opaque (b0)->arc_next;
|
||||
pkts_processed += next0 == vnet_buffer2 (b0)->nat.arc_next;
|
||||
|
||||
/* verify speculative enqueue, maybe switch current next frame */
|
||||
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
|
||||
|
@ -45,11 +45,6 @@
|
||||
/* NAT buffer flags */
|
||||
#define SNAT_FLAG_HAIRPINNING (1 << 0)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 arc_next;
|
||||
} nat_buffer_opaque_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NAT_NEXT_DROP,
|
||||
@ -69,9 +64,6 @@ typedef struct
|
||||
u32 next_index;
|
||||
} nat_pre_trace_t;
|
||||
|
||||
#define nat_buffer_opaque(b) \
|
||||
((nat_buffer_opaque_t *)((vnet_buffer_opaque2_t *)b->opaque2)->__unused2)
|
||||
|
||||
/*
|
||||
STATIC_ASSERT (sizeof (nat_buffer_opaque_t) <=
|
||||
STRUCT_SIZE_OF (vnet_buffer_opaque_t, unused),
|
||||
|
@ -248,7 +248,7 @@ nat44_ed_classify_node_fn_inline (vlib_main_t * vm,
|
||||
u32 arc_next = 0;
|
||||
|
||||
vnet_feature_next (&arc_next, b0);
|
||||
nat_buffer_opaque (b0)->arc_next = arc_next;
|
||||
vnet_buffer2 (b0)->nat.arc_next = arc_next;
|
||||
}
|
||||
|
||||
if (ip0->protocol != IP_PROTOCOL_ICMP)
|
||||
|
@ -79,8 +79,8 @@ nat_pre_node_fn_inline (vlib_main_t * vm,
|
||||
vnet_feature_next (&arc_next0, b0);
|
||||
vnet_feature_next (&arc_next1, b1);
|
||||
|
||||
nat_buffer_opaque (b0)->arc_next = arc_next0;
|
||||
nat_buffer_opaque (b1)->arc_next = arc_next1;
|
||||
vnet_buffer2 (b0)->nat.arc_next = arc_next0;
|
||||
vnet_buffer2 (b1)->nat.arc_next = arc_next1;
|
||||
|
||||
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
|
||||
{
|
||||
@ -122,7 +122,7 @@ nat_pre_node_fn_inline (vlib_main_t * vm,
|
||||
b0 = vlib_get_buffer (vm, bi0);
|
||||
next0 = def_next;
|
||||
vnet_feature_next (&arc_next0, b0);
|
||||
nat_buffer_opaque (b0)->arc_next = arc_next0;
|
||||
vnet_buffer2 (b0)->nat.arc_next = arc_next0;
|
||||
|
||||
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)
|
||||
&& (b0->flags & VLIB_BUFFER_IS_TRACED)))
|
||||
|
@ -719,7 +719,7 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm,
|
||||
n_left_to_next -= 1;
|
||||
|
||||
b0 = vlib_get_buffer (vm, bi0);
|
||||
next0 = nat_buffer_opaque (b0)->arc_next;
|
||||
next0 = vnet_buffer2 (b0)->nat.arc_next;
|
||||
|
||||
vnet_buffer (b0)->snat.flags = 0;
|
||||
ip0 = vlib_buffer_get_current (b0);
|
||||
@ -910,7 +910,7 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm,
|
||||
t->session_index = ~0;
|
||||
}
|
||||
|
||||
pkts_processed += next0 == nat_buffer_opaque (b0)->arc_next;
|
||||
pkts_processed += next0 == vnet_buffer2 (b0)->nat.arc_next;
|
||||
/* verify speculative enqueue, maybe switch current next frame */
|
||||
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
|
||||
to_next, n_left_to_next,
|
||||
@ -992,7 +992,7 @@ nat44_ed_out2in_slow_path_node_fn_inline (vlib_main_t * vm,
|
||||
n_left_to_next -= 1;
|
||||
|
||||
b0 = vlib_get_buffer (vm, bi0);
|
||||
next0 = nat_buffer_opaque (b0)->arc_next;
|
||||
next0 = vnet_buffer2 (b0)->nat.arc_next;
|
||||
|
||||
vnet_buffer (b0)->snat.flags = 0;
|
||||
ip0 = vlib_buffer_get_current (b0);
|
||||
@ -1251,7 +1251,7 @@ nat44_ed_out2in_slow_path_node_fn_inline (vlib_main_t * vm,
|
||||
t->session_index = ~0;
|
||||
}
|
||||
|
||||
pkts_processed += next0 == nat_buffer_opaque (b0)->arc_next;
|
||||
pkts_processed += next0 == vnet_buffer2 (b0)->nat.arc_next;
|
||||
/* verify speculative enqueue, maybe switch current next frame */
|
||||
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
|
||||
to_next, n_left_to_next,
|
||||
|
@ -455,6 +455,12 @@ typedef struct
|
||||
/* The union below has a u64 alignment, so this space is unused */
|
||||
u32 __unused2[1];
|
||||
|
||||
struct
|
||||
{
|
||||
u32 arc_next;
|
||||
u32 unused;
|
||||
} nat;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
Reference in New Issue
Block a user