FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
bfd_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * bfd_api.c - bfd api
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 /**
20  * @file
21  * @brief BFD binary API implementation
22  */
23 
24 #include <vnet/vnet.h>
25 #include <vlibmemory/api.h>
26 
27 #include <vnet/interface.h>
28 #include <vnet/api_errno.h>
29 #include <vnet/bfd/bfd_main.h>
30 #include <vnet/bfd/bfd_api.h>
31 #include <vnet/ip/ip_types_api.h>
32 
33 #include <vnet/format_fns.h>
34 #include <vnet/bfd/bfd.api_enum.h>
35 #include <vnet/bfd/bfd.api_types.h>
36 
37 #define REPLY_MSG_ID_BASE bfd_main.msg_id_base
39 
40 
41 pub_sub_handler (bfd_events, BFD_EVENTS);
42 
43 #define BFD_UDP_API_PARAM_COMMON_CODE \
44  ip46_address_t local_addr; \
45  ip46_address_t peer_addr; \
46  ip_address_decode(&mp->local_addr, &local_addr); \
47  ip_address_decode(&mp->peer_addr, &peer_addr);
48 
49 #define BFD_UDP_API_PARAM_FROM_MP(mp) \
50  clib_net_to_host_u32 (mp->sw_if_index), &local_addr, &peer_addr
51 
52 static void
54 {
55  vl_api_bfd_udp_add_reply_t *rmp;
56  int rv;
57 
59 
61 
63  clib_net_to_host_u32 (mp->desired_min_tx),
64  clib_net_to_host_u32 (mp->required_min_rx),
66  clib_net_to_host_u32 (mp->conf_key_id),
67  mp->bfd_key_id);
68 
70  REPLY_MACRO (VL_API_BFD_UDP_ADD_REPLY);
71 }
72 
73 static void
75 {
76  vl_api_bfd_udp_mod_reply_t *rmp;
77  int rv;
78 
80 
82 
84  clib_net_to_host_u32 (mp->desired_min_tx),
85  clib_net_to_host_u32 (mp->required_min_rx),
86  mp->detect_mult);
87 
89  REPLY_MACRO (VL_API_BFD_UDP_MOD_REPLY);
90 }
91 
92 static void
94 {
95  vl_api_bfd_udp_del_reply_t *rmp;
96  int rv;
97 
99 
101 
103 
105  REPLY_MACRO (VL_API_BFD_UDP_DEL_REPLY);
106 }
107 
108 void
110  bfd_session_t * bs)
111 {
112  if (bs->transport != BFD_TRANSPORT_UDP4 &&
113  bs->transport != BFD_TRANSPORT_UDP6)
114  {
115  return;
116  }
117 
119  clib_memset (mp, 0, sizeof (*mp));
120  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_BFD_UDP_SESSION_DETAILS);
121  mp->context = context;
122  mp->state = clib_host_to_net_u32 (bs->local_state);
123  bfd_udp_session_t *bus = &bs->udp;
124  bfd_udp_key_t *key = &bus->key;
125  mp->sw_if_index = clib_host_to_net_u32 (key->sw_if_index);
126  if ((!bs->auth.is_delayed && bs->auth.curr_key) ||
127  (bs->auth.is_delayed && bs->auth.next_key))
128  {
129  mp->is_authenticated = true;
130  }
131  if (bs->auth.is_delayed && bs->auth.next_key)
132  {
133  mp->bfd_key_id = bs->auth.next_bfd_key_id;
134  mp->conf_key_id = clib_host_to_net_u32 (bs->auth.next_key->conf_key_id);
135  }
136  else if (!bs->auth.is_delayed && bs->auth.curr_key)
137  {
138  mp->bfd_key_id = bs->auth.curr_bfd_key_id;
139  mp->conf_key_id = clib_host_to_net_u32 (bs->auth.curr_key->conf_key_id);
140  }
141  ip_address_encode (&key->local_addr, IP46_TYPE_ANY, &mp->local_addr);
142  ip_address_encode (&key->peer_addr, IP46_TYPE_ANY, &mp->peer_addr);
143 
144  mp->required_min_rx =
145  clib_host_to_net_u32 (bs->config_required_min_rx_usec);
146  mp->desired_min_tx = clib_host_to_net_u32 (bs->config_desired_min_tx_usec);
147  mp->detect_mult = bs->local_detect_mult;
148  vl_api_send_msg (reg, (u8 *) mp);
149 }
150 
151 void
153  bfd_session_t *bs)
154 {
155  if (bs->transport != BFD_TRANSPORT_UDP4 &&
156  bs->transport != BFD_TRANSPORT_UDP6)
157  {
158  return;
159  }
160 
162  clib_memset (mp, 0, sizeof (*mp));
163  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_BFD_UDP_SESSION_EVENT);
164  mp->pid = pid;
165  mp->state = clib_host_to_net_u32 (bs->local_state);
166  bfd_udp_session_t *bus = &bs->udp;
167  bfd_udp_key_t *key = &bus->key;
168  mp->sw_if_index = clib_host_to_net_u32 (key->sw_if_index);
169  if ((!bs->auth.is_delayed && bs->auth.curr_key) ||
170  (bs->auth.is_delayed && bs->auth.next_key))
171  {
172  mp->is_authenticated = true;
173  }
174  if (bs->auth.is_delayed && bs->auth.next_key)
175  {
176  mp->bfd_key_id = bs->auth.next_bfd_key_id;
177  mp->conf_key_id = clib_host_to_net_u32 (bs->auth.next_key->conf_key_id);
178  }
179  else if (!bs->auth.is_delayed && bs->auth.curr_key)
180  {
181  mp->bfd_key_id = bs->auth.curr_bfd_key_id;
182  mp->conf_key_id = clib_host_to_net_u32 (bs->auth.curr_key->conf_key_id);
183  }
184  ip_address_encode (&key->local_addr, IP46_TYPE_ANY, &mp->local_addr);
185  ip_address_encode (&key->peer_addr, IP46_TYPE_ANY, &mp->peer_addr);
186 
187  mp->required_min_rx = clib_host_to_net_u32 (bs->config_required_min_rx_usec);
188  mp->desired_min_tx = clib_host_to_net_u32 (bs->config_desired_min_tx_usec);
189  mp->detect_mult = bs->local_detect_mult;
190  vl_api_send_msg (reg, (u8 *) mp);
191 }
192 
193 void
195 {
198  vl_api_registration_t *vl_reg;
199  /* *INDENT-OFF* */
200  pool_foreach (reg, vam->bfd_events_registrations) {
202  if (vl_reg)
203  {
204  switch (bs->transport)
205  {
206  case BFD_TRANSPORT_UDP4:
207  /* fallthrough */
208  case BFD_TRANSPORT_UDP6:
209  send_bfd_udp_session_event (vl_reg, 0, bs);
210  }
211  }
212  }
213  /* *INDENT-ON* */
214 }
215 
216 static void
218 {
220 
222  if (!reg)
223  return;
224 
225  bfd_session_t *bs = NULL;
226  /* *INDENT-OFF* */
228  if (bs->transport == BFD_TRANSPORT_UDP4 ||
229  bs->transport == BFD_TRANSPORT_UDP6)
230  send_bfd_udp_session_details (reg, mp->context, bs);
231  }
232  /* *INDENT-ON* */
233 }
234 
235 static void
237  * mp)
238 {
239  vl_api_bfd_udp_session_set_flags_reply_t *rmp;
240  int rv;
241 
243 
246  clib_net_to_host_u32 (mp->flags) &
248 
249  REPLY_MACRO (VL_API_BFD_UDP_SESSION_SET_FLAGS_REPLY);
250 }
251 
252 static void
254 {
255  vl_api_bfd_auth_set_key_reply_t *rmp;
256  int rv = bfd_auth_set_key (clib_net_to_host_u32 (mp->conf_key_id),
257  mp->auth_type, mp->key_len, mp->key);
258 
259  REPLY_MACRO (VL_API_BFD_AUTH_SET_KEY_REPLY);
260 }
261 
262 static void
264 {
265  vl_api_bfd_auth_del_key_reply_t *rmp;
266  int rv = bfd_auth_del_key (clib_net_to_host_u32 (mp->conf_key_id));
267 
268  REPLY_MACRO (VL_API_BFD_AUTH_DEL_KEY_REPLY);
269 }
270 
271 static void
273 {
275 
277  if (!reg)
278  return;
279 
280  bfd_auth_key_t *key = NULL;
281  vl_api_bfd_auth_keys_details_t *rmp = NULL;
282 
283  /* *INDENT-OFF* */
285  rmp = vl_msg_api_alloc (sizeof (*rmp));
286  clib_memset (rmp, 0, sizeof (*rmp));
287  rmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_BFD_AUTH_KEYS_DETAILS);
288  rmp->context = mp->context;
289  rmp->conf_key_id = clib_host_to_net_u32 (key->conf_key_id);
290  rmp->auth_type = key->auth_type;
291  rmp->use_count = clib_host_to_net_u32 (key->use_count);
292  vl_api_send_msg (reg, (u8 *)rmp);
293  }
294  /* *INDENT-ON* */
295 }
296 
297 static void
299 {
300  vl_api_bfd_udp_auth_activate_reply_t *rmp;
301  int rv;
302 
304 
306 
308  clib_net_to_host_u32 (mp->conf_key_id),
309  mp->bfd_key_id, mp->is_delayed);
310 
312  REPLY_MACRO (VL_API_BFD_UDP_AUTH_ACTIVATE_REPLY);
313 }
314 
315 static void
317  mp)
318 {
319  vl_api_bfd_udp_auth_deactivate_reply_t *rmp;
320  int rv;
321 
323 
325 
326  rv =
328 
330  REPLY_MACRO (VL_API_BFD_UDP_AUTH_DEACTIVATE_REPLY);
331 }
332 
333 static void
335  mp)
336 {
337  vl_api_bfd_udp_set_echo_source_reply_t *rmp;
338  int rv;
339 
341 
342  rv = bfd_udp_set_echo_source (clib_net_to_host_u32 (mp->sw_if_index));
343 
345  REPLY_MACRO (VL_API_BFD_UDP_SET_ECHO_SOURCE_REPLY);
346 }
347 
348 static void
350  mp)
351 {
352  vl_api_bfd_udp_del_echo_source_reply_t *rmp;
353  int rv;
354 
356 
357  REPLY_MACRO (VL_API_BFD_UDP_DEL_ECHO_SOURCE_REPLY);
358 }
359 
360 static void
362  mp)
363 {
365  int rv = 0;
366  int is_set;
368  int have_usable_ip4;
370  int have_usable_ip6;
371  ip6_address_t ip6;
372 
373  bfd_udp_get_echo_source (&is_set, &sw_if_index, &have_usable_ip4, &ip4,
374  &have_usable_ip6, &ip6);
375 
376  /* *INDENT-OFF* */
377  REPLY_MACRO2 (VL_API_BFD_UDP_GET_ECHO_SOURCE_REPLY,
378  ({
379  rmp->sw_if_index = ntohl (sw_if_index);
380  if (is_set)
381  {
382  rmp->is_set = true;
383  rmp->sw_if_index = clib_host_to_net_u32 (sw_if_index);
384  if (have_usable_ip4)
385  {
386  rmp->have_usable_ip4 = true;
388  }
389  else
390  {
391  rmp->have_usable_ip4 = false;
392  }
393  if (have_usable_ip6)
394  {
395  rmp->have_usable_ip6 = true;
397  }
398  else
399  {
400  rmp->have_usable_ip6 = false;
401  }
402  }
403  else
404  {
405  rmp->is_set = false;
406  rmp->have_usable_ip4 = false;
407  rmp->have_usable_ip6 = false;
408  }
409  }))
410  /* *INDENT-ON* */
411 }
412 
413 #include <vnet/bfd/bfd.api.c>
414 static clib_error_t *
416 {
417  /*
418  * Set up the (msg_name, crc, message-id) table
419  */
421 
422  return 0;
423 }
424 
426 
427 /*
428  * fd.io coding-style-patch-verification: ON
429  *
430  * Local Variables:
431  * eval: (c-set-style "gnu")
432  * End:
433  */
vl_api_bfd_udp_get_echo_source_t
Get BFD echo source.
Definition: bfd.api:54
vl_api_bfd_auth_keys_details_t::context
u32 context
Definition: bfd.api:294
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition: api_helper_macros.h:281
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
api.h
vl_api_bfd_auth_set_key_t::auth_type
u8 auth_type
Definition: bfd.api:258
vl_api_bfd_udp_session_details_t::peer_addr
vl_api_address_t peer_addr
Definition: bfd.api:180
bfd_session_s::transport
bfd_transport_e transport
transport type for this session
Definition: bfd_main.h:236
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
vl_api_bfd_udp_get_echo_source_t_handler
static void vl_api_bfd_udp_get_echo_source_t_handler(vl_api_bfd_udp_get_echo_source_t *mp)
Definition: bfd_api.c:361
vl_api_bfd_udp_add_t::desired_min_tx
u32 desired_min_tx
Definition: bfd.api:101
pub_sub_handler
pub_sub_handler(bfd_events, BFD_EVENTS)
bfd_udp_auth_deactivate
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
Definition: bfd_udp.c:876
vl_api_bfd_udp_del_echo_source_t_handler
static void vl_api_bfd_udp_del_echo_source_t_handler(vl_api_bfd_udp_del_echo_source_t *mp)
Definition: bfd_api.c:349
vl_api_bfd_auth_keys_dump_t
Get a list of configured authentication keys.
Definition: bfd.api:280
vl_api_bfd_udp_session_details_t::local_addr
vl_api_address_t local_addr
Definition: bfd.api:179
vl_api_bfd_udp_mod_t::desired_min_tx
u32 desired_min_tx
Definition: bfd.api:127
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
vl_api_bfd_udp_add_t::bfd_key_id
u8 bfd_key_id
Definition: bfd.api:107
ip4
vl_api_ip4_address_t ip4
Definition: one.api:376
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
BFD_UDP_API_PARAM_FROM_MP
#define BFD_UDP_API_PARAM_FROM_MP(mp)
Definition: bfd_api.c:49
vl_api_bfd_udp_set_echo_source_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: bfd.api:37
bfd_session_s::config_desired_min_tx_usec
u32 config_desired_min_tx_usec
configured desired min tx interval (microseconds)
Definition: bfd_main.h:112
vpe_api_main_t
Definition: api_helper_macros.h:414
vl_api_bfd_auth_keys_dump_t_handler
static void vl_api_bfd_auth_keys_dump_t_handler(vl_api_bfd_auth_keys_dump_t *mp)
Definition: bfd_api.c:272
vl_api_bfd_auth_keys_details_t::auth_type
u8 auth_type
Definition: bfd.api:297
bfd_session_s::next_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...
Definition: bfd_main.h:211
vl_api_bfd_udp_set_echo_source_t
Set BFD echo source.
Definition: bfd.api:33
vl_api_bfd_udp_session_event_t
Definition: bfd.api:228
bfd_auth_set_key
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
Definition: bfd_main.c:2153
vl_api_bfd_udp_session_details_t::is_authenticated
bool is_authenticated
Definition: bfd.api:182
bfd_auth_key_t::conf_key_id
u32 conf_key_id
global configuration key ID
Definition: bfd_main.h:43
vl_api_bfd_udp_session_details_t::required_min_rx
u32 required_min_rx
Definition: bfd.api:185
vl_api_bfd_udp_get_echo_source_reply_t::have_usable_ip4
bool have_usable_ip4
Definition: bfd.api:76
vl_api_bfd_auth_set_key_t::key
u8 key[20]
Definition: bfd.api:259
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vl_api_bfd_udp_auth_activate_t_handler
static void vl_api_bfd_udp_auth_activate_t_handler(vl_api_bfd_udp_auth_activate_t *mp)
Definition: bfd_api.c:298
vl_api_bfd_udp_session_event_t::detect_mult
u8 detect_mult
Definition: bfd.api:241
vl_api_bfd_udp_session_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: bfd.api:178
vl_api_bfd_udp_session_event_t::local_addr
vl_api_address_t local_addr
Definition: bfd.api:233
vl_api_bfd_udp_del_echo_source_t
Delete BFD echo source.
Definition: bfd.api:44
vl_api_bfd_udp_get_echo_source_reply_t::have_usable_ip6
bool have_usable_ip6
Definition: bfd.api:78
vl_api_bfd_udp_session_event_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: bfd.api:232
vl_api_bfd_udp_auth_activate_t::is_delayed
bool is_delayed
Definition: bfd.api:318
REPLY_MSG_ID_BASE
#define REPLY_MSG_ID_BASE
Definition: bfd_api.c:37
bfd_udp_session_t
UDP transport specific data embedded in bfd_session's union.
Definition: bfd_udp.h:44
vl_api_bfd_udp_session_event_t::state
vl_api_bfd_state_t state
Definition: bfd.api:235
vl_api_bfd_udp_auth_deactivate_t_handler
static void vl_api_bfd_udp_auth_deactivate_t_handler(vl_api_bfd_udp_auth_deactivate_t *mp)
Definition: bfd_api.c:316
bfd_udp_auth_activate
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
Definition: bfd_udp.c:852
key
typedef key
Definition: ipsec_types.api:91
bfd_session_s::next_bfd_key_id
u8 next_bfd_key_id
key ID to use when switched to next_key
Definition: bfd_main.h:226
vl_api_bfd_udp_session_details_t::desired_min_tx
u32 desired_min_tx
Definition: bfd.api:186
bfd_main_t
Definition: bfd_main.h:265
vl_api_bfd_auth_keys_dump_t::client_index
u32 client_index
Definition: bfd.api:282
bfd_main.h
BFD global declarations.
vl_api_bfd_udp_session_event_t::pid
u32 pid
Definition: bfd.api:231
vl_api_bfd_udp_auth_activate_t::conf_key_id
u32 conf_key_id
Definition: bfd.api:320
vl_api_bfd_udp_session_event_t::conf_key_id
u32 conf_key_id
Definition: bfd.api:238
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
vl_api_bfd_auth_keys_details_t
BFD authentication key details.
Definition: bfd.api:292
pid
u32 pid
Definition: dhcp.api:164
vl_api_bfd_udp_session_dump_t::client_index
u32 client_index
Definition: bfd.api:157
send_bfd_udp_session_event
void send_bfd_udp_session_event(vl_api_registration_t *reg, u32 pid, bfd_session_t *bs)
Definition: bfd_api.c:152
vl_api_bfd_udp_get_echo_source_reply_t
Get BFD echo source reply.
Definition: bfd.api:70
vl_api_bfd_auth_del_key_t
BFD UDP - delete key from configuration.
Definition: bfd.api:269
ip6_address_encode
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
Definition: ip_types_api.c:123
vl_api_bfd_auth_set_key_t_handler
static void vl_api_bfd_auth_set_key_t_handler(vl_api_bfd_auth_set_key_t *mp)
Definition: bfd_api.c:253
bfd_session_s
Definition: bfd_main.h:85
vl_api_bfd_auth_keys_details_t::conf_key_id
u32 conf_key_id
Definition: bfd.api:295
BFD_UDP_API_PARAM_COMMON_CODE
#define BFD_UDP_API_PARAM_COMMON_CODE
Definition: bfd_api.c:43
IF_STATUS_API_FLAG_ADMIN_UP
@ IF_STATUS_API_FLAG_ADMIN_UP
Definition: interface_types.api:22
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
bfd_session_s::local_state
bfd_state_e local_state
session state
Definition: bfd_main.h:91
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: sr_mpls_api.c:174
vl_api_bfd_udp_mod_t::detect_mult
u8 detect_mult
Definition: bfd.api:131
bfd_main_t::sessions
bfd_session_t * sessions
pool of bfd sessions context data
Definition: bfd_main.h:285
interface.h
bfd_api_hookup
static clib_error_t * bfd_api_hookup(vlib_main_t *vm)
Definition: bfd_api.c:415
bfd_event
void bfd_event(bfd_main_t *bm, bfd_session_t *bs)
Definition: bfd_api.c:194
vl_api_bfd_udp_auth_activate_t::bfd_key_id
u8 bfd_key_id
Definition: bfd.api:319
vl_api_bfd_udp_session_event_t::desired_min_tx
u32 desired_min_tx
Definition: bfd.api:240
bfd_session_s::curr_key
bfd_auth_key_t * curr_key
current key in use
Definition: bfd_main.h:205
vl_api_bfd_udp_auth_deactivate_t::is_delayed
bool is_delayed
Definition: bfd.api:339
vl_api_bfd_auth_set_key_t
BFD UDP - add/replace key to configuration.
Definition: bfd.api:252
vl_api_bfd_udp_session_set_flags_t
Set flags of BFD UDP session.
Definition: bfd.api:199
ip4_address_t
Definition: ip4_packet.h:50
vl_api_bfd_auth_set_key_t::conf_key_id
u32 conf_key_id
Definition: bfd.api:256
vl_api_bfd_udp_add_t::detect_mult
u8 detect_mult
Definition: bfd.api:105
bfd_udp_session_set_flags
vnet_api_error_t bfd_udp_session_set_flags(vlib_main_t *vm, 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
Definition: bfd_udp.c:831
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition: api_helper_macros.h:289
vl_api_bfd_udp_mod_t_handler
static void vl_api_bfd_udp_mod_t_handler(vl_api_bfd_udp_mod_t *mp)
Definition: bfd_api.c:74
vl_api_bfd_udp_add_t::is_authenticated
bool is_authenticated
Definition: bfd.api:106
vl_api_bfd_udp_add_t::required_min_rx
u32 required_min_rx
Definition: bfd.api:102
vl_api_bfd_udp_session_set_flags_t_handler
static void vl_api_bfd_udp_session_set_flags_t_handler(vl_api_bfd_udp_session_set_flags_t *mp)
Definition: bfd_api.c:236
vl_api_bfd_auth_keys_dump_t::context
u32 context
Definition: bfd.api:283
vl_api_bfd_udp_auth_activate_t
BFD UDP - activate/change authentication.
Definition: bfd.api:311
bfd_udp_mod_session
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
Definition: bfd_udp.c:783
bfd_session_s::curr_bfd_key_id
u8 curr_bfd_key_id
current key ID sent out in bfd packet
Definition: bfd_main.h:223
send_bfd_udp_session_details
void send_bfd_udp_session_details(vl_api_registration_t *reg, u32 context, bfd_session_t *bs)
Definition: bfd_api.c:109
vl_api_bfd_udp_session_dump_t
Get all BFD sessions.
Definition: bfd.api:155
bfd_session_s::local_detect_mult
u8 local_detect_mult
configured detect multiplier
Definition: bfd_main.h:145
vl_api_bfd_auth_set_key_t::key_len
u8 key_len
Definition: bfd.api:257
bfd_auth_del_key
vnet_api_error_t bfd_auth_del_key(u32 conf_key_id)
delete existing authentication key
Definition: bfd_main.c:2203
format_fns.h
u32
unsigned int u32
Definition: types.h:88
bfd_udp_add_session
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
Definition: bfd_udp.c:742
vl_api_bfd_udp_session_details_t
BFD session details structure.
Definition: bfd.api:175
vl_api_bfd_udp_del_t
Delete UDP BFD session on interface.
Definition: bfd.api:142
vl_api_bfd_udp_session_details_t::detect_mult
u8 detect_mult
Definition: bfd.api:187
ip6
vl_api_ip6_address_t ip6
Definition: one.api:424
vl_api_bfd_udp_session_dump_t::context
u32 context
Definition: bfd.api:158
vl_api_bfd_udp_session_event_t::peer_addr
vl_api_address_t peer_addr
Definition: bfd.api:234
bfd_udp_del_session
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
Definition: bfd_udp.c:810
api_helper_macros.h
ip4_address_encode
void ip4_address_encode(const ip4_address_t *in, vl_api_ip4_address_t out)
Definition: ip_types_api.c:135
bfd_udp_get_echo_source
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
Definition: bfd_udp.c:235
vl_api_bfd_auth_del_key_t::conf_key_id
u32 conf_key_id
Definition: bfd.api:273
vl_api_bfd_udp_add_t::conf_key_id
u32 conf_key_id
Definition: bfd.api:108
vl_api_bfd_udp_auth_deactivate_t
BFD UDP - deactivate authentication.
Definition: bfd.api:332
vl_api_bfd_udp_session_details_t::bfd_key_id
u8 bfd_key_id
Definition: bfd.api:183
bfd_main
bfd_main_t bfd_main
Definition: bfd_main.c:2236
vpe_client_registration_t::client_index
u32 client_index
Definition: api_helper_macros.h:410
vl_api_bfd_udp_set_echo_source_t_handler
static void vl_api_bfd_udp_set_echo_source_t_handler(vl_api_bfd_udp_set_echo_source_t *mp)
Definition: bfd_api.c:334
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
ip_address_encode
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
Definition: ip_types_api.c:206
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(bfd_api_hookup)
vl_api_bfd_auth_keys_details_t::use_count
u32 use_count
Definition: bfd.api:296
bfd_session_s::is_delayed
u8 is_delayed
set to 1 if delayed action is pending, which might be activation of authentication,...
Definition: bfd_main.h:232
bfd_udp_del_echo_source
vnet_api_error_t bfd_udp_del_echo_source()
unset echo-source interface
vl_api_bfd_udp_mod_t
Modify UDP BFD session on interface.
Definition: bfd.api:122
vl_api_bfd_udp_add_t_handler
static void vl_api_bfd_udp_add_t_handler(vl_api_bfd_udp_add_t *mp)
Definition: bfd_api.c:53
context
u32 context
Definition: ip.api:852
vl_api_bfd_udp_mod_t::required_min_rx
u32 required_min_rx
Definition: bfd.api:128
vl_api_bfd_udp_session_dump_t_handler
static void vl_api_bfd_udp_session_dump_t_handler(vl_api_bfd_udp_session_dump_t *mp)
Definition: bfd_api.c:217
rv
int __clib_unused rv
Definition: application.c:491
IP46_TYPE_ANY
@ IP46_TYPE_ANY
Definition: ip46_address.h:24
vl_api_bfd_udp_get_echo_source_reply_t::ip6_addr
vl_api_ip6_address_t ip6_addr
Definition: bfd.api:79
vnet.h
api_errno.h
bfd_auth_key_t
Definition: bfd_main.h:40
vl_api_bfd_udp_session_details_t::conf_key_id
u32 conf_key_id
Definition: bfd.api:184
bfd_session_s::auth
struct bfd_session_s::@149 auth
authentication information
bfd_session_s::config_required_min_rx_usec
u32 config_required_min_rx_usec
configured required min rx interval (microseconds)
Definition: bfd_main.h:121
vl_api_bfd_udp_session_details_t::context
u32 context
Definition: bfd.api:177
vpe_client_registration_t
Definition: api_helper_macros.h:408
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
vl_api_bfd_udp_get_echo_source_reply_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: bfd.api:74
vl_api_bfd_auth_del_key_t_handler
static void vl_api_bfd_auth_del_key_t_handler(vl_api_bfd_auth_del_key_t *mp)
Definition: bfd_api.c:263
ip_types_api.h
bfd_session_s::udp
bfd_udp_session_t udp
Definition: bfd_main.h:241
bfd_main_t::auth_keys
bfd_auth_key_t * auth_keys
pool of authentication keys
Definition: bfd_main.h:313
bfd_udp_set_echo_source
vnet_api_error_t bfd_udp_set_echo_source(u32 loopback_sw_if_index)
set echo-source interface
Definition: bfd_udp.c:83
vl_api_bfd_udp_get_echo_source_reply_t::ip4_addr
vl_api_ip4_address_t ip4_addr
Definition: bfd.api:77
vl_api_bfd_udp_session_set_flags_t::flags
vl_api_if_status_flags_t flags
Definition: bfd.api:206
bus
u8 bus
Definition: pci_types.api:21
bfd_api.h
BFD API declarations.
vl_api_bfd_udp_get_echo_source_reply_t::is_set
bool is_set
Definition: bfd.api:75
vl_api_bfd_udp_session_details_t::state
vl_api_bfd_state_t state
Definition: bfd.api:181
vl_api_bfd_udp_session_event_t::required_min_rx
u32 required_min_rx
Definition: bfd.api:239
vpe_api_main
vpe_api_main_t vpe_api_main
Definition: interface_api.c:47
vl_api_bfd_udp_add_t
Add UDP BFD session on interface.
Definition: bfd.api:96
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
vl_api_bfd_udp_session_event_t::is_authenticated
bool is_authenticated
Definition: bfd.api:236
vl_api_bfd_udp_del_t_handler
static void vl_api_bfd_udp_del_t_handler(vl_api_bfd_udp_del_t *mp)
Definition: bfd_api.c:93
vl_api_bfd_udp_session_event_t::bfd_key_id
u8 bfd_key_id
Definition: bfd.api:237