aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/out2in_ed.c
diff options
context:
space:
mode:
authorVladimir Isaev <visaev@netgate.com>2020-10-06 12:59:47 +0300
committerMatthew Smith <mgsmith@netgate.com>2020-10-12 15:00:04 +0000
commitd3252adce29e45611cbe2a43b2d37758a864a429 (patch)
tree24bfc8b4b78cc46fa1f39cf48566e7efff41b940 /src/plugins/nat/out2in_ed.c
parent41bda044877bae25c5b584a5444c2a038a98e3a9 (diff)
nat: set fib index for bypass session
Bihash key already contains rx_fib_index for lookup but fib value for session itself is set to 0. In the result bihash is allocated with key with fib index set, but free function is looking for key with fib index set to zero. It leads to use-after-free because session itself is removed from pool but bihash is not because of key mismatch. Type: fix Signed-off-by: Vladimir Isaev <visaev@netgate.com> Change-Id: I8ac5a41b0a5a32b1baab9e9d757141d5b24b7798
Diffstat (limited to 'src/plugins/nat/out2in_ed.c')
-rw-r--r--src/plugins/nat/out2in_ed.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/nat/out2in_ed.c b/src/plugins/nat/out2in_ed.c
index de3595b4a33..15cf48067d7 100644
--- a/src/plugins/nat/out2in_ed.c
+++ b/src/plugins/nat/out2in_ed.c
@@ -481,7 +481,7 @@ create_bypass_for_fwd (snat_main_t * sm, vlib_buffer_t * b, ip4_header_t * ip,
s->flags |= SNAT_SESSION_FLAG_UNKNOWN_PROTO;
s->out2in.port = ip->protocol;
}
- s->out2in.fib_index = 0;
+ s->out2in.fib_index = rx_fib_index;
s->in2out.addr = s->out2in.addr;
s->in2out.port = s->out2in.port;
s->in2out.fib_index = s->out2in.fib_index;