88 return VNET_API_ERROR_BFD_ENOENT;
104 BFD_DBG (
"UDP echo source not set - echo not available");
117 if (BFD_TRANSPORT_UDP4 == transport)
125 if (ia->address_length <= 31)
132 else if (BFD_TRANSPORT_UDP6 == transport)
140 if (ia->address_length <= 127)
148 BFD_DBG (
"No usable IP address for UDP echo - echo not available");
163 return 49152 + bs_idx % (65535 - 49152 + 1);
171 BFD_ERR (
"cannot find ip4 address, echo source not set");
182 ip_interface_address_get_address (&im->lookup_main, ia);
183 if (ia->address_length <= 31)
185 addr->as_u32 = clib_host_to_net_u32 (x->as_u32);
191 addr->as_u32 = clib_net_to_host_u32 (addr->as_u32);
196 BFD_ERR (
"cannot find ip4 address, no usable address found");
205 BFD_ERR (
"cannot find ip6 address, echo source not set");
216 ip_interface_address_get_address (&im->lookup_main, ia);
217 if (ia->address_length <= 127)
220 addr->as_u8[15] ^= 1;
225 BFD_ERR (
"cannot find ip6 address, no usable address found");
252 const bfd_udp_key_t *
key = &bus->
key;
255 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
265 ip4_udp_headers *headers =
NULL;
269 headers->ip4.ip_version_and_header_length = 0x45;
270 headers->ip4.ttl = 255;
271 headers->ip4.protocol = IP_PROTOCOL_UDP;
272 headers->udp.src_port =
281 headers->ip4.dst_address.as_u32 = key->local_addr.ip4.as_u32;
282 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd_echo4);
286 headers->ip4.src_address.as_u32 = key->local_addr.ip4.as_u32;
287 headers->ip4.dst_address.as_u32 = key->peer_addr.ip4.as_u32;
288 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd4);
294 headers->ip4.length = clib_host_to_net_u16 (ip_length);
297 const u16 udp_length = ip_length - (
sizeof (headers->ip4));
298 headers->udp.length = clib_host_to_net_u16 (udp_length);
307 const bfd_udp_key_t *
key = &bus->
key;
310 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
320 ip6_udp_headers *headers =
NULL;
324 headers->ip6.ip_version_traffic_class_and_flow_label =
325 clib_host_to_net_u32 (0x6 << 28);
326 headers->ip6.hop_limit = 255;
327 headers->ip6.protocol = IP_PROTOCOL_UDP;
328 headers->udp.src_port =
338 sizeof (headers->ip6.dst_address));
340 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd_echo6);
345 sizeof (headers->ip6.src_address));
347 sizeof (headers->ip6.dst_address));
348 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd6);
352 const u16 udp_length =
354 headers->udp.length = clib_host_to_net_u16 (udp_length);
355 headers->ip6.payload_length = headers->udp.length;
359 headers->udp.checksum =
362 if (headers->udp.checksum == 0)
364 headers->udp.checksum = 0xffff;
389 case BFD_TRANSPORT_UDP4:
392 case BFD_TRANSPORT_UDP6:
400 case BFD_TRANSPORT_UDP4:
403 case BFD_TRANSPORT_UDP6:
452 const ip46_address_t * local_addr,
453 const ip46_address_t * peer_addr)
457 key->local_addr.as_u64[0] = local_addr->as_u64[0];
458 key->local_addr.as_u64[1] = local_addr->as_u64[1];
459 key->peer_addr.as_u64[0] = peer_addr->as_u64[0];
460 key->peer_addr.as_u64[1] = peer_addr->as_u64[1];
466 u32 required_min_rx_usec,
u8 detect_mult,
467 const ip46_address_t * local_addr,
468 const ip46_address_t * peer_addr,
475 t = BFD_TRANSPORT_UDP6;
480 return VNET_API_ERROR_BFD_EAGAIN;
484 bfd_udp_key_t *
key = &bus->
key;
490 "duplicate bfd-udp session, existing bs_idx=%d",
493 return VNET_API_ERROR_BFD_EEXIST;
496 BFD_DBG (
"session created, bs_idx=%u, sw_if_index=%d, local=%U, peer=%U",
502 if (BFD_TRANSPORT_UDP4 == t)
507 BFD_DBG (
"adj_nbr_add_or_lock(FIB_PROTOCOL_IP4, VNET_LINK_IP4, %U, %d) " 524 BFD_DBG (
"adj_nbr_add_or_lock(FIB_PROTOCOL_IP6, VNET_LINK_IP6, %U, %d) " 538 required_min_rx_usec, detect_mult);
543 const ip46_address_t * local_addr,
544 const ip46_address_t * peer_addr)
549 u8 local_ip_valid = 0;
554 "got NULL sw_if when getting interface by index %u",
556 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
563 "IP family mismatch (local is ipv4, peer is ipv6)");
564 return VNET_API_ERROR_INVALID_ARGUMENT;
572 ip_interface_address_get_address (&im->lookup_main, ia);
573 if (x->as_u32 == local_addr->ip4.as_u32)
587 "IP family mismatch (local is ipv6, peer is ipv4)");
588 return VNET_API_ERROR_INVALID_ARGUMENT;
595 ip_interface_address_get_address (&im->lookup_main, ia);
596 if (local_addr->ip6.as_u64[0] == x->as_u64[0] &&
597 local_addr->ip6.as_u64[1] == x->as_u64[1])
610 "local address %U not found on interface with index %u",
613 return VNET_API_ERROR_ADDRESS_NOT_FOUND_FOR_INTERFACE;
621 const ip46_address_t * local_addr,
622 const ip46_address_t * peer_addr,
640 "BFD session not found, sw_if_index=%u, local=%U, peer=%U",
644 return VNET_API_ERROR_BFD_ENOENT;
652 u32 required_min_rx_usec,
u8 detect_mult,
653 const ip46_address_t * local_addr,
654 const ip46_address_t * peer_addr)
666 return VNET_API_ERROR_INVALID_ARGUMENT;
668 if (desired_min_tx_usec < 1)
671 return VNET_API_ERROR_INVALID_ARGUMENT;
685 case BFD_TRANSPORT_UDP4:
693 case BFD_TRANSPORT_UDP6:
707 const ip46_address_t * peer_addr,
708 u32 desired_min_tx_usec,
u32 required_min_rx_usec,
709 u8 detect_mult,
u8 is_authenticated,
u32 conf_key_id,
717 required_min_rx_usec, detect_mult,
718 local_addr, peer_addr);
724 sw_if_index, desired_min_tx_usec,
725 required_min_rx_usec, detect_mult,
726 local_addr, peer_addr, &bs);
728 if (!rv && is_authenticated)
735 "SSL missing, cannot add authenticated BFD session");
736 rv = VNET_API_ERROR_BFD_NOTSUPP;
754 const ip46_address_t * local_addr,
755 const ip46_address_t * peer_addr,
756 u32 desired_min_tx_usec,
757 u32 required_min_rx_usec,
u8 detect_mult)
773 desired_min_tx_usec, required_min_rx_usec,
781 const ip46_address_t * local_addr,
782 const ip46_address_t * peer_addr)
802 const ip46_address_t * local_addr,
803 const ip46_address_t * peer_addr,
u8 admin_up_down)
823 const ip46_address_t * local_addr,
824 const ip46_address_t * peer_addr,
825 u32 conf_key_id,
u8 key_id,
u8 is_delayed)
846 "SSL missing, cannot activate BFD authentication");
848 return VNET_API_ERROR_BFD_NOTSUPP;
854 const ip46_address_t * local_addr,
855 const ip46_address_t * peer_addr,
u8 is_delayed)
883 #define foreach_bfd_udp_error(F) \ 884 F (NONE, "good bfd packets (processed)") \ 885 F (BAD, "invalid bfd packets") 887 #define F(sym, string) static char BFD_UDP_ERR_##sym##_STR[] = string; 892 #define F(sym, string) BFD_UDP_ERR_##sym##_STR, 899 #define F(sym, str) BFD_UDP_ERROR_##sym, 906 #define foreach_bfd_udp_echo_error(F) \ 907 F (NONE, "good bfd echo packets (processed)") \ 908 F (BAD, "invalid bfd echo packets") 910 #define F(sym, string) static char BFD_UDP_ECHO_ERR_##sym##_STR[] = string; 915 #define F(sym, string) BFD_UDP_ECHO_ERR_##sym##_STR, 922 #define F(sym, str) BFD_UDP_ECHO_ERROR_##sym, 925 BFD_UDP_ECHO_N_ERROR,
934 if (start < 0 && start <
sizeof (b->
pre_data))
936 BFD_ERR (
"Start of ip header is before pre_data, ignoring");
944 BFD_ERR (
"Start of ip header is beyond current data, ignoring");
952 static bfd_udp_error_t
957 const bfd_udp_key_t *
key = &bus->
key;
960 BFD_ERR (
"IPv4 src addr mismatch, got %U, expected %U",
962 key->peer_addr.ip4.as_u8);
963 return BFD_UDP_ERROR_BAD;
967 BFD_ERR (
"IPv4 dst addr mismatch, got %U, expected %U",
969 key->local_addr.ip4.as_u8);
970 return BFD_UDP_ERROR_BAD;
972 const u8 expected_ttl = 255;
973 if (ip4->
ttl != expected_ttl)
975 BFD_ERR (
"IPv4 unexpected TTL value %u, expected %u", ip4->
ttl,
977 return BFD_UDP_ERROR_BAD;
979 if (clib_net_to_host_u16 (udp->
src_port) < 49152)
981 BFD_ERR (
"Invalid UDP src port %u, out of range <49152,65535>",
984 return BFD_UDP_ERROR_NONE;
1002 static bfd_udp_error_t
1010 (
"Payload size %d too small to hold bfd packet of minimum size %d",
1012 return BFD_UDP_ERROR_BAD;
1019 BFD_ERR (
"Couldn't find ip4 or udp header");
1020 return BFD_UDP_ERROR_BAD;
1022 const u32 udp_payload_length = udp->
length -
sizeof (*udp);
1023 if (pkt->head.length > udp_payload_length)
1026 (
"BFD packet length is larger than udp payload length (%u > %u)",
1027 pkt->head.length, udp_payload_length);
1028 return BFD_UDP_ERROR_BAD;
1032 return BFD_UDP_ERROR_BAD;
1037 BFD_DBG (
"Looking up BFD session using discriminator %u",
1048 BFD_DBG (
"Looking up BFD session using key (sw_if_index=%u, local=%U, " 1056 BFD_ERR (
"BFD session lookup failed - no session matches BFD pkt");
1057 return BFD_UDP_ERROR_BAD;
1062 BFD_ERR (
"Packet verification failed, dropping packet");
1063 return BFD_UDP_ERROR_BAD;
1065 bfd_udp_error_t err;
1072 return BFD_UDP_ERROR_NONE;
1081 if (start < 0 && start <
sizeof (b->
pre_data))
1083 BFD_ERR (
"Start of ip header is before pre_data, ignoring");
1091 BFD_ERR (
"Start of ip header is beyond current data, ignoring");
1096 if ((*ip6)->protocol != IP_PROTOCOL_UDP)
1098 BFD_ERR (
"Unexpected protocol in IPv6 header '%u', expected '%u' (== " 1099 "IP_PROTOCOL_UDP)", (*ip6)->protocol, IP_PROTOCOL_UDP);
1107 static bfd_udp_error_t
1112 const bfd_udp_key_t *
key = &bus->
key;
1116 BFD_ERR (
"IP src addr mismatch, got %U, expected %U",
1118 &key->peer_addr.ip6);
1119 return BFD_UDP_ERROR_BAD;
1124 BFD_ERR (
"IP dst addr mismatch, got %U, expected %U",
1126 &key->local_addr.ip6);
1127 return BFD_UDP_ERROR_BAD;
1129 const u8 expected_hop_limit = 255;
1130 if (ip6->
hop_limit != expected_hop_limit)
1132 BFD_ERR (
"IPv6 unexpected hop-limit value %u, expected %u",
1134 return BFD_UDP_ERROR_BAD;
1136 if (clib_net_to_host_u16 (udp->
src_port) < 49152)
1138 BFD_ERR (
"Invalid UDP src port %u, out of range <49152,65535>",
1141 return BFD_UDP_ERROR_NONE;
1144 static bfd_udp_error_t
1152 (
"Payload size %d too small to hold bfd packet of minimum size %d",
1154 return BFD_UDP_ERROR_BAD;
1161 BFD_ERR (
"Couldn't find ip6 or udp header");
1162 return BFD_UDP_ERROR_BAD;
1164 const u32 udp_payload_length = udp->
length -
sizeof (*udp);
1165 if (pkt->head.length > udp_payload_length)
1168 (
"BFD packet length is larger than udp payload length (%u > %u)",
1169 pkt->head.length, udp_payload_length);
1170 return BFD_UDP_ERROR_BAD;
1174 return BFD_UDP_ERROR_BAD;
1179 BFD_DBG (
"Looking up BFD session using discriminator %u",
1192 BFD_DBG (
"Looking up BFD session using key (sw_if_index=%u, local=%U, " 1200 BFD_ERR (
"BFD session lookup failed - no session matches BFD pkt");
1201 return BFD_UDP_ERROR_BAD;
1206 BFD_ERR (
"Packet verification failed, dropping packet");
1207 return BFD_UDP_ERROR_BAD;
1209 bfd_udp_error_t err;
1216 return BFD_UDP_ERROR_NONE;
1227 u32 n_left_from, *from;
1234 while (n_left_from > 0)
1246 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
1251 :
sizeof (t0->
data);
1269 if (BFD_UDP_ERROR_NONE == error0)
1331 .name =
"bfd-udp4-input",
1332 .vector_size =
sizeof (
u32),
1335 .n_errors = BFD_UDP_N_ERROR,
1359 .name =
"bfd-udp6-input",
1360 .vector_size =
sizeof (
u32),
1363 .n_errors = BFD_UDP_N_ERROR,
1386 u32 n_left_from, *from;
1393 while (n_left_from > 0)
1403 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
1408 :
sizeof (t0->
data);
1462 s =
format (s,
"BFD ECHO:\n");
1475 .name =
"bfd-udp-echo4-input",
1476 .vector_size =
sizeof (
u32),
1479 .n_errors = BFD_UDP_ECHO_N_ERROR,
1504 .name =
"bfd-udp-echo6-input",
1505 .vector_size =
sizeof (
u32),
1508 .n_errors = BFD_UDP_ECHO_N_ERROR,
1509 .error_strings = bfd_udp_echo_error_strings,
1529 BFD_DBG (
"sw_if_add_del called, sw_if_index=%u, is_create=%u", sw_if_index,
1536 if (bs->transport != BFD_TRANSPORT_UDP4 &&
1537 bs->transport != BFD_TRANSPORT_UDP6)
1540 if (bs->
udp.
key.sw_if_index != sw_if_index)
1550 "removal of sw_if_index=%u forces removal of bfd session " 1569 sizeof (bfd_udp_key_t));
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
static clib_error_t * bfd_udp_init(vlib_main_t *vm)
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 key_id, u8 is_delayed)
activate authentication for existing session
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static uword bfd_udp_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f, int is_ipv6)
bfd_session_t * bfd_get_session(bfd_main_t *bm, bfd_transport_e t)
static char * bfd_udp_echo_error_strings[]
static vnet_api_error_t bfd_api_verify_common(u32 sw_if_index, u32 desired_min_tx_usec, u32 required_min_rx_usec, u8 detect_mult, const ip46_address_t *local_addr, const ip46_address_t *peer_addr)
void bfd_consume_pkt(bfd_main_t *bm, const bfd_pkt_t *pkt, u32 bs_idx)
static uword bfd_udp_echo6_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
vnet_main_t * vnet_get_main(void)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
bfd_session_t * bfd_find_session_by_disc(bfd_main_t *bm, u32 disc)
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
#define clib_memcpy_fast(a, b, c)
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
int bfd_verify_pkt_common(const bfd_pkt_t *pkt)
verify bfd packet - common checks
u16 current_length
Nbytes between current data and the end of this buffer.
This packet is to be rewritten and forwarded to the next processing node.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static vlib_node_registration_t bfd_udp4_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp4_input_node)
void bfd_put_session(bfd_main_t *bm, bfd_session_t *bs)
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
ip_lookup_main_t lookup_main
static vlib_node_registration_t bfd_udp6_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp6_input_node)
static void bfd_unlock(bfd_main_t *bm)
static bfd_udp_error_t bfd_udp6_scan(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_buffer_t *b, bfd_session_t **bs_out)
#define foreach_bfd_udp_error(F)
void bfd_init_final_control_frame(vlib_main_t *vm, vlib_buffer_t *b, bfd_main_t *bm, bfd_session_t *bs, int is_local)
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(bfd_udp_sw_if_add_del)
static uword bfd_udp4_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
u32 echo_source_sw_if_index
static vnet_api_error_t bfd_udp_validate_api_input(u32 sw_if_index, const ip46_address_t *local_addr, const ip46_address_t *peer_addr)
static uword bfd_udp_echo_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f, int is_ipv6)
int bfd_add_udp4_transport(vlib_main_t *vm, u32 bi, const bfd_session_t *bs, int is_echo)
#define foreach_bfd_udp_echo_error(F)
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
vnet_api_error_t bfd_auth_deactivate(bfd_session_t *bs, u8 is_delayed)
mhash_t bfd_session_idx_by_bfd_key
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
vnet_api_error_t bfd_udp_del_echo_source(u32 sw_if_index)
static char * bfd_udp_error_strings[]
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static void bfd_udp_del_session_internal(vlib_main_t *vm, bfd_session_t *bs)
static void bfd_udp6_find_headers(vlib_buffer_t *b, ip6_header_t **ip6, udp_header_t **udp)
#define VLIB_INIT_FUNCTION(x)
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
static void bfd_udp4_find_headers(vlib_buffer_t *b, ip4_header_t **ip4, udp_header_t **udp)
static bfd_session_t * bfd_lookup_session(bfd_udp_main_t *bum, const bfd_udp_key_t *key)
int bfd_transport_udp4(vlib_main_t *vm, u32 bi, const struct bfd_session_s *bs)
transport packet over udpv4
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
UDP transport specific data embedded in bfd_session's union.
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
#define vlib_log_debug(...)
bfd_session_t * bfd_find_session_by_idx(bfd_main_t *bm, uword bs_idx)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static vnet_api_error_t bfd_udp_find_session_by_api_input(u32 sw_if_index, const ip46_address_t *local_addr, const ip46_address_t *peer_addr, bfd_session_t **bs_out)
bfd_session_t * sessions
pool of bfd sessions context data
bfd_udp_key_t key
key identifying this session
bfd_transport_e transport
transport type for this session
static vnet_api_error_t bfd_udp_add_session_internal(vlib_main_t *vm, bfd_udp_main_t *bum, u32 sw_if_index, u32 desired_min_tx_usec, u32 required_min_rx_usec, u8 detect_mult, const ip46_address_t *local_addr, const ip46_address_t *peer_addr, bfd_session_t **bs_out)
vnet_api_error_t bfd_udp_set_echo_source(u32 sw_if_index)
set echo-source interface
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static vlib_node_registration_t bfd_udp_echo4_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp_echo4_input_node)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u8 * bfd_echo_input_format_trace(u8 *s, va_list *args)
vnet_sw_interface_flags_t flags
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
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
static bfd_udp_error_t bfd_udp4_scan(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_buffer_t *b, bfd_session_t **bs_out)
int bfd_transport_udp6(vlib_main_t *vm, u32 bi, const struct bfd_session_s *bs)
transport packet over udpv6
int bfd_add_udp6_transport(vlib_main_t *vm, u32 bi, const bfd_session_t *bs, int is_echo)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
void bfd_session_start(bfd_main_t *bm, bfd_session_t *bs)
#define ip46_address_is_ip4(ip46)
int bfd_udp_get_echo_src_ip6(ip6_address_t *addr)
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
#define VLIB_REGISTER_NODE(x,...)
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
vlib_log_class_t log_class
void udp_unregister_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u8 is_ip4)
static void bfd_create_frame_to_next_node(vlib_main_t *vm, u32 bi, u32 next_node)
static uword bfd_udp6_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
u8 * format_bfd_session(u8 *s, va_list *args)
vnet_api_error_t bfd_auth_activate(bfd_session_t *bs, u32 conf_key_id, u8 bfd_key_id, u8 is_delayed)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
static clib_error_t * bfd_udp_sw_if_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_create)
u8 * bfd_input_format_trace(u8 *s, va_list *args)
int bfd_udp_get_echo_src_ip4(ip4_address_t *addr)
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
vlib buffer structure definition and a few select access methods.
static bfd_udp_error_t bfd_udp6_verify_transport(const ip6_header_t *ip6, const udp_header_t *udp, const bfd_session_t *bs)
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
static uword * mhash_get(mhash_t *h, const void *key)
ip_lookup_main_t lookup_main
int bfd_udp_is_echo_available(bfd_transport_e transport)
check if the bfd udp layer is echo-capable at this time
static bfd_udp_error_t bfd_udp4_verify_transport(const ip4_header_t *ip4, const udp_header_t *udp, const bfd_session_t *bs)
adj_index_t adj_index
adjacency index returned from adj lock call
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static vlib_node_registration_t bfd_udp_echo6_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp_echo6_input_node)
bfd_udp_main_t bfd_udp_main
static u16 bfd_udp_bs_idx_to_sport(u32 bs_idx)
static vlib_main_t * vlib_get_main(void)
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
int bfd_consume_echo_pkt(bfd_main_t *bm, vlib_buffer_t *b)
vnet_api_error_t bfd_session_set_params(bfd_main_t *bm, bfd_session_t *bs, u32 desired_min_tx_usec, u32 required_min_rx_usec, u8 detect_mult)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
BFD UDP transport layer declarations.
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
int bfd_udp_calc_next_node(const struct bfd_session_s *bs, u32 *next_node)
VLIB buffer representation.
#define vlib_log_info(...)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
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
u8 bfd_pkt_get_poll(const bfd_pkt_t *pkt)
u32 bs_idx
index in bfd_main.sessions pool
ip4_main_t ip4_main
Global ip4 main structure.
static void bfd_udp_key_init(bfd_udp_key_t *key, u32 sw_if_index, const ip46_address_t *local_addr, const ip46_address_t *peer_addr)
#define STRUCT_SIZE_OF(t, f)
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
#define vec_foreach(var, vec)
Vector iterator.
#define vlib_log_err(...)
int bfd_verify_pkt_auth(const bfd_pkt_t *pkt, u16 pkt_size, bfd_session_t *bs)
verify bfd packet - authentication
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
static void bfd_rpc_update_session(u32 bs_idx, const bfd_pkt_t *pkt)
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
static uword bfd_udp_echo4_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static vnet_sw_interface_t * vnet_get_sw_interface_or_null(vnet_main_t *vnm, u32 sw_if_index)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip4_header_checksum(ip4_header_t *i)
static void bfd_lock(bfd_main_t *bm)
void bfd_session_set_flags(bfd_session_t *bs, u8 admin_up_down)
#define vlib_log_notice(...)