41 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 48 #define foreach_vpe_api_msg \ 49 _(GRE_TUNNEL_ADD_DEL, gre_tunnel_add_del) \ 50 _(GRE_TUNNEL_DUMP, gre_tunnel_dump) 58 case GRE_API_TUNNEL_TYPE_##n: \ 59 *out = GRE_TUNNEL_TYPE_##n; \ 65 return (VNET_API_ERROR_INVALID_VALUE);
68 static vl_api_gre_tunnel_type_t
76 case GRE_TUNNEL_TYPE_##n: \ 77 out = GRE_API_TUNNEL_TYPE_##n; \ 92 case GRE_API_TUNNEL_MODE_##n: \ 93 *out = GRE_TUNNEL_MODE_##n; \ 99 return (VNET_API_ERROR_INVALID_VALUE_2);
102 static vl_api_gre_tunnel_mode_t
110 case GRE_TUNNEL_MODE_##n: \ 111 out = GRE_API_TUNNEL_MODE_##n; \ 132 if (itype[0] != itype[1])
134 rv = VNET_API_ERROR_INVALID_PROTOCOL;
140 rv = VNET_API_ERROR_SAME_SRC_DST;
156 a->instance = ntohl (mp->
tunnel.instance);
157 a->session_id = ntohs (mp->
tunnel.session_id);
158 a->outer_table_id = ntohl (mp->
tunnel.outer_table_id);
178 rmp->_vl_msg_id = htons (VL_API_GRE_TUNNEL_DETAILS);
183 rmp->
tunnel.outer_table_id =
212 if (~0 == sw_if_index)
217 send_gre_tunnel_details(t, reg, mp->context);
240 #define vl_msg_name_crc_list 242 #undef vl_msg_name_crc_list 247 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 248 foreach_vl_msg_name_crc_gre;
258 vl_msg_api_set_handlers(VL_API_##N, #n, \ 259 vl_api_##n##_t_handler, \ 261 vl_api_##n##_t_endian, \ 262 vl_api_##n##_t_print, \ 263 sizeof(vl_api_##n##_t), 1); fib_protocol_t fp_proto
protocol type
static clib_error_t * gre_api_hookup(vlib_main_t *vm)
static int gre_tunnel_type_decode(vl_api_gre_tunnel_type_t in, gre_tunnel_type_t *out)
#define REPLY_MACRO2(t, body)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
VLIB_API_INIT_FUNCTION(gre_api_hookup)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
int vnet_gre_tunnel_add_del(vnet_gre_tunnel_add_del_args_t *a, u32 *sw_if_indexp)
u32 outer_fib_index
The FIB in which the src.dst address are present.
static int gre_tunnel_mode_decode(vl_api_gre_tunnel_mode_t in, gre_tunnel_mode_t *out)
static vl_api_gre_tunnel_type_t gre_tunnel_type_encode(gre_tunnel_type_t in)
void * vl_msg_api_alloc(int nbytes)
u32 * tunnel_index_by_sw_if_index
Mapping from sw_if_index to tunnel index.
static void vl_api_gre_tunnel_dump_t_handler(vl_api_gre_tunnel_dump_t *mp)
vl_api_interface_index_t sw_if_index
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vl_api_interface_index_t sw_if_index
ip46_address_t tunnel_src
The tunnel's source/local address.
ip46_type_t ip_address_decode(const vl_api_address_t *in, ip46_address_t *out)
A representation of a GRE tunnel.
static void send_gre_tunnel_details(gre_tunnel_t *t, vl_api_registration_t *reg, u32 context)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
static u8 ip46_address_is_equal(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
API main structure, used by both vpp and binary API clients.
vl_api_gre_tunnel_t tunnel
An API client registration, only in vpp/vlib.
vl_api_gre_tunnel_t tunnel
static void setup_message_id_table(api_main_t *am)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static vl_api_gre_tunnel_mode_t gre_tunnel_mode_encode(gre_tunnel_mode_t in)
vl_api_interface_index_t sw_if_index
static void vl_api_gre_tunnel_add_del_t_handler(vl_api_gre_tunnel_add_del_t *mp)
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
gre_tunnel_t * tunnels
pool of tunnel instances
enum gre_tunnel_mode_t_ gre_tunnel_mode_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define foreach_vpe_api_msg
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
static api_main_t * vlibapi_get_main(void)
enum gre_tunnel_type_t_ gre_tunnel_type_t
The GRE tunnel type.
fib_prefix_t tunnel_dst
The tunnel's destination/remote address.
u16 session_id
ERSPAN type 2 session ID, least significant 10 bits of u16.