26 u32 start_host_order, end_host_order;
42 end_addr = start_addr;
43 else if (
unformat (line_input,
"del"))
53 start_host_order = clib_host_to_net_u32 (start_addr.
as_u32);
54 end_host_order = clib_host_to_net_u32 (end_addr.
as_u32);
56 if (end_host_order < start_host_order)
62 count = (end_host_order - start_host_order) + 1;
63 this_addr = start_addr;
65 for (i = 0; i <
count; i++)
71 case VNET_API_ERROR_NO_SUCH_ENTRY:
76 case VNET_API_ERROR_VALUE_EXIST:
145 "Set DS-Lite AFTR tunnel endpoint address failed.");
217 dslite_session_t *session = va_arg (*args, dslite_session_t *);
220 s =
format (s,
"%Uin %U:%u out %U:%u protocol %U\n",
223 clib_net_to_host_u16 (session->in2out.port),
225 clib_net_to_host_u16 (session->out2in.port),
227 s =
format (s,
"%Utotal pkts %d, total bytes %lld\n",
229 session->total_pkts, session->total_bytes);
239 u32 elt_index, head_index;
241 dslite_session_t *session;
252 elt_index = head->
next;
254 session_index = elt->
value;
255 while (session_index != ~0)
259 elt_index = elt->
next;
261 session_index = elt->
value;
281 vlib_cli_output (vm,
"%U", format_dslite_b4, td, b4);
302 .path =
"dslite add pool address",
303 .short_help =
"dslite add pool address <ip4-range-start> [- <ip4-range-end>] " 321 .path =
"show dslite pool",
322 .short_help =
"show dslite pool",
335 .path =
"dslite set aftr-tunnel-endpoint-address",
336 .short_help =
"dslite set aftr-tunnel-endpoint-address <ip6>",
349 .path =
"show dslite aftr-tunnel-endpoint-address",
350 .short_help =
"show dslite aftr-tunnel-endpoint-address",
363 .path =
"dslite set b4-tunnel-endpoint-address",
364 .short_help =
"dslite set b4-tunnel-endpoint-address <ip6>",
377 .path =
"show dslite b4-tunnel-endpoint-address",
378 .short_help =
"show dslite b4-tunnel-endpoint-address",
398 .path =
"show dslite sessions",
399 .short_help =
"show dslite sessions",
static u8 * format_dslite_session(u8 *s, va_list *args)
static clib_error_t * dslite_show_aftr_ip6_addr_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
ip6_address_t b4_ip6_addr
#define clib_error_return(e, args...)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static clib_error_t * dslite_set_b4_tunnel_addr_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
snat_address_t * addr_pool
int dslite_add_del_pool_addr(dslite_main_t *dm, ip4_address_t *addr, u8 is_add)
ip6_address_t aftr_ip6_addr
dslite_main_t dslite_main
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * dslite_add_del_pool_addr_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * dslite_show_sessions_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * dslite_show_pool_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * dslite_set_aftr_tunnel_addr_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
format_function_t format_snat_protocol
dslite_per_thread_data_t * per_thread_data
void increment_v4_address(ip4_address_t *a)
Increment IPv4 address.
static u8 * format_dslite_b4(u8 *s, va_list *args)
int dslite_set_b4_ip6_addr(dslite_main_t *dm, ip6_address_t *addr)
dslite_session_t * sessions
#define vec_foreach(var, vec)
Vector iterator.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
int dslite_set_aftr_ip6_addr(dslite_main_t *dm, ip6_address_t *addr)
u32 sessions_per_b4_list_head_index
static clib_error_t * dslite_show_b4_ip6_addr_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)