33 bool ip4_set =
false, ip6_set =
false;
40 if (
unformat(line_input,
"instance %d", &instance))
54 }
else if (
unformat(line_input,
"outer-table-id %d", &table_id))
67 if (ip4_set && ip6_set) {
68 error =
clib_error_return(0,
"source and destination must be of same address family");
76 rv = VNET_API_ERROR_NO_SUCH_FIB;
85 IPIP_TUNNEL_FLAG_NONE,
95 case VNET_API_ERROR_IF_ALREADY_EXISTS:
98 case VNET_API_ERROR_NO_SUCH_FIB:
101 case VNET_API_ERROR_NO_SUCH_ENTRY:
104 case VNET_API_ERROR_INSTANCE_IN_USE:
132 if (
unformat(line_input,
"sw_if_index %d", &sw_if_index))
141 if (num_m_args < 1) {
147 printf(
"RV %d\n", rv);
157 .path =
"create ipip tunnel",
158 .short_help =
"create ipip tunnel src <addr> dst <addr> [instance <n>] " 159 "[outer-table-id <ID>]",
163 .path =
"delete ipip tunnel",
164 .short_help =
"delete ipip tunnel sw_if_index <sw_if_index>",
179 s =
format(s,
"[%d] 6rd src %U ip6-pfx %U/%d ",
186 s =
format(s,
"[%d] instance %d src %U dst %U ",
193 s =
format(s,
"table-ID %d sw-if-idx %d flags [%U] dscp %U",
221 ({vlib_cli_output(vm,
"%U", format_ipip_tunnel, t); }));
233 .path =
"show ipip tunnel",
245 u32 ip6_prefix_len = 0, ip4_prefix_len = 0, sixrd_tunnel_index;
251 bool security_check =
false;
258 if (
unformat(line_input,
"security-check"))
259 security_check =
true;
261 &ip6_prefix, &ip6_prefix_len))
264 &ip4_prefix, &ip4_prefix_len))
268 else if (
unformat(line_input,
"ip4-table-id %d", &ip4_table_id))
270 else if (
unformat(line_input,
"ip6-table-id %d", &ip6_table_id))
279 if (num_m_args < 3) {
286 if (~0 == ip4_fib_index)
289 rv = VNET_API_ERROR_NO_SUCH_FIB;
291 else if (~0 == ip6_fib_index)
294 rv = VNET_API_ERROR_NO_SUCH_FIB;
299 ip4_prefix_len, &ip4_src, security_check,
300 ip4_fib_index, ip6_fib_index,
301 &sixrd_tunnel_index);
326 if (
unformat(line_input,
"sw_if_index %d", &sw_if_index))
335 if (num_m_args < 1) {
340 printf(
"RV %d\n", rv);
350 .path =
"create 6rd tunnel",
351 .short_help =
"create 6rd tunnel ip6-pfx <ip6-pfx> ip4-pfx <ip4-pfx> " 352 "ip4-src <ip4-addr> ip4-table-id <ID> ip6-table-id <ID> " 357 .path =
"delete 6rd tunnel",
358 .short_help =
"delete 6rd tunnel sw_if_index <sw_if_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 ip4_fib_index, u32 ip6_fib_index, u32 *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)
u8 * format_ipip_tunnel_flags(u8 *s, va_list *args)
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
int ipip_add_tunnel(ipip_transport_t transport, u32 instance, ip46_address_t *src, ip46_address_t *dst, u32 fib_index, ipip_tunnel_flags_t flags, ip_dscp_t dscp, u32 *sw_if_indexp)
ipip_tunnel_flags_t flags
static clib_error_t * delete_ipip_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
manual_print typedef ip4_prefix
format_function_t format_vnet_sw_if_index_name
manual_print typedef ip6_prefix
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vl_api_interface_index_t sw_if_index
#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)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u8 * format_ip_dscp(u8 *s, va_list *va)
vl_api_fib_path_type_t type
fib_protocol_t fib_proto_from_ip46(ip46_type_t iproto)
Convert from ip46_type to fib_protocol.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static u8 * format_ipip_tunnel(u8 *s, va_list *args)
int sixrd_del_tunnel(u32 sw_if_index)
format_function_t format_ip46_address
static clib_error_t * delete_sixrd_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CLI_COMMAND(x,...)
ipip_transport_t transport
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
static fib_protocol_t fib_ip_proto(bool is_ip6)
Convert from boolean is_ip6 to FIB protocol.
int ipip_del_tunnel(u32 sw_if_index)
struct ipip_tunnel_t::@338 sixrd
ip46_address_t tunnel_dst
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define ip46_address_initializer
static uword pool_elts(void *v)
Number of active elements in a pool.