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) 55 in = clib_net_to_host_u32 (in);
70 return (VNET_API_ERROR_INVALID_VALUE);
73 static vl_api_gre_tunnel_type_t
91 out = clib_net_to_host_u32 (out);
108 if (itype[0] != itype[1])
110 rv = VNET_API_ERROR_INVALID_PROTOCOL;
116 rv = VNET_API_ERROR_SAME_SRC_DST;
127 a->instance = ntohl (mp->
tunnel.instance);
128 a->session_id = ntohs (mp->
tunnel.session_id);
129 a->outer_fib_id = ntohl (mp->
tunnel.outer_fib_id);
149 rmp->_vl_msg_id = htons (VL_API_GRE_TUNNEL_DETAILS);
154 rmp->
tunnel.outer_fib_id =
181 if (~0 == sw_if_index)
186 send_gre_tunnel_details(t, reg, mp->context);
209 #define vl_msg_name_crc_list 211 #undef vl_msg_name_crc_list 216 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 217 foreach_vl_msg_name_crc_gre;
227 vl_msg_api_set_handlers(VL_API_##N, #n, \ 228 vl_api_##n##_t_handler, \ 230 vl_api_##n##_t_endian, \ 231 vl_api_##n##_t_print, \ 232 sizeof(vl_api_##n##_t), 1); fib_protocol_t fp_proto
protocol type
static clib_error_t * gre_api_hookup(vlib_main_t *vm)
Transparent Ethernet Bridging - the tunnel is in L2 mode.
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 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)
enum gre_tunnel_type_t_ gre_tunnel_type_t
The GRE tunnel type.
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.
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)
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
ERSPAN type 2 - the tunnel is for port mirror SPAN output.
#define ip46_address_is_equal(a1, a2)
#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)
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.