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 clib_net_to_host_u16 (sess->in2out.port),
128 sess->in2out.fib_index);
129 s =
format (s,
" o2i %U proto %u fib %u\n",
131 clib_net_to_host_u16 (sess->out2in.port),
132 sess->out2in.fib_index);
143 s =
format (s,
" external host o2i %U:%d i2o %U:%d\n",
145 clib_net_to_host_u16 (sess->ext_host_port),
147 clib_net_to_host_u16 (sess->ext_host_nat_port));
151 if (sess->ext_host_addr.as_u32)
152 s =
format (s,
" external host %U:%u\n",
154 clib_net_to_host_u16 (sess->ext_host_port));
158 s =
format (s,
" last heard %.2f\n", sess->last_heard);
159 s =
format (s,
" total pkts %d, total bytes %lld\n",
160 sess->total_pkts, sess->total_bytes);
162 s =
format (s,
" static translation\n");
164 s =
format (s,
" dynamic translation\n");
166 s =
format (s,
" forwarding-bypass\n");
168 s =
format (s,
" load-balancing\n");
170 s =
format (s,
" twice-nat\n");
181 int verbose = va_arg (*args,
int);
183 u32 elt_index, head_index;
185 snat_session_t *sess;
187 s =
format (s,
"%U: %d dynamic translations, %d static translations\n",
198 elt_index = head->
next;
200 session_index = elt->
value;
202 while (session_index != ~0)
208 elt_index = elt->
next;
210 session_index = elt->
value;
226 s =
format (s,
"identity mapping %U",
229 s =
format (s,
"identity mapping %U %U:%d",
242 s =
format (s,
"local %U external %U vrf %d %s %s",
253 s =
format (s,
"%U external %U:%d %s %s",
260 s =
format (s,
"\n local %U:%d vrf %d probability %d\%",
265 s =
format (s,
"%U local %U:%d external %U:%d vrf %d %s %s",
284 s =
format (s,
"local %U external %U vrf %d",
288 s =
format (s,
"%U local %U:%d external %U:%d vrf %d",
302 u32 in_offset, out_offset;
304 u32 *
i = va_arg (*args,
u32 *);
308 clib_host_to_net_u32 (clib_net_to_host_u32 (det_map->
in_addr.
as_u32) +
311 clib_net_to_host_u32 (in_addr.
as_u32) -
315 clib_host_to_net_u32 (clib_net_to_host_u32 (det_map->
out_addr.
as_u32) +
319 "in %U:%d out %U:%d external host %U:%d state: %U expire: %d\n",
337 s =
format (s,
"NAT44_REASS: sw_if_index %d, next index %d, status %s",
339 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
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 vec_foreach(var, vec)
Vector iterator.
#define is_twice_nat_session(s)
Check if NAT session is twice NAT.
snat_session_t * sessions