26 u32 *r = va_arg (*args,
u32 *);
29 #define _(N, i, n, s) else if (unformat (input, s)) *r = NAT_PROTOCOL_##N; 45 #define _(N, j, n, str) case NAT_PROTOCOL_##N: t = (u8 *) str; break; 64 #define _(v, N, s) case NAT_ADDR_AND_PORT_ALLOC_ALG_##N: t = (u8 *) s; break; 87 s =
format (s,
"%U proto %U port %d fib %d",
90 clib_net_to_host_u16 (port), fib_index);
102 #define _(v, N, str) case SNAT_SESSION_##N: t = (u8 *) str; break; 106 t =
format (t,
"unknown");
117 snat_session_t *sess = va_arg (*args, snat_session_t *);
121 s =
format (s,
" i2o %U proto %u fib %u\n",
123 sess->in2out.port, sess->in2out.fib_index);
124 s =
format (s,
" o2i %U proto %u fib %u\n",
126 sess->out2in.port, sess->out2in.fib_index);
130 s =
format (s,
" i2o %U proto %U port %d fib %d\n",
133 clib_net_to_host_u16 (sess->in2out.port),
134 sess->in2out.fib_index);
135 s =
format (s,
" o2i %U proto %U port %d fib %d\n",
138 clib_net_to_host_u16 (sess->out2in.port),
139 sess->out2in.fib_index);
145 s =
format (s,
" external host o2i %U:%d i2o %U:%d\n",
147 clib_net_to_host_u16 (sess->ext_host_port),
149 clib_net_to_host_u16 (sess->ext_host_nat_port));
153 if (sess->ext_host_addr.as_u32)
154 s =
format (s,
" external host %U:%u\n",
156 clib_net_to_host_u16 (sess->ext_host_port));
160 s =
format (s,
" last heard %.2f\n", sess->last_heard);
161 s =
format (s,
" total pkts %d, total bytes %lld\n",
162 sess->total_pkts, sess->total_bytes);
164 s =
format (s,
" static translation\n");
166 s =
format (s,
" dynamic translation\n");
168 s =
format (s,
" forwarding-bypass\n");
170 s =
format (s,
" load-balancing\n");
172 s =
format (s,
" twice-nat\n");
183 int verbose = va_arg (*args,
int);
185 u32 elt_index, head_index;
187 snat_session_t *sess;
189 s =
format (s,
"%U: %d dynamic translations, %d static translations\n",
200 elt_index = head->
next;
202 session_index = elt->
value;
204 while (session_index != ~0)
210 elt_index = elt->
next;
212 session_index = elt->
value;
228 s =
format (s,
"identity mapping %U",
231 s =
format (s,
"identity mapping %U %U:%d",
247 s =
format (s,
"local %U external %U vrf %d %s %s",
258 s =
format (s,
"%U external %U:%d %s %s",
269 s =
format (s,
"\n local %U:%d vrf %d probability %d\%",
271 clib_net_to_host_u16 (local->
port),
278 s =
format (s,
"%U local %U:%d external %U:%d vrf %d %s %s",
299 s =
format (s,
"local %U external %U vrf %d",
303 s =
format (s,
"%U local %U:%d external %U:%d vrf %d",
306 clib_net_to_host_u16 (m->
l_port),
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 pool_foreach(VAR, POOL)
Iterate through pool.
#define is_ed_session(s)
Check if NAT session is endpoint dependent.
vl_api_ip_proto_t protocol
#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
static void split_nat_key(u64 key, ip4_address_t *addr, u16 *port, u32 *fib_index, nat_protocol_t *proto)
description fragment has unexpected format
#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
#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