summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2021-02-10 16:20:26 +0100
committerNeale Ranns <neale@graphiant.com>2021-02-13 15:14:04 +0000
commit6dab1aea921598815dfb12028c37be7358370620 (patch)
tree9c9a0c62012100a6bdf77549021a67aff035701e
parentaa7d7662f63bfe6643b193f74288aea67f883744 (diff)
nat: pnat only use save_rewrite_length on output path
Don't expect save_rewrite_length to be set correctly on RX path. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Ieee40d119213f617c3d836181e5879f084b74548 Signed-off-by: Ole Troan <ot@cisco.com>
-rw-r--r--src/plugins/nat/pnat/pnat_node.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/nat/pnat/pnat_node.h b/src/plugins/nat/pnat/pnat_node.h
index 3f2235509fa..89acab0b624 100644
--- a/src/plugins/nat/pnat/pnat_node.h
+++ b/src/plugins/nat/pnat/pnat_node.h
@@ -132,7 +132,8 @@ static_always_inline uword pnat_node_inline(vlib_main_t *vm,
u32 sw_if_index0 = vnet_buffer(b[0])->sw_if_index[dir];
u16 sport0 = vnet_buffer(b[0])->ip.reass.l4_src_port;
u16 dport0 = vnet_buffer(b[0])->ip.reass.l4_dst_port;
- u32 iph_offset = vnet_buffer(b[0])->ip.reass.save_rewrite_length;
+ u32 iph_offset =
+ dir == VLIB_TX ? vnet_buffer(b[0])->ip.save_rewrite_length : 0;
ip0 = (ip4_header_t *)(vlib_buffer_get_current(b[0]) + iph_offset);
interface = pnat_interface_by_sw_if_index(sw_if_index0);
ASSERT(interface);
@@ -146,8 +147,6 @@ static_always_inline uword pnat_node_inline(vlib_main_t *vm,
if (clib_bihash_search_16_8(&pm->flowhash, &kv, &value) == 0) {
/* Cache hit */
*pi = value.value;
- u32 iph_offset = vnet_buffer(b[0])->ip.reass.save_rewrite_length;
- ip0 = (ip4_header_t *)(vlib_buffer_get_current(b[0]) + iph_offset);
u32 errno0 = pnat_rewrite_ip4(value.value, ip0);
if (PREDICT_FALSE(errno0)) {
next[0] = PNAT_NEXT_DROP;