44 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 51 #define foreach_vpe_api_msg \ 52 _ (BFD_UDP_ADD, bfd_udp_add) \ 53 _ (BFD_UDP_MOD, bfd_udp_mod) \ 54 _ (BFD_UDP_DEL, bfd_udp_del) \ 55 _ (BFD_UDP_SESSION_DUMP, bfd_udp_session_dump) \ 56 _ (BFD_UDP_SESSION_SET_FLAGS, bfd_udp_session_set_flags) \ 57 _ (WANT_BFD_EVENTS, want_bfd_events) \ 58 _ (BFD_AUTH_SET_KEY, bfd_auth_set_key) \ 59 _ (BFD_AUTH_DEL_KEY, bfd_auth_del_key) \ 60 _ (BFD_AUTH_KEYS_DUMP, bfd_auth_keys_dump) \ 61 _ (BFD_UDP_AUTH_ACTIVATE, bfd_udp_auth_activate) \ 62 _ (BFD_UDP_AUTH_DEACTIVATE, bfd_udp_auth_deactivate) \ 63 _ (BFD_UDP_SET_ECHO_SOURCE, bfd_udp_set_echo_source) \ 64 _ (BFD_UDP_DEL_ECHO_SOURCE, bfd_udp_del_echo_source) \ 65 _ (BFD_UDP_GET_ECHO_SOURCE, bfd_udp_get_echo_source) 69 #define BFD_UDP_API_PARAM_COMMON_CODE \ 70 ip46_address_t local_addr; \ 71 ip46_address_t peer_addr; \ 72 ip_address_decode(&mp->local_addr, &local_addr); \ 73 ip_address_decode(&mp->peer_addr, &peer_addr); 75 #define BFD_UDP_API_PARAM_FROM_MP(mp) \ 76 clib_net_to_host_u32 (mp->sw_if_index), &local_addr, &peer_addr 81 vl_api_bfd_udp_add_reply_t *rmp;
102 vl_api_bfd_udp_mod_reply_t *rmp;
121 vl_api_bfd_udp_del_reply_t *rmp;
138 if (bs->
transport != BFD_TRANSPORT_UDP4 &&
146 mp->_vl_msg_id = ntohs (VL_API_BFD_UDP_SESSION_DETAILS);
150 bfd_udp_key_t *
key = &bus->
key;
151 mp->
sw_if_index = clib_host_to_net_u32 (key->sw_if_index);
185 vl_reg = vl_api_client_index_to_registration (reg->client_index);
188 switch (bs->transport)
190 case BFD_TRANSPORT_UDP4:
192 case BFD_TRANSPORT_UDP6:
193 send_bfd_udp_session_details (vl_reg, 0, bs);
212 if (bs->transport == BFD_TRANSPORT_UDP4 ||
213 bs->transport == BFD_TRANSPORT_UDP6)
214 send_bfd_udp_session_details (reg, mp->context, bs);
223 vl_api_bfd_udp_session_set_flags_reply_t *rmp;
229 clib_net_to_host_u32 (mp->
flags) &
232 REPLY_MACRO (VL_API_BFD_UDP_SESSION_SET_FLAGS_REPLY);
238 vl_api_bfd_auth_set_key_reply_t *rmp;
248 vl_api_bfd_auth_del_key_reply_t *rmp;
268 rmp = vl_msg_api_alloc (sizeof (*rmp));
269 clib_memset (rmp, 0, sizeof (*rmp));
270 rmp->_vl_msg_id = ntohs (VL_API_BFD_AUTH_KEYS_DETAILS);
271 rmp->context = mp->context;
272 rmp->conf_key_id = clib_host_to_net_u32 (key->conf_key_id);
273 rmp->auth_type = key->auth_type;
274 rmp->use_count = clib_host_to_net_u32 (key->use_count);
275 vl_api_send_msg (reg, (u8 *)rmp);
283 vl_api_bfd_udp_auth_activate_reply_t *rmp;
302 vl_api_bfd_udp_auth_deactivate_reply_t *rmp;
313 REPLY_MACRO (VL_API_BFD_UDP_AUTH_DEACTIVATE_REPLY);
320 vl_api_bfd_udp_set_echo_source_reply_t *rmp;
328 REPLY_MACRO (VL_API_BFD_UDP_SET_ECHO_SOURCE_REPLY);
335 vl_api_bfd_udp_del_echo_source_reply_t *rmp;
340 REPLY_MACRO (VL_API_BFD_UDP_DEL_ECHO_SOURCE_REPLY);
357 &have_usable_ip6, &ip6);
366 rmp->
sw_if_index = clib_host_to_net_u32 (sw_if_index);
403 #define vl_msg_name_crc_list 405 #undef vl_msg_name_crc_list 410 #define _(id, n, crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 411 foreach_vl_msg_name_crc_bfd;
421 vl_msg_api_set_handlers (VL_API_##N, #n, vl_api_##n##_t_handler, \ 422 vl_noop_handler, vl_api_##n##_t_endian, \ 423 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)
vl_api_address_t peer_addr
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)
struct bfd_session_s::@124 auth
authentication information
vl_api_interface_index_t sw_if_index
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.
#define REPLY_MACRO2(t, body)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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
void bfd_udp_get_echo_source(int *is_set, u32 *sw_if_index, int *have_usable_ip4, ip4_address_t *ip4, int *have_usable_ip6, ip6_address_t *ip6)
get echo source information - used by CLI
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.
vl_api_interface_index_t sw_if_index
Get BFD echo source reply.
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)
vl_api_interface_index_t sw_if_index
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.
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)
vl_api_if_status_flags_t flags
u32 config_desired_min_tx_usec
configured desired min tx interval (microseconds)
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.
vl_api_address_t local_addr
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
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
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
vl_api_ip6_address_t ip6_addr
static void vl_api_bfd_udp_get_echo_source_t_handler(vl_api_bfd_udp_get_echo_source_t *mp)
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
static void vl_api_bfd_udp_del_echo_source_t_handler(vl_api_bfd_udp_del_echo_source_t *mp)
static api_main_t * vlibapi_get_main(void)
void ip4_address_encode(const ip4_address_t *in, vl_api_ip4_address_t out)
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.
vl_api_ip4_address_t ip4_addr
vl_api_interface_index_t sw_if_index
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)