66 return VNET_API_ERROR_VALUE_EXIST;
69 if (!found && !is_add)
70 return VNET_API_ERROR_NO_SUCH_ENTRY;
74 u32 num_sessions = (1 << (32 - in_plen));
75 if (num_sessions > UINT32_MAX / 1000)
78 return VNET_API_ERROR_INVALID_VALUE;
82 num_sessions = num_sessions * 1000 - 1;
85 u32 sharing_ratio = (1 << (32 - in_plen)) / (1 << (32 - out_plen));
89 return VNET_API_ERROR_INVALID_VALUE;
102 empty_snat_det_session);
114 if (nat_interface_is_inside(i))
117 snat_add_del_addr_to_fib(out_addr, out_plen, i->sw_if_index, is_add);
145 vec_foreach(ses, dm->sessions)
148 if (ses->in_port && (ses->expire < now))
149 snat_det_ses_close (dm, ses);
165 "nat-det-expire-walk",
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
static vlib_node_registration_t snat_det_expire_walk_node
(constructor) VLIB_REGISTER_NODE (snat_det_expire_walk_node)
snat_det_map_t * det_maps
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
snat_det_session_t * sessions
#define vec_del1(v, i)
Delete the element at index I.
#define VLIB_REGISTER_NODE(x,...)
#define vec_free(V)
Free vector's memory (no header).
deterministic NAT definitions
int snat_det_add_map(snat_main_t *sm, ip4_address_t *in_addr, u8 in_plen, ip4_address_t *out_addr, u8 out_plen, int is_add)
Add/delete deterministic NAT mapping.
struct _vlib_node_registration vlib_node_registration_t
ip4_main_t ip4_main
Global ip4 main structure.
#define vec_foreach(var, vec)
Vector iterator.
static uword snat_det_expire_walk_fn(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
The 'nat-det-expire-walk' process's main loop.
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
snat_interface_t * interfaces