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 vl_reg = vl_api_client_index_to_registration (reg->client_index);
208 switch (bs->transport)
210 case BFD_TRANSPORT_UDP4:
212 case BFD_TRANSPORT_UDP6:
213 send_bfd_udp_session_details (vl_reg, 0, bs);
232 if (bs->transport == BFD_TRANSPORT_UDP4 ||
233 bs->transport == BFD_TRANSPORT_UDP6)
234 send_bfd_udp_session_details (reg, mp->context, bs);
243 vl_api_bfd_udp_session_set_flags_reply_t *rmp;
251 REPLY_MACRO (VL_API_BFD_UDP_SESSION_SET_FLAGS_REPLY);
257 vl_api_bfd_auth_set_key_reply_t *rmp;
267 vl_api_bfd_auth_del_key_reply_t *rmp;
287 rmp = vl_msg_api_alloc (sizeof (*rmp));
288 memset (rmp, 0, sizeof (*rmp));
289 rmp->_vl_msg_id = ntohs (VL_API_BFD_AUTH_KEYS_DETAILS);
290 rmp->context = mp->context;
291 rmp->conf_key_id = clib_host_to_net_u32 (key->conf_key_id);
292 rmp->auth_type = key->auth_type;
293 rmp->use_count = clib_host_to_net_u32 (key->use_count);
294 vl_api_send_msg (reg, (u8 *)rmp);
302 vl_api_bfd_udp_auth_activate_reply_t *rmp;
321 vl_api_bfd_udp_auth_deactivate_reply_t *rmp;
332 REPLY_MACRO (VL_API_BFD_UDP_AUTH_DEACTIVATE_REPLY);
339 vl_api_bfd_udp_set_echo_source_reply_t *rmp;
347 REPLY_MACRO (VL_API_BFD_UDP_SET_ECHO_SOURCE_REPLY);
354 vl_api_bfd_udp_del_echo_source_reply_t *rmp;
359 REPLY_MACRO (VL_API_BFD_UDP_DEL_ECHO_SOURCE_REPLY);
369 #define vl_msg_name_crc_list 371 #undef vl_msg_name_crc_list 376 #define _(id, n, crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 377 foreach_vl_msg_name_crc_bfd;
387 vl_msg_api_set_handlers (VL_API_##N, #n, vl_api_##n##_t_handler, \ 388 vl_noop_handler, vl_api_##n##_t_endian, \ 389 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.
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
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)
void * vl_msg_api_alloc(int nbytes)
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...
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.
void send_bfd_udp_session_details(vl_api_registration_t *reg, u32 context, bfd_session_t *bs)
u8 local_detect_mult
configured detect multiplier
Get a list of configured authentication keys.
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
API main structure, used by both vpp and binary API clients.
#define ip46_address_is_ip4(ip46)
An API client registration, only in vpp/vlib.
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)
static void vl_api_bfd_udp_set_echo_source_t_handler(vl_api_bfd_udp_set_echo_source_t *mp)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static void vl_api_bfd_udp_session_dump_t_handler(vl_api_bfd_udp_session_dump_t *mp)
BFD UDP - deactivate authentication.
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)
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)
struct bfd_session_s::@48 auth
authentication information
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)