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);
126 &sess->out2in.addr, 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",
137 sess->nat_proto, clib_net_to_host_u16 (sess->out2in.port),
138 sess->out2in.fib_index);
144 s =
format (s,
" external host o2i %U:%d i2o %U:%d\n",
146 clib_net_to_host_u16 (sess->ext_host_port),
148 clib_net_to_host_u16 (sess->ext_host_nat_port));
152 if (sess->ext_host_addr.as_u32)
153 s =
format (s,
" external host %U:%u\n",
155 clib_net_to_host_u16 (sess->ext_host_port));
161 s =
format (s,
" last heard %.2f\n", sess->last_heard);
162 s =
format (s,
" total pkts %d, total bytes %lld\n",
163 sess->total_pkts, sess->total_bytes);
165 s =
format (s,
" static translation\n");
167 s =
format (s,
" dynamic translation\n");
169 s =
format (s,
" forwarding-bypass\n");
171 s =
format (s,
" load-balancing\n");
173 s =
format (s,
" twice-nat\n");
186 s =
format (s,
"identity mapping %U",
189 s =
format (s,
"identity mapping %U %U:%d",
205 s =
format (s,
"local %U external %U vrf %d %s %s",
216 s =
format (s,
"%U external %U:%d %s %s",
227 s =
format (s,
"\n local %U:%d vrf %d probability %d\%",
229 clib_net_to_host_u16 (local->
port),
236 s =
format (s,
"%U local %U:%d external %U:%d vrf %d %s %s",
257 s =
format (s,
"local %U external %U vrf %d",
261 s =
format (s,
"%U local %U:%d external %U:%d vrf %d",
264 clib_net_to_host_u16 (m->
l_port),
ip4_address_t external_addr
#define snat_is_unk_proto_session(s)
Check if SNAT session for unknown protocol.
vnet_hw_if_output_node_runtime_t * r
#define pool_foreach(VAR, POOL)
Iterate through pool.
vl_api_ip_proto_t protocol
#define is_twice_nat_session(s)
Check if NAT session is twice NAT.
#define snat_is_session_static(s)
Check if SNAT session is created from static mapping.
static void split_nat_key(u64 key, ip4_address_t *addr, u16 *port, u32 *fib_index, nat_protocol_t *proto)
format_function_t format_vnet_sw_if_index_name
nat44_lb_addr_port_t * locals
description fragment has unexpected format
vnet_main_t * vnet_get_main(void)
#define is_addr_only_static_mapping(sm)
Check if NAT static mapping is address only (1:1NAT).
twice_nat_type_t twice_nat
#define is_fwd_bypass_session(s)
Check if NAT session is forwarding bypass.
#define is_identity_static_mapping(sm)
Check if NAT static mapping is identity NAT.
#define is_out2in_only_static_mapping(sm)
Check if NAT static mapping match only out2in direction.
format_function_t format_nat_6t_flow
sll srl srl sll sra u16x4 i
#define is_ed_session(s)
Check if NAT session is endpoint dependent.
#define is_lb_session(s)
Check if NAT session is load-balancing.
#define is_lb_static_mapping(sm)
Check if NAT static mapping is load-balancing.
snat_session_t * sessions