42 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 49 #define foreach_vpe_api_msg \ 50 _(GRE_TUNNEL_ADD_DEL, gre_tunnel_add_del) \ 51 _(GRE_TUNNEL_DUMP, gre_tunnel_dump) 59 case GRE_API_TUNNEL_TYPE_##n: \ 60 *out = GRE_TUNNEL_TYPE_##n; \ 66 return (VNET_API_ERROR_INVALID_VALUE);
69 static vl_api_gre_tunnel_type_t
77 case GRE_TUNNEL_TYPE_##n: \ 78 out = GRE_API_TUNNEL_TYPE_##n; \ 100 if (itype[0] != itype[1])
102 rv = VNET_API_ERROR_INVALID_PROTOCOL;
108 rv = VNET_API_ERROR_SAME_SRC_DST;
129 a->instance = ntohl (mp->
tunnel.instance);
131 a->outer_table_id = ntohl (mp->
tunnel.outer_table_id);
152 rmp->_vl_msg_id = htons (VL_API_GRE_TUNNEL_DETAILS);
157 rmp->
tunnel.outer_table_id =
186 if (~0 == sw_if_index)
191 send_gre_tunnel_details(t, reg, mp->context);
214 #define vl_msg_name_crc_list 216 #undef vl_msg_name_crc_list 221 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 222 foreach_vl_msg_name_crc_gre;
232 vl_msg_api_set_handlers(VL_API_##N, #n, \ 233 vl_api_##n##_t_handler, \ 235 vl_api_##n##_t_endian, \ 236 vl_api_##n##_t_print, \ 237 sizeof(vl_api_##n##_t), 1); fib_protocol_t fp_proto
protocol type
static clib_error_t * gre_api_hookup(vlib_main_t *vm)
vl_api_wireguard_peer_flags_t flags
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)
Dump details of all or just a single GRE tunnel.
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.
Details response for one of the requested GRE tunnels.
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)
Decode/Encode for struct/union types.
A representation of a GRE tunnel.
Add or delete a single 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.
int tunnel_mode_decode(vl_api_tunnel_mode_t in, tunnel_mode_t *out)
enum tunnel_encap_decap_flags_t_ tunnel_encap_decap_flags_t
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)
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)
vl_api_tunnel_mode_t tunnel_mode_encode(tunnel_mode_t in)
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
Add or delete a single GRE tunnel.
#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.
int tunnel_encap_decap_flags_decode(vl_api_tunnel_encap_decap_flags_t f, tunnel_encap_decap_flags_t *o)
Conversion functions to/from (decode/encode) API types to VPP internal types.
u16 session_id
ERSPAN type 2 session ID, least significant 10 bits of u16.
vl_api_interface_index_t sw_if_index