31 bool ip4_set =
false, ip6_set =
false;
38 if (
unformat(line_input,
"instance %d", &instance))
52 }
else if (
unformat(line_input,
"outer-fib-id %d", &fib_index))
65 if (ip4_set && ip6_set) {
66 error =
clib_error_return(0,
"source and destination must be of same address family");
82 case VNET_API_ERROR_IF_ALREADY_EXISTS:
85 case VNET_API_ERROR_NO_SUCH_FIB:
88 case VNET_API_ERROR_NO_SUCH_ENTRY:
91 case VNET_API_ERROR_INSTANCE_IN_USE:
111 u32 sw_if_index = ~0;
119 if (
unformat(line_input,
"sw_if_index %d", &sw_if_index))
128 if (num_m_args < 1) {
134 printf(
"RV %d\n", rv);
144 .path =
"create ipip tunnel",
145 .short_help =
"create ipip tunnel src <addr> dst <addr> [instance <n>] " 146 "[outer-fib-id <fib>]",
150 .path =
"delete ipip tunnel",
151 .short_help =
"delete ipip tunnel sw_if_index <sw_if_index ",
162 s =
format(s,
"[%d] 6rd src %U ip6-pfx %U/%d fib-idx %d sw-if-idx %d ",
170 s =
format(s,
"[%d] instance %d src %U dst %U fib-idx %d sw-if-idx %d ",
201 ({vlib_cli_output(vm,
"%U", format_ipip_tunnel, t); }));
213 .path =
"show ipip tunnel",
225 u32 ip6_prefix_len = 0, ip4_prefix_len = 0, sixrd_tunnel_index;
230 bool security_check =
false;
236 if (
unformat(line_input,
"security-check"))
237 security_check =
true;
239 &ip6_prefix, &ip6_prefix_len))
242 &ip4_prefix, &ip4_prefix_len))
246 else if (
unformat(line_input,
"fib-id %d", &fib_index))
255 if (num_m_args < 3) {
260 ip4_prefix_len, &ip4_src, security_check,
261 fib_index, &sixrd_tunnel_index);
278 u32 sw_if_index = ~0;
284 if (
unformat(line_input,
"sw_if_index %d", &sw_if_index))
293 if (num_m_args < 1) {
298 printf(
"RV %d\n", rv);
308 .path =
"create 6rd tunnel",
309 .short_help =
"create 6rd tunnel ip6-pfx <ip6-pfx> ip4-pfx <ip4-pfx> " 310 "ip4-src <ip4-addr> [del]",
314 .path =
"delete 6rd tunnel",
315 .short_help =
"delete 6rd tunnel sw_if_index <sw_if_index",
static clib_error_t * create_ipip_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * show_ipip_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
A representation of a IPIP tunnel.
vnet_main_t * vnet_get_main(void)
ip46_address_t tunnel_src
static clib_error_t * delete_ipip_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
format_function_t format_vnet_sw_if_index_name
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define clib_error_return(e, args...)
static clib_error_t * create_sixrd_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
int sixrd_add_tunnel(ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip4_address_t *ip4_src, bool security_check, u32 fib_index, u32 *sw_if_index)
static u8 * format_ipip_tunnel(u8 *s, va_list *args)
int sixrd_del_tunnel(u32 sw_if_index)
#define ip46_address_initializer
static clib_error_t * delete_sixrd_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int ipip_add_tunnel(ipip_transport_t transport, u32 instance, ip46_address_t *src, ip46_address_t *dst, u32 fib_index, u32 *sw_if_indexp)
struct ipip_tunnel_t::@225::@228 sixrd
#define VLIB_CLI_COMMAND(x,...)
ipip_transport_t transport
int ipip_del_tunnel(u32 sw_if_index)
ip46_address_t tunnel_dst
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static uword pool_elts(void *v)
Number of active elements in a pool.