aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2020-04-24 12:24:41 +0000
committerOle Trøan <otroan@employees.org>2020-04-24 15:21:44 +0000
commit5581de6d6d69388f899692f2dc201ff76a06af3d (patch)
tree89a66040498c46233ca464126545aa166173a9cc /src/plugins
parent82192ca4dca41de77a2e8a2dd50d72b5573e9a49 (diff)
nat: make usage of vnet_buffer2 transparent
Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I50df248afb3f6b46c49e6695b3f124cfd584f016
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/nat/in2out_ed.c10
-rw-r--r--src/plugins/nat/nat.h8
-rw-r--r--src/plugins/nat/nat44_classify.c2
-rw-r--r--src/plugins/nat/nat_inlines.h6
-rw-r--r--src/plugins/nat/out2in_ed.c8
5 files changed, 13 insertions, 21 deletions
diff --git a/src/plugins/nat/in2out_ed.c b/src/plugins/nat/in2out_ed.c
index 295958927cd..ca1d0cd56ca 100644
--- a/src/plugins/nat/in2out_ed.c
+++ b/src/plugins/nat/in2out_ed.c
@@ -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,
diff --git a/src/plugins/nat/nat.h b/src/plugins/nat/nat.h
index 4b9f24308f5..0fc174d2a91 100644
--- a/src/plugins/nat/nat.h
+++ b/src/plugins/nat/nat.h
@@ -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),
diff --git a/src/plugins/nat/nat44_classify.c b/src/plugins/nat/nat44_classify.c
index f1c80aab98b..2afc479aa5b 100644
--- a/src/plugins/nat/nat44_classify.c
+++ b/src/plugins/nat/nat44_classify.c
@@ -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)
diff --git a/src/plugins/nat/nat_inlines.h b/src/plugins/nat/nat_inlines.h
index e5f2d96b33f..01b43591ccd 100644
--- a/src/plugins/nat/nat_inlines.h
+++ b/src/plugins/nat/nat_inlines.h
@@ -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)))
diff --git a/src/plugins/nat/out2in_ed.c b/src/plugins/nat/out2in_ed.c
index e4f01303b4d..e5adef45fc8 100644
--- a/src/plugins/nat/out2in_ed.c
+++ b/src/plugins/nat/out2in_ed.c
@@ -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,