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;
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;
snat_interface_t *interface;
int i;
- /* If outside FIB index is not resolved yet */
- if (sm->outside_fib_index == ~0)
- {
- p = hash_get (sm->ip4_main->fib_index_by_table_id, sm->outside_vrf_id);
- if (!p)
- return VNET_API_ERROR_NO_SUCH_FIB;
- sm->outside_fib_index = p[0];
- }
-
/* If the external address is a specific interface address */
if (sw_if_index != ~0)
{
/* If not specified use inside VRF id from SNAT plugin startup config */
else
{
- if (sm->inside_fib_index == ~0)
- {
- p = hash_get (sm->ip4_main->fib_index_by_table_id, sm->inside_vrf_id);
- if (!p)
- return VNET_API_ERROR_NO_SUCH_FIB;
- fib_index = p[0];
- sm->inside_fib_index = fib_index;
- }
- else
- fib_index = sm->inside_fib_index;
-
+ fib_index = sm->inside_fib_index;
vrf_id = sm->inside_vrf_id;
}
sm->user_memory_size = user_memory_size;
sm->max_translations_per_user = max_translations_per_user;
sm->outside_vrf_id = outside_vrf_id;
- sm->outside_fib_index = ~0;
+ sm->outside_fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4,
+ outside_vrf_id);
sm->inside_vrf_id = inside_vrf_id;
- sm->inside_fib_index = ~0;
+ sm->inside_fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4,
+ inside_vrf_id);
sm->static_mapping_only = static_mapping_only;
sm->static_mapping_connection_tracking = static_mapping_connection_tracking;