|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
36 case BFD_TRANSPORT_UDP4:
37 s =
format (s,
"%=10u %-32s %20U %20U\n", bs->
bs_idx,
"IPv4 address",
41 case BFD_TRANSPORT_UDP6:
42 s =
format (s,
"%=10u %-32s %20U %20U\n", bs->
bs_idx,
"IPv6 address",
47 s =
format (s,
"%10s %-32s %20s %20s\n",
"",
"Session state",
50 s =
format (s,
"%10s %-32s %20s %20s\n",
"",
"Diagnostic code",
53 s =
format (s,
"%10s %-32s %20u %20u\n",
"",
"Detect multiplier",
55 s =
format (s,
"%10s %-32s %20u %20llu\n",
"",
56 "Required Min Rx Interval (usec)",
58 s =
format (s,
"%10s %-32s %20u %20u\n",
"",
59 "Desired Min Tx Interval (usec)",
63 format (s,
"%10s %-32s %20u\n",
"",
"Transmit interval",
71 s =
format (s,
"%10s %-32s %20v\n",
"",
"Last control frame tx",
tmp);
78 s =
format (s,
"%10s %-32s %20v\n",
"",
"Last control frame rx",
tmp);
82 format (s,
"%10s %-32s %20u %20llu\n",
"",
"Min Echo Rx Interval (usec)",
87 format (s,
"%10s %-32s %20u\n",
"",
"Echo transmit interval",
93 s =
format (s,
"%10s %-32s %20v\n",
"",
"Last echo frame tx",
tmp);
99 format (s,
"%10s %-32s %20v\n",
"",
"Last echo frame roundtrip time",
104 s =
format (s,
"%10s %-32s %20s %20s\n",
"",
"Demand mode",
"no",
106 s =
format (s,
"%10s %-32s %20s\n",
"",
"Poll state",
110 s =
format (s,
"%10s %-32s %20u\n",
"",
"Authentication config key ID",
112 s =
format (s,
"%10s %-32s %20u\n",
"",
"Authentication BFD key ID",
114 s =
format (s,
"%10s %-32s %20u %20u\n",
"",
"Sequence number",
135 u8 *s =
format (NULL,
"%=10s %=25s %=10s\n",
"Configuration Key ID",
136 "Type",
"Use Count");
139 s =
format (s,
"%10u %-25s %10u\n",
key->conf_key_id,
148 else if (
unformat (line_input,
"sessions"))
150 u8 *s =
format (NULL,
"%=10s %=32s %=20s %=20s\n",
"Index",
"Property",
151 "Local value",
"Remote value");
162 else if (
unformat (line_input,
"echo-source"))
171 &have_usable_ip6, &
ip6);
178 u8 *s =
format (NULL,
"UDP echo source is: %v\n", hw_if->
name);
179 s =
format (s,
"IPv4 address usable as echo source: ");
188 s =
format (s,
"IPv6 address usable as echo source: ");
218 .short_help =
"show bfd [keys|sessions|echo-source]",
230 u8 *vec_auth_type = NULL;
234 static const u8 keyed_sha1[] =
"keyed-sha1";
235 static const u8 meticulous_keyed_sha1[] =
"meticulous-keyed-sha1";
243 if (
unformat (line_input,
"conf-key-id %u", &key_id))
250 if (
vec_len (vec_auth_type) ==
sizeof (keyed_sha1) - 1 &&
251 0 == memcmp (vec_auth_type, keyed_sha1,
252 sizeof (keyed_sha1) - 1))
254 auth_type = BFD_AUTH_TYPE_keyed_sha1;
256 else if (
vec_len (vec_auth_type) ==
257 sizeof (meticulous_keyed_sha1) - 1 &&
258 0 == memcmp (vec_auth_type, meticulous_keyed_sha1,
259 sizeof (meticulous_keyed_sha1) - 1))
261 auth_type = BFD_AUTH_TYPE_meticulous_keyed_sha1;
315 .path =
"bfd key set",
316 .short_help =
"bfd key set"
318 " type <keyed-sha1|meticulous-keyed-sha1> "
338 if (!
unformat (line_input,
"conf-key-id %u", &key_id))
360 .path =
"bfd key del",
361 .short_help =
"bfd key del conf-key-id <id>",
366 #define INTERFACE_STR "interface"
367 #define LOCAL_ADDR_STR "local-addr"
368 #define PEER_ADDR_STR "peer-addr"
369 #define CONF_KEY_ID_STR "conf-key-id"
370 #define BFD_KEY_ID_STR "bfd-key-id"
371 #define DESIRED_MIN_TX_STR "desired-min-tx"
372 #define REQUIRED_MIN_RX_STR "required-min-rx"
373 #define DETECT_MULT_STR "detect-mult"
374 #define ADMIN_STR "admin"
375 #define DELAYED_STR "delayed"
380 #define DECLARE(t, n, s, r, ...) \
384 #define UNFORMAT(t, n, s, r, ...) \
385 if (unformat (line_input, s " " __VA_ARGS__, &n)) \
387 something_parsed = 1; \
391 #define CHECK_MANDATORY(t, n, s, r, ...) \
392 WARN_OFF(tautological-compare) \
393 if (mandatory == r && !have_##n) \
395 WARN_ON(tautological-compare) \
396 ret = clib_error_return (0, "Required parameter `%s' missing.", s); \
406 #define foreach_bfd_cli_udp_session_add_cli_param(F) \
407 F (u32, sw_if_index, INTERFACE_STR, mandatory, "%U", \
408 unformat_vnet_sw_interface, &vnet_main) \
409 F (ip46_address_t, local_addr, LOCAL_ADDR_STR, mandatory, "%U", \
410 unformat_ip46_address) \
411 F (ip46_address_t, peer_addr, PEER_ADDR_STR, mandatory, "%U", \
412 unformat_ip46_address) \
413 F (u32, desired_min_tx, DESIRED_MIN_TX_STR, mandatory, "%u") \
414 F (u32, required_min_rx, REQUIRED_MIN_RX_STR, mandatory, "%u") \
415 F (u32, detect_mult, DETECT_MULT_STR, mandatory, "%u") \
416 F (u32, conf_key_id, CONF_KEY_ID_STR, optional, "%u") \
417 F (u32, bfd_key_id, BFD_KEY_ID_STR, optional, "%u")
427 int something_parsed = 0;
430 if (!something_parsed)
440 if (1 == have_conf_key_id + have_bfd_key_id)
443 "and `%s' must be either both specified or none",
448 if (detect_mult > 255)
455 if (have_bfd_key_id && bfd_key_id > 255)
465 detect_mult, have_conf_key_id, conf_key_id,
471 "`bfd_add_add_session' API call failed, rv=%d:%U",
482 .path =
"bfd udp session add",
483 .short_help =
"bfd udp session add"
484 " interface <interface>"
485 " local-addr <local-address>"
486 " peer-addr <peer-address>"
487 " desired-min-tx <desired min tx interval>"
488 " required-min-rx <required min rx interval>"
489 " detect-mult <detect multiplier> "
491 " conf-key-id <config key ID>"
492 " bfd-key-id <BFD key ID>"
504 #define foreach_bfd_cli_udp_session_mod_cli_param(F) \
505 F (u32, sw_if_index, INTERFACE_STR, mandatory, "%U", \
506 unformat_vnet_sw_interface, &vnet_main) \
507 F (ip46_address_t, local_addr, LOCAL_ADDR_STR, mandatory, "%U", \
508 unformat_ip46_address) \
509 F (ip46_address_t, peer_addr, PEER_ADDR_STR, mandatory, "%U", \
510 unformat_ip46_address) \
511 F (u32, desired_min_tx, DESIRED_MIN_TX_STR, mandatory, "%u") \
512 F (u32, required_min_rx, REQUIRED_MIN_RX_STR, mandatory, "%u") \
513 F (u32, detect_mult, DETECT_MULT_STR, mandatory, "%u")
523 int something_parsed = 0;
526 if (!something_parsed)
536 if (detect_mult > 255)
545 desired_min_tx, required_min_rx, detect_mult);
550 "`bfd_udp_mod_session' API call failed, rv=%d:%U",
561 .path =
"bfd udp session mod",
562 .short_help =
"bfd udp session mod interface"
563 " <interface> local-addr"
564 " <local-address> peer-addr"
565 " <peer-address> desired-min-tx"
566 " <desired min tx interval> required-min-rx"
567 " <required min rx interval> detect-mult"
568 " <detect multiplier> ",
579 #define foreach_bfd_cli_udp_session_del_cli_param(F) \
580 F (u32, sw_if_index, INTERFACE_STR, mandatory, "%U", \
581 unformat_vnet_sw_interface, &vnet_main) \
582 F (ip46_address_t, local_addr, LOCAL_ADDR_STR, mandatory, "%U", \
583 unformat_ip46_address) \
584 F (ip46_address_t, peer_addr, PEER_ADDR_STR, mandatory, "%U", \
585 unformat_ip46_address)
595 int something_parsed = 0;
598 if (!something_parsed)
614 "`bfd_udp_del_session' API call failed, rv=%d:%U",
625 .path =
"bfd udp session del",
626 .short_help =
"bfd udp session del interface"
627 " <interface> local-addr"
628 " <local-address> peer-addr"
640 #define foreach_bfd_cli_udp_session_set_flags_cli_param(F) \
641 F (u32, sw_if_index, INTERFACE_STR, mandatory, "%U", \
642 unformat_vnet_sw_interface, &vnet_main) \
643 F (ip46_address_t, local_addr, LOCAL_ADDR_STR, mandatory, "%U", \
644 unformat_ip46_address) \
645 F (ip46_address_t, peer_addr, PEER_ADDR_STR, mandatory, "%U", \
646 unformat_ip46_address) \
647 F (u8 *, admin_up_down_token, ADMIN_STR, mandatory, "%v", \
648 &admin_up_down_token)
658 int something_parsed = 0;
661 if (!something_parsed)
672 static const char up[] =
"up";
673 static const char down[] =
"down";
674 if (!memcmp (admin_up_down_token, up,
sizeof (up) - 1))
678 else if (!memcmp (admin_up_down_token, down,
sizeof (down) - 1))
691 &peer_addr, admin_up_down);
696 "`bfd_udp_session_set_flags' API call failed, rv=%d:%U",
707 .path =
"bfd udp session set-flags",
708 .short_help =
"bfd udp session set-flags"
709 " interface <interface>"
710 " local-addr <local-address>"
711 " peer-addr <peer-address>"
724 #define foreach_bfd_cli_udp_session_auth_activate_cli_param(F) \
725 F (u32, sw_if_index, INTERFACE_STR, mandatory, "%U", \
726 unformat_vnet_sw_interface, &vnet_main) \
727 F (ip46_address_t, local_addr, LOCAL_ADDR_STR, mandatory, "%U", \
728 unformat_ip46_address) \
729 F (ip46_address_t, peer_addr, PEER_ADDR_STR, mandatory, "%U", \
730 unformat_ip46_address) \
731 F (u8 *, delayed_token, DELAYED_STR, optional, "%v") \
732 F (u32, conf_key_id, CONF_KEY_ID_STR, mandatory, "%u") \
733 F (u32, bfd_key_id, BFD_KEY_ID_STR, mandatory, "%u")
743 int something_parsed = 0;
746 if (!something_parsed)
757 if (have_delayed_token)
759 static const char yes[] =
"yes";
760 static const char no[] =
"no";
761 if (!memcmp (delayed_token, yes,
sizeof (yes) - 1))
765 else if (!memcmp (delayed_token, no,
sizeof (no) - 1))
773 "Unrecognized value for `%s' parameter: `%v'",
779 if (have_bfd_key_id && bfd_key_id > 255)
788 bfd_key_id, is_delayed);
793 "`bfd_udp_auth_activate' API call failed, rv=%d:%U",
804 .path =
"bfd udp session auth activate",
805 .short_help =
"bfd udp session auth activate"
806 " interface <interface>"
807 " local-addr <local-address>"
808 " peer-addr <peer-address>"
809 " conf-key-id <config key ID>"
810 " bfd-key-id <BFD key ID>"
811 " [ delayed <yes|no> ]",
821 #define foreach_bfd_cli_udp_session_auth_deactivate_cli_param(F) \
822 F (u32, sw_if_index, INTERFACE_STR, mandatory, "%U", \
823 unformat_vnet_sw_interface, &vnet_main) \
824 F (ip46_address_t, local_addr, LOCAL_ADDR_STR, mandatory, "%U", \
825 unformat_ip46_address) \
826 F (ip46_address_t, peer_addr, PEER_ADDR_STR, mandatory, "%U", \
827 unformat_ip46_address) \
828 F (u8 *, delayed_token, DELAYED_STR, optional, "%v")
838 int something_parsed = 0;
841 if (!something_parsed)
852 if (have_delayed_token)
854 static const char yes[] =
"yes";
855 static const char no[] =
"no";
856 if (!memcmp (delayed_token, yes,
sizeof (yes) - 1))
860 else if (!memcmp (delayed_token, no,
sizeof (no) - 1))
867 0,
"Unrecognized value for `%s' parameter: `%v'",
DELAYED_STR,
874 &peer_addr, is_delayed);
878 0,
"`bfd_udp_auth_deactivate' API call failed, rv=%d:%U", (
int)
rv,
889 .path =
"bfd udp session auth deactivate",
890 .short_help =
"bfd udp session auth deactivate"
891 " interface <interface>"
892 " local-addr <local-address>"
893 " peer-addr <peer-address>"
894 "[ delayed <yes|no> ]",
905 #define foreach_bfd_cli_udp_set_echo_source_cli_param(F) \
906 F (u32, sw_if_index, INTERFACE_STR, mandatory, "%U", \
907 unformat_vnet_sw_interface, &vnet_main)
917 int something_parsed = 0;
920 if (!something_parsed)
935 "`bfd_udp_set_echo_source' API call failed, rv=%d:%U",
946 .path =
"bfd udp echo-source set",
947 .short_help =
"bfd udp echo-source set interface <interface>",
960 "`bfd_udp_del_echo_source' API call failed, rv=%d:%U",
969 .path =
"bfd udp echo-source del",
970 .short_help =
"bfd udp echo-source del",
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
u64 remote_desired_min_tx_nsec
remote desired min tx interval (nsec)
static clib_error_t * bfd_cli_key_add(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
u64 last_rx_nsec
timestamp of last packet received
#define CHECK_MANDATORY(t, n, s, r,...)
bfd_diag_code_e remote_diag
remote diagnostics
static clib_error_t * bfd_cli_key_del(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
bfd_transport_e transport
transport type for this session
#define UNFORMAT(t, n, s, r,...)
static vlib_cli_command_t bfd_cli_udp_session_del_command
(constructor) VLIB_CLI_COMMAND (bfd_cli_udp_session_del_command)
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
#define foreach_bfd_cli_udp_session_mod_cli_param(F)
u64 last_tx_nsec
timestamp of last packet transmitted
static vlib_cli_command_t bfd_cli_udp_del_echo_source_cmd
(constructor) VLIB_CLI_COMMAND (bfd_cli_udp_del_echo_source_cmd)
static const unsigned optional
static clib_error_t * show_bfd(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
static vnet_sw_interface_t * vnet_get_sw_interface_or_null(vnet_main_t *vnm, u32 sw_if_index)
u32 config_desired_min_tx_usec
configured desired min tx interval (microseconds)
#define clib_error_return(e, args...)
static vlib_cli_command_t show_bfd_command
(constructor) VLIB_CLI_COMMAND (show_bfd_command)
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
u32 conf_key_id
global configuration key ID
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vlib_cli_command_t bfd_cli_key_del_command
(constructor) VLIB_CLI_COMMAND (bfd_cli_key_del_command)
const char * bfd_poll_state_string(bfd_poll_state_e state)
u64 transmit_interval_nsec
transmit interval
static u8 * format_vnet_api_errno(u8 *s, va_list *args)
#define foreach_bfd_cli_udp_session_set_flags_cli_param(F)
static u8 * format_bfd_session_cli(u8 *s, va_list *args)
u32 local_seq_number
sequence number incremented occasionally or always (if meticulous)
static clib_error_t * bfd_cli_udp_session_add(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
static clib_error_t * bfd_cli_udp_session_del(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
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 bs_idx
index in bfd_main.sessions pool
static vlib_cli_command_t bfd_cli_udp_set_echo_source_cmd
(constructor) VLIB_CLI_COMMAND (bfd_cli_udp_set_echo_source_cmd)
#define pool_foreach(VAR, POOL)
Iterate through pool.
static vlib_cli_command_t bfd_cli_udp_session_auth_activate_command
(constructor) VLIB_CLI_COMMAND (bfd_cli_udp_session_auth_activate_command)
u8 remote_detect_mult
remote detect multiplier
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static vlib_cli_command_t bfd_cli_udp_session_mod_command
(constructor) VLIB_CLI_COMMAND (bfd_cli_udp_session_mod_command)
u64 remote_min_echo_rx_usec
remote min echo rx interval (microseconds)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
bfd_state_e local_state
session state
u32 bfd_nsec_to_usec(u64 nsec)
u32 remote_seq_number
remote sequence number
const char * bfd_auth_type_str(bfd_auth_type_e auth_type)
#define foreach_bfd_cli_udp_session_auth_activate_cli_param(F)
bfd_session_t * sessions
pool of bfd sessions context data
static clib_error_t * bfd_cli_udp_session_mod(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
bfd_auth_key_t * curr_key
current key in use
#define VLIB_CLI_COMMAND(x,...)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
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
#define foreach_bfd_cli_udp_session_del_cli_param(F)
const char * bfd_diag_code_string(bfd_diag_code_e diag)
#define DECLARE(t, n, s, r,...)
#define foreach_bfd_cli_udp_session_add_cli_param(F)
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
#define vec_free(V)
Free vector's memory (no header).
u8 curr_bfd_key_id
current key ID sent out in bfd packet
#define foreach_bfd_cli_udp_session_auth_deactivate_cli_param(F)
u8 local_detect_mult
configured detect multiplier
vnet_api_error_t bfd_auth_del_key(u32 conf_key_id)
delete existing authentication key
description fragment has unexpected format
bfd_diag_code_e local_diag
local diagnostics
static clib_error_t * bfd_cli_udp_session_auth_activate(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
static clib_error_t * bfd_cli_udp_session_auth_deactivate(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
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
u8 remote_demand
1 if remote system sets demand mode, 0 otherwise
static vlib_cli_command_t bfd_cli_udp_session_auth_deactivate_command
(constructor) VLIB_CLI_COMMAND (bfd_cli_udp_session_auth_deactivate_command)
bfd_udp_key_t key
key identifying this 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
static vlib_cli_command_t bfd_cli_udp_session_add_command
(constructor) VLIB_CLI_COMMAND (bfd_cli_udp_session_add_command)
bfd_state_e remote_state
remote session state
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 uword pool_elts(void *v)
Number of active elements in a pool.
static clib_error_t * bfd_cli_udp_session_set_flags(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
static vlib_cli_command_t bfd_cli_key_add_command
(constructor) VLIB_CLI_COMMAND (bfd_cli_key_add_command)
static vlib_cli_command_t bfd_cli_udp_session_set_flags_command
(constructor) VLIB_CLI_COMMAND (bfd_cli_udp_session_set_flags_command)
#define foreach_bfd_cli_udp_set_echo_source_cli_param(F)
vnet_api_error_t bfd_udp_del_echo_source()
unset echo-source interface
bfd_poll_state_e poll_state
state info regarding poll sequence
const char * bfd_state_string(bfd_state_e state)
static clib_error_t * bfd_cli_udp_set_echo_source(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
u64 remote_min_rx_usec
remote min rx interval (microseconds)
struct bfd_session_s::@149 auth
authentication information
u32 config_required_min_rx_usec
configured required min rx interval (microseconds)
static u64 clib_cpu_time_now(void)
static const unsigned mandatory
vl_api_interface_index_t sw_if_index
bfd_auth_key_t * auth_keys
pool of authentication keys
vnet_api_error_t bfd_udp_set_echo_source(u32 loopback_sw_if_index)
set echo-source interface
u64 echo_last_tx_nsec
timestamp of last echo packet transmitted
u64 echo_transmit_interval_nsec
transmit interval for echo packets
static clib_error_t * bfd_cli_udp_del_echo_source(vlib_main_t *vm, unformat_input_t *input, CLIB_UNUSED(vlib_cli_command_t *lmd))
u64 echo_last_rx_nsec
timestamp of last echo packet received
u8 echo
1 is echo function is active, 0 otherwise