43 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 50 #define foreach_vpe_api_msg \ 51 _ (BFD_UDP_ADD, bfd_udp_add) \ 52 _ (BFD_UDP_MOD, bfd_udp_mod) \ 53 _ (BFD_UDP_DEL, bfd_udp_del) \ 54 _ (BFD_UDP_SESSION_DUMP, bfd_udp_session_dump) \ 55 _ (BFD_UDP_SESSION_SET_FLAGS, bfd_udp_session_set_flags) \ 56 _ (WANT_BFD_EVENTS, want_bfd_events) \ 57 _ (BFD_AUTH_SET_KEY, bfd_auth_set_key) \ 58 _ (BFD_AUTH_DEL_KEY, bfd_auth_del_key) \ 59 _ (BFD_AUTH_KEYS_DUMP, bfd_auth_keys_dump) \ 60 _ (BFD_UDP_AUTH_ACTIVATE, bfd_udp_auth_activate) \ 61 _ (BFD_UDP_AUTH_DEACTIVATE, bfd_udp_auth_deactivate) \ 62 _ (BFD_UDP_SET_ECHO_SOURCE, bfd_udp_set_echo_source) \ 63 _ (BFD_UDP_DEL_ECHO_SOURCE, bfd_udp_del_echo_source) 67 #define BFD_UDP_API_PARAM_COMMON_CODE \ 68 ip46_address_t local_addr; \ 69 memset (&local_addr, 0, sizeof (local_addr)); \ 70 ip46_address_t peer_addr; \ 71 memset (&peer_addr, 0, sizeof (peer_addr)); \ 74 clib_memcpy (&local_addr.ip6, mp->local_addr, sizeof (local_addr.ip6)); \ 75 clib_memcpy (&peer_addr.ip6, mp->peer_addr, sizeof (peer_addr.ip6)); \ 79 clib_memcpy (&local_addr.ip4, mp->local_addr, sizeof (local_addr.ip4)); \ 80 clib_memcpy (&peer_addr.ip4, mp->peer_addr, sizeof (peer_addr.ip4)); \ 83 #define BFD_UDP_API_PARAM_FROM_MP(mp) \ 84 clib_net_to_host_u32 (mp->sw_if_index), &local_addr, &peer_addr 89 vl_api_bfd_udp_add_reply_t *rmp;
110 vl_api_bfd_udp_mod_reply_t *rmp;
129 vl_api_bfd_udp_del_reply_t *rmp;
146 if (bs->
transport != BFD_TRANSPORT_UDP4 &&
153 memset (mp, 0,
sizeof (*mp));
154 mp->_vl_msg_id = ntohs (VL_API_BFD_UDP_SESSION_DETAILS);
158 bfd_udp_key_t *key = &bus->
key;
159 mp->
sw_if_index = clib_host_to_net_u32 (key->sw_if_index);
179 sizeof (key->local_addr));
185 sizeof (key->local_addr.ip4.data));
187 sizeof (key->peer_addr.ip4.data));
205 q = vl_api_client_index_to_input_queue (reg->client_index);
208 switch (bs->transport)
210 case BFD_TRANSPORT_UDP4:
212 case BFD_TRANSPORT_UDP6:
213 send_bfd_udp_session_details (q, 0, bs);
233 if (bs->transport == BFD_TRANSPORT_UDP4 ||
234 bs->transport == BFD_TRANSPORT_UDP6)
235 send_bfd_udp_session_details (q, mp->context, bs);
244 vl_api_bfd_udp_session_set_flags_reply_t *rmp;
252 REPLY_MACRO (VL_API_BFD_UDP_SESSION_SET_FLAGS_REPLY);
258 vl_api_bfd_auth_set_key_reply_t *rmp;
268 vl_api_bfd_auth_del_key_reply_t *rmp;
289 rmp = vl_msg_api_alloc (sizeof (*rmp));
290 memset (rmp, 0, sizeof (*rmp));
291 rmp->_vl_msg_id = ntohs (VL_API_BFD_AUTH_KEYS_DETAILS);
292 rmp->context = mp->context;
293 rmp->conf_key_id = clib_host_to_net_u32 (key->conf_key_id);
294 rmp->auth_type = key->auth_type;
295 rmp->use_count = clib_host_to_net_u32 (key->use_count);
296 vl_msg_api_send_shmem (q, (u8 *)&rmp);
304 vl_api_bfd_udp_auth_activate_reply_t *rmp;
323 vl_api_bfd_udp_auth_deactivate_reply_t *rmp;
334 REPLY_MACRO (VL_API_BFD_UDP_AUTH_DEACTIVATE_REPLY);
341 vl_api_bfd_udp_set_echo_source_reply_t *rmp;
349 REPLY_MACRO (VL_API_BFD_UDP_SET_ECHO_SOURCE_REPLY);
356 vl_api_bfd_udp_del_echo_source_reply_t *rmp;
361 REPLY_MACRO (VL_API_BFD_UDP_DEL_ECHO_SOURCE_REPLY);
371 #define vl_msg_name_crc_list 373 #undef vl_msg_name_crc_list 378 #define _(id, n, crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 379 foreach_vl_msg_name_crc_bfd;
389 vl_msg_api_set_handlers (VL_API_##N, #n, vl_api_##n##_t_handler, \ 390 vl_noop_handler, vl_api_##n##_t_endian, \ 391 vl_api_##n##_t_print, sizeof (vl_api_##n##_t), 1); static void vl_api_bfd_auth_keys_dump_t_handler(vl_api_bfd_auth_keys_dump_t *mp)
VLIB_API_INIT_FUNCTION(bfd_api_hookup)
static void vl_api_bfd_udp_auth_activate_t_handler(vl_api_bfd_udp_auth_activate_t *mp)
u8 curr_bfd_key_id
current key ID sent out in bfd packet
Add UDP BFD session on interface.
Set flags of BFD UDP session.
static void vl_api_bfd_udp_auth_deactivate_t_handler(vl_api_bfd_udp_auth_deactivate_t *mp)
BFD UDP - add/replace key to configuration.
static void vl_api_bfd_auth_del_key_t_handler(vl_api_bfd_auth_del_key_t *mp)
#define foreach_vpe_api_msg
vnet_api_error_t bfd_udp_mod_session(u32 sw_if_index, const ip46_address_t *local_addr, const ip46_address_t *peer_addr, u32 desired_min_tx_usec, u32 required_min_rx_usec, u8 detect_mult)
modify existing session
BFD authentication key details.
vnet_api_error_t bfd_udp_add_session(u32 sw_if_index, const ip46_address_t *local_addr, const ip46_address_t *peer_addr, u32 desired_min_tx_usec, u32 required_min_rx_usec, u8 detect_mult, u8 is_authenticated, u32 conf_key_id, u8 bfd_key_id)
create a new bfd session
vnet_api_error_t bfd_auth_del_key(u32 conf_key_id)
delete existing authentication key
#define BFD_UDP_API_PARAM_COMMON_CODE
pub_sub_handler(bfd_events, BFD_EVENTS)
vnet_api_error_t bfd_udp_del_echo_source()
unset echo-source interface
static clib_error_t * bfd_api_hookup(vlib_main_t *vm)
vnet_api_error_t bfd_udp_del_session(u32 sw_if_index, const ip46_address_t *local_addr, const ip46_address_t *peer_addr)
delete existing session
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
UDP transport specific data embedded in bfd_session's union.
void bfd_event(bfd_main_t *bm, bfd_session_t *bs)
#define BFD_UDP_API_PARAM_FROM_MP(mp)
vnet_api_error_t bfd_auth_set_key(u32 conf_key_id, u8 auth_type, u8 key_len, const u8 *key)
create or modify bfd authentication key
bfd_auth_key_t * next_key
set to next key to use if delayed switch is enabled - in that case the key is switched when first inc...
void * vl_msg_api_alloc(int nbytes)
bfd_session_t * sessions
pool of bfd sessions context data
bfd_auth_key_t * auth_keys
pool of authentication keys
bfd_udp_key_t key
key identifying this session
bfd_transport_e transport
transport type for this session
BFD session details structure.
u8 local_detect_mult
configured detect multiplier
Get a list of configured authentication keys.
void send_bfd_udp_session_details(unix_shared_memory_queue_t *q, u32 context, bfd_session_t *bs)
vnet_api_error_t bfd_udp_session_set_flags(u32 sw_if_index, const ip46_address_t *local_addr, const ip46_address_t *peer_addr, u8 admin_up_down)
set session admin down/up
#define ip46_address_is_ip4(ip46)
static void setup_message_id_table(api_main_t *am)
#define BAD_SW_IF_INDEX_LABEL
static void vl_api_bfd_auth_set_key_t_handler(vl_api_bfd_auth_set_key_t *mp)
u32 config_desired_min_tx_usec
configured desired min tx interval (microseconds)
#define clib_memcpy(a, b, c)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
static void vl_api_bfd_udp_set_echo_source_t_handler(vl_api_bfd_udp_set_echo_source_t *mp)
static void vl_api_bfd_udp_session_dump_t_handler(vl_api_bfd_udp_session_dump_t *mp)
BFD UDP - deactivate authentication.
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
static void vl_api_bfd_udp_add_t_handler(vl_api_bfd_udp_add_t *mp)
vnet_api_error_t bfd_udp_auth_activate(u32 sw_if_index, const ip46_address_t *local_addr, const ip46_address_t *peer_addr, u32 conf_key_id, u8 bfd_key_id, u8 is_delayed)
activate authentication for existing session
u32 conf_key_id
global configuration key ID
bfd_state_e local_state
session state
static void vl_api_bfd_udp_mod_t_handler(vl_api_bfd_udp_mod_t *mp)
struct bfd_session_s::@46 auth
authentication information
Delete UDP BFD session on interface.
vnet_api_error_t bfd_udp_set_echo_source(u32 loopback_sw_if_index)
set echo-source interface
u32 config_required_min_rx_usec
configured required min rx interval (microseconds)
static void vl_api_bfd_udp_del_t_handler(vl_api_bfd_udp_del_t *mp)
BFD UDP - activate/change authentication.
static void vl_api_bfd_udp_session_set_flags_t_handler(vl_api_bfd_udp_session_set_flags_t *mp)
u8 next_bfd_key_id
key ID to use when switched to next_key
static void vl_api_bfd_udp_del_echo_source_t_handler(vl_api_bfd_udp_del_echo_source_t *mp)
vnet_api_error_t bfd_udp_auth_deactivate(u32 sw_if_index, const ip46_address_t *local_addr, const ip46_address_t *peer_addr, u8 is_delayed)
deactivate authentication for existing session
Modify UDP BFD session on interface.
bfd_auth_key_t * curr_key
current key in use
vpe_api_main_t vpe_api_main
BFD UDP - delete key from configuration.
u8 is_delayed
set to 1 if delayed action is pending, which might be activation of authentication, change of key or deactivation
#define VALIDATE_SW_IF_INDEX(mp)
struct _unix_shared_memory_queue unix_shared_memory_queue_t