summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-02-03 01:35:55 -0800
committerMatus Fabian <matfabia@cisco.com>2017-02-03 03:25:42 -0800
commit2ae991e27afb3fe2944dd4f60eb2b03f29365c95 (patch)
tree292bca6c5ae8ef672b47fc4b58464a26adad736e
parent09d96f4a611fa989bfbbfb7e683d668dbe73ac1a (diff)
SNAT: fix invalid outside FIB index
Change-Id: Ia5d3d81cbc2ef85fabf9e19c89a52c589a921d14 Signed-off-by: Matus Fabian <matfabia@cisco.com>
-rw-r--r--src/plugins/snat/in2out.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/snat/in2out.c b/src/plugins/snat/in2out.c
index b0047737121..e783027f856 100644
--- a/src/plugins/snat/in2out.c
+++ b/src/plugins/snat/in2out.c
@@ -163,6 +163,13 @@ snat_not_translate (snat_main_t * sm, snat_runtime_t * rt, u32 sw_if_index0,
if (PREDICT_FALSE(ip0->dst_address.as_u32 == rt->cached_ip4_address))
return 1;
+ /* If outside FIB index is not resolved yet */
+ if (sm->outside_fib_index == ~0)
+ {
+ sm->outside_fib_index =
+ ip4_fib_table_find_or_create_and_lock (sm->outside_vrf_id);
+ }
+
key0.addr = ip0->dst_address;
key0.port = udp0->dst_port;
key0.protocol = proto0;
@@ -528,6 +535,13 @@ snat_hairpinning (snat_main_t *sm,
u32 new_dst_addr0 = 0, old_dst_addr0, ti = 0, si;
u16 new_dst_port0, old_dst_port0;
+ /* If outside FIB index is not resolved yet */
+ if (sm->outside_fib_index == ~0)
+ {
+ sm->outside_fib_index =
+ ip4_fib_table_find_or_create_and_lock (sm->outside_vrf_id);
+ }
+
key0.addr = ip0->dst_address;
key0.port = udp0->dst_port;
key0.protocol = proto0;