26 u32 *r = va_arg (*args,
u32 *);
29 #define _(N, i, n, s) else if (unformat (input, s)) *r = SNAT_PROTOCOL_##N; 45 #define _(N, j, n, str) case SNAT_PROTOCOL_##N: t = (u8 *) str; break; 64 #define _(v, N, s) case NAT_ADDR_AND_PORT_ALLOC_ALG_##N: t = (u8 *) s; break; 80 s =
format (s,
"%U proto %U port %d fib %d",
92 s =
format (s,
"%U proto %U port %d fib %d",
106 #define _(v, N, str) case SNAT_SESSION_##N: t = (u8 *) str; break; 110 t =
format (t,
"unknown");
121 snat_session_t *sess = va_arg (*args, snat_session_t *);
125 s =
format (s,
" i2o %U proto %u fib %u\n",
127 sess->in2out.port, sess->in2out.fib_index);
128 s =
format (s,
" o2i %U proto %u fib %u\n",
130 sess->out2in.port, sess->out2in.fib_index);
141 s =
format (s,
" external host o2i %U:%d i2o %U:%d\n",
143 clib_net_to_host_u16 (sess->ext_host_port),
145 clib_net_to_host_u16 (sess->ext_host_nat_port));
149 if (sess->ext_host_addr.as_u32)
150 s =
format (s,
" external host %U:%u\n",
152 clib_net_to_host_u16 (sess->ext_host_port));
156 s =
format (s,
" last heard %.2f\n", sess->last_heard);
157 s =
format (s,
" total pkts %d, total bytes %lld\n",
158 sess->total_pkts, sess->total_bytes);
160 s =
format (s,
" static translation\n");
162 s =
format (s,
" dynamic translation\n");
164 s =
format (s,
" forwarding-bypass\n");
166 s =
format (s,
" load-balancing\n");
168 s =
format (s,
" twice-nat\n");
179 int verbose = va_arg (*args,
int);
181 u32 elt_index, head_index;
183 snat_session_t *sess;
185 s =
format (s,
"%U: %d dynamic translations, %d static translations\n",
196 elt_index = head->
next;
198 session_index = elt->
value;
200 while (session_index != ~0)
206 elt_index = elt->
next;
208 session_index = elt->
value;
224 s =
format (s,
"identity mapping %U",
227 s =
format (s,
"identity mapping %U %U:%d",
234 s = format (s,
" vrf %d", local->vrf_id);
242 s =
format (s,
"local %U external %U vrf %d %s %s",
253 s =
format (s,
"%U external %U:%d %s %s",
263 s = format (s,
"\n local %U:%d vrf %d probability %d\%",
264 format_ip4_address, &local->addr, local->port,
265 local->vrf_id, local->probability);
271 s =
format (s,
"%U local %U:%d external %U:%d vrf %d %s %s",
290 s =
format (s,
"local %U external %U vrf %d",
294 s =
format (s,
"%U local %U:%d external %U:%d vrf %d",
308 u32 in_offset, out_offset;
310 u32 *
i = va_arg (*args,
u32 *);
314 clib_host_to_net_u32 (clib_net_to_host_u32 (det_map->
in_addr.
as_u32) +
317 clib_net_to_host_u32 (in_addr.
as_u32) -
321 clib_host_to_net_u32 (clib_net_to_host_u32 (det_map->
out_addr.
as_u32) +
325 "in %U:%d out %U:%d external host %U:%d state: %U expire: %d\n",
343 s =
format (s,
"NAT44_REASS: sw_if_index %d, next index %d, status %s",
345 t->
cached ?
"cached" :
"translated");
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.
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