27 u32 *r = va_arg (*args,
u32 *);
30 #define _(N, i, n, s) else if (unformat (input, s)) *r = NAT_PROTOCOL_##N; 46 #define _(N, j, n, str) case NAT_PROTOCOL_##N: t = (u8 *) str; break; 65 #define _(v, N, s) case NAT_ADDR_AND_PORT_ALLOC_ALG_##N: t = (u8 *) s; break; 81 s =
format (s,
"%U proto %U port %d fib %d",
93 s =
format (s,
"%U proto %U port %d fib %d",
107 #define _(v, N, str) case SNAT_SESSION_##N: t = (u8 *) str; break; 111 t =
format (t,
"unknown");
122 snat_session_t *sess = va_arg (*args, snat_session_t *);
126 s =
format (s,
" i2o %U proto %u fib %u\n",
128 sess->in2out.port, sess->in2out.fib_index);
129 s =
format (s,
" o2i %U proto %u fib %u\n",
131 sess->out2in.port, sess->out2in.fib_index);
142 s =
format (s,
" external host o2i %U:%d i2o %U:%d\n",
144 clib_net_to_host_u16 (sess->ext_host_port),
146 clib_net_to_host_u16 (sess->ext_host_nat_port));
150 if (sess->ext_host_addr.as_u32)
151 s =
format (s,
" external host %U:%u\n",
153 clib_net_to_host_u16 (sess->ext_host_port));
157 s =
format (s,
" last heard %.2f\n", sess->last_heard);
158 s =
format (s,
" total pkts %d, total bytes %lld\n",
159 sess->total_pkts, sess->total_bytes);
161 s =
format (s,
" static translation\n");
163 s =
format (s,
" dynamic translation\n");
165 s =
format (s,
" forwarding-bypass\n");
167 s =
format (s,
" load-balancing\n");
169 s =
format (s,
" twice-nat\n");
180 int verbose = va_arg (*args,
int);
182 u32 elt_index, head_index;
184 snat_session_t *sess;
186 s =
format (s,
"%U: %d dynamic translations, %d static translations\n",
197 elt_index = head->
next;
199 session_index = elt->
value;
201 while (session_index != ~0)
207 elt_index = elt->
next;
209 session_index = elt->
value;
225 s =
format (s,
"identity mapping %U",
228 s =
format (s,
"identity mapping %U %U:%d",
235 s = format (s,
" vrf %d", local->vrf_id);
243 s =
format (s,
"local %U external %U vrf %d %s %s",
254 s =
format (s,
"%U external %U:%d %s %s",
264 s = format (s,
"\n local %U:%d vrf %d probability %d\%",
265 format_ip4_address, &local->addr, local->port,
266 local->vrf_id, local->probability);
272 s =
format (s,
"%U local %U:%d external %U:%d vrf %d %s %s",
291 s =
format (s,
"local %U external %U vrf %d",
295 s =
format (s,
"%U local %U:%d external %U:%d vrf %d",
309 u32 in_offset, out_offset;
311 u32 *
i = va_arg (*args,
u32 *);
315 clib_host_to_net_u32 (clib_net_to_host_u32 (det_map->
in_addr.
as_u32) +
318 clib_net_to_host_u32 (in_addr.
as_u32) -
322 clib_host_to_net_u32 (clib_net_to_host_u32 (det_map->
out_addr.
as_u32) +
326 "in %U:%d out %U:%d external host %U:%d state: %U expire: %d\n",
ip4_address_t external_addr
#define snat_is_session_static(s)
Check if SNAT session is created from static mapping.
u32 sessions_per_user_list_head_index
vnet_main_t * vnet_get_main(void)
#define is_ed_session(s)
Check if NAT session is endpoint dependent.
#define snat_is_unk_proto_session(s)
Check if SNAT session for unknown protocol.
format_function_t format_vnet_sw_if_index_name
nat44_lb_addr_port_t * locals
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
ip4_address_t ext_host_addr
#define SNAT_DET_SES_PER_USER
#define is_fwd_bypass_session(s)
Check if NAT session is forwarding bypass.
twice_nat_type_t twice_nat
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define is_lb_session(s)
Check if NAT session is load-balancing.
sll srl srl sll sra u16x4 i
deterministic NAT definitions
#define is_addr_only_static_mapping(sm)
Check if NAT static mapping is address only (1:1NAT).
#define is_identity_static_mapping(sm)
Check if NAT static mapping is identity NAT.
#define is_lb_static_mapping(sm)
Check if NAT static mapping is load-balancing.
#define is_out2in_only_static_mapping(sm)
Check if NAT static mapping match only out2in direction.
#define is_twice_nat_session(s)
Check if NAT session is twice NAT.
snat_session_t * sessions