82 return VNET_API_ERROR_BFD_ENOENT;
98 BFD_DBG (
"UDP echo source not set - echo not available");
111 if (BFD_TRANSPORT_UDP4 == transport)
119 if (ia->address_length <= 31)
126 else if (BFD_TRANSPORT_UDP6 == transport)
134 if (ia->address_length <= 127)
142 BFD_DBG (
"No usable IP address for UDP echo - echo not available");
157 return 49152 + bs_idx % (65535 - 49152 + 1);
165 BFD_ERR (
"cannot find ip4 address, echo source not set");
176 ip_interface_address_get_address (&im->lookup_main, ia);
177 if (ia->address_length <= 31)
179 addr->as_u32 = clib_host_to_net_u32 (x->as_u32);
185 addr->as_u32 = clib_net_to_host_u32 (addr->as_u32);
190 BFD_ERR (
"cannot find ip4 address, no usable address found");
199 BFD_ERR (
"cannot find ip6 address, echo source not set");
210 ip_interface_address_get_address (&im->lookup_main, ia);
211 if (ia->address_length <= 127)
214 addr->as_u8[15] ^= 1;
219 BFD_ERR (
"cannot find ip6 address, no usable address found");
246 const bfd_udp_key_t *key = &bus->
key;
259 ip4_udp_headers *headers =
NULL;
262 memset (headers, 0,
sizeof (*headers));
263 headers->ip4.ip_version_and_header_length = 0x45;
264 headers->ip4.ttl = 255;
265 headers->ip4.protocol = IP_PROTOCOL_UDP;
266 headers->udp.src_port =
275 headers->ip4.dst_address.as_u32 = key->local_addr.ip4.as_u32;
276 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd_echo4);
280 headers->ip4.src_address.as_u32 = key->local_addr.ip4.as_u32;
281 headers->ip4.dst_address.as_u32 = key->peer_addr.ip4.as_u32;
282 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd4);
288 headers->ip4.length = clib_host_to_net_u16 (ip_length);
291 const u16 udp_length = ip_length - (
sizeof (headers->ip4));
292 headers->udp.length = clib_host_to_net_u16 (udp_length);
301 const bfd_udp_key_t *key = &bus->
key;
314 ip6_udp_headers *headers =
NULL;
317 memset (headers, 0,
sizeof (*headers));
318 headers->ip6.ip_version_traffic_class_and_flow_label =
319 clib_host_to_net_u32 (0x6 << 28);
320 headers->ip6.hop_limit = 255;
321 headers->ip6.protocol = IP_PROTOCOL_UDP;
322 headers->udp.src_port =
331 clib_memcpy (&headers->ip6.dst_address, &key->local_addr.ip6,
332 sizeof (headers->ip6.dst_address));
334 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd_echo6);
338 clib_memcpy (&headers->ip6.src_address, &key->local_addr.ip6,
339 sizeof (headers->ip6.src_address));
340 clib_memcpy (&headers->ip6.dst_address, &key->peer_addr.ip6,
341 sizeof (headers->ip6.dst_address));
342 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd6);
346 const u16 udp_length =
348 headers->udp.length = clib_host_to_net_u16 (udp_length);
349 headers->ip6.payload_length = headers->udp.length;
353 headers->udp.checksum =
356 if (headers->udp.checksum == 0)
358 headers->udp.checksum = 0xffff;
383 case BFD_TRANSPORT_UDP4:
386 case BFD_TRANSPORT_UDP6:
394 case BFD_TRANSPORT_UDP4:
397 case BFD_TRANSPORT_UDP6:
446 const ip46_address_t * local_addr,
447 const ip46_address_t * peer_addr)
449 memset (key, 0,
sizeof (*key));
450 key->sw_if_index = sw_if_index;
451 key->local_addr.as_u64[0] = local_addr->as_u64[0];
452 key->local_addr.as_u64[1] = local_addr->as_u64[1];
453 key->peer_addr.as_u64[0] = peer_addr->as_u64[0];
454 key->peer_addr.as_u64[1] = peer_addr->as_u64[1];
459 u32 desired_min_tx_usec,
460 u32 required_min_rx_usec,
u8 detect_mult,
461 const ip46_address_t * local_addr,
462 const ip46_address_t * peer_addr,
469 t = BFD_TRANSPORT_UDP6;
475 return VNET_API_ERROR_BFD_EAGAIN;
478 memset (bus, 0,
sizeof (*bus));
479 bfd_udp_key_t *key = &bus->
key;
484 clib_warning (
"duplicate bfd-udp session, existing bs_idx=%d",
487 return VNET_API_ERROR_BFD_EEXIST;
490 BFD_DBG (
"session created, bs_idx=%u, sw_if_index=%d, local=%U, peer=%U",
494 if (BFD_TRANSPORT_UDP4 == t)
499 BFD_DBG (
"adj_nbr_add_or_lock(FIB_PROTOCOL_IP4, VNET_LINK_IP4, %U, %d) " 508 BFD_DBG (
"adj_nbr_add_or_lock(FIB_PROTOCOL_IP6, VNET_LINK_IP6, %U, %d) " 514 required_min_rx_usec, detect_mult);
519 const ip46_address_t * local_addr,
520 const ip46_address_t * peer_addr)
524 u8 local_ip_valid = 0;
529 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
536 return VNET_API_ERROR_INVALID_ARGUMENT;
544 ip_interface_address_get_address (&im->lookup_main, ia);
545 if (x->as_u32 == local_addr->ip4.as_u32)
559 return VNET_API_ERROR_INVALID_ARGUMENT;
566 ip_interface_address_get_address (&im->lookup_main, ia);
567 if (local_addr->ip6.as_u64[0] == x->as_u64[0] &&
568 local_addr->ip6.as_u64[1] == x->as_u64[1])
581 return VNET_API_ERROR_ADDRESS_NOT_FOUND_FOR_INTERFACE;
589 const ip46_address_t * local_addr,
590 const ip46_address_t * peer_addr,
608 (
"BFD session not found (sw_if_index=%u, local=%U, peer=%U",
611 return VNET_API_ERROR_BFD_ENOENT;
619 u32 required_min_rx_usec,
u8 detect_mult,
620 const ip46_address_t * local_addr,
621 const ip46_address_t * peer_addr)
632 return VNET_API_ERROR_INVALID_ARGUMENT;
634 if (desired_min_tx_usec < 1)
637 return VNET_API_ERROR_INVALID_ARGUMENT;
654 const ip46_address_t * peer_addr,
655 u32 desired_min_tx_usec,
u32 required_min_rx_usec,
656 u8 detect_mult,
u8 is_authenticated,
u32 conf_key_id,
661 required_min_rx_usec, detect_mult,
662 local_addr, peer_addr);
669 required_min_rx_usec, detect_mult,
670 local_addr, peer_addr, &bs);
672 if (!rv && is_authenticated)
678 clib_warning (
"SSL missing, cannot add authenticated BFD session");
679 rv = VNET_API_ERROR_BFD_NOTSUPP;
696 const ip46_address_t * local_addr,
697 const ip46_address_t * peer_addr,
698 u32 desired_min_tx_usec,
699 u32 required_min_rx_usec,
u8 detect_mult)
711 desired_min_tx_usec, required_min_rx_usec,
717 const ip46_address_t * local_addr,
718 const ip46_address_t * peer_addr)
734 const ip46_address_t * local_addr,
735 const ip46_address_t * peer_addr,
u8 admin_up_down)
751 const ip46_address_t * local_addr,
752 const ip46_address_t * peer_addr,
753 u32 conf_key_id,
u8 key_id,
u8 is_delayed)
766 clib_warning (
"SSL missing, cannot activate BFD authentication");
767 return VNET_API_ERROR_BFD_NOTSUPP;
773 const ip46_address_t * local_addr,
774 const ip46_address_t * peer_addr,
u8 is_delayed)
796 #define foreach_bfd_udp_error(F) \ 797 F (NONE, "good bfd packets (processed)") \ 798 F (BAD, "invalid bfd packets") 800 #define F(sym, string) static char BFD_UDP_ERR_##sym##_STR[] = string; 805 #define F(sym, string) BFD_UDP_ERR_##sym##_STR, 812 #define F(sym, str) BFD_UDP_ERROR_##sym, 819 #define foreach_bfd_udp_echo_error(F) \ 820 F (NONE, "good bfd echo packets (processed)") \ 821 F (BAD, "invalid bfd echo packets") 823 #define F(sym, string) static char BFD_UDP_ECHO_ERR_##sym##_STR[] = string; 828 #define F(sym, string) BFD_UDP_ECHO_ERR_##sym##_STR, 835 #define F(sym, str) BFD_UDP_ECHO_ERROR_##sym, 838 BFD_UDP_ECHO_N_ERROR,
847 if (start < 0 && start <
sizeof (b->
pre_data))
849 BFD_ERR (
"Start of ip header is before pre_data, ignoring");
857 BFD_ERR (
"Start of ip header is beyond current data, ignoring");
865 static bfd_udp_error_t
870 const bfd_udp_key_t *key = &bus->
key;
873 BFD_ERR (
"IPv4 src addr mismatch, got %U, expected %U",
875 key->peer_addr.ip4.as_u8);
876 return BFD_UDP_ERROR_BAD;
880 BFD_ERR (
"IPv4 dst addr mismatch, got %U, expected %U",
882 key->local_addr.ip4.as_u8);
883 return BFD_UDP_ERROR_BAD;
885 const u8 expected_ttl = 255;
886 if (ip4->
ttl != expected_ttl)
888 BFD_ERR (
"IPv4 unexpected TTL value %u, expected %u", ip4->
ttl,
890 return BFD_UDP_ERROR_BAD;
892 if (clib_net_to_host_u16 (udp->
src_port) < 49152)
894 BFD_ERR (
"Invalid UDP src port %u, out of range <49152,65535>",
897 return BFD_UDP_ERROR_NONE;
925 static bfd_udp_error_t
933 (
"Payload size %d too small to hold bfd packet of minimum size %d",
935 return BFD_UDP_ERROR_BAD;
942 BFD_ERR (
"Couldn't find ip4 or udp header");
943 return BFD_UDP_ERROR_BAD;
945 const u32 udp_payload_length = udp->
length -
sizeof (*udp);
946 if (pkt->head.length > udp_payload_length)
949 (
"BFD packet length is larger than udp payload length (%u > %u)",
950 pkt->head.length, udp_payload_length);
951 return BFD_UDP_ERROR_BAD;
955 return BFD_UDP_ERROR_BAD;
960 BFD_DBG (
"Looking up BFD session using discriminator %u",
967 memset (&key, 0,
sizeof (key));
971 BFD_DBG (
"Looking up BFD session using key (sw_if_index=%u, local=%U, " 979 BFD_ERR (
"BFD session lookup failed - no session matches BFD pkt");
980 return BFD_UDP_ERROR_BAD;
985 BFD_ERR (
"Packet verification failed, dropping packet");
986 return BFD_UDP_ERROR_BAD;
995 return BFD_UDP_ERROR_NONE;
1004 if (start < 0 && start <
sizeof (b->
pre_data))
1006 BFD_ERR (
"Start of ip header is before pre_data, ignoring");
1014 BFD_ERR (
"Start of ip header is beyond current data, ignoring");
1019 if ((*ip6)->protocol != IP_PROTOCOL_UDP)
1021 BFD_ERR (
"Unexpected protocol in IPv6 header '%u', expected '%u' (== " 1022 "IP_PROTOCOL_UDP)", (*ip6)->protocol, IP_PROTOCOL_UDP);
1030 static bfd_udp_error_t
1035 const bfd_udp_key_t *key = &bus->
key;
1039 BFD_ERR (
"IP src addr mismatch, got %U, expected %U",
1041 &key->peer_addr.ip6);
1042 return BFD_UDP_ERROR_BAD;
1047 BFD_ERR (
"IP dst addr mismatch, got %U, expected %U",
1049 &key->local_addr.ip6);
1050 return BFD_UDP_ERROR_BAD;
1052 const u8 expected_hop_limit = 255;
1053 if (ip6->
hop_limit != expected_hop_limit)
1055 BFD_ERR (
"IPv6 unexpected hop-limit value %u, expected %u",
1057 return BFD_UDP_ERROR_BAD;
1059 if (clib_net_to_host_u16 (udp->
src_port) < 49152)
1061 BFD_ERR (
"Invalid UDP src port %u, out of range <49152,65535>",
1064 return BFD_UDP_ERROR_NONE;
1067 static bfd_udp_error_t
1075 (
"Payload size %d too small to hold bfd packet of minimum size %d",
1077 return BFD_UDP_ERROR_BAD;
1084 BFD_ERR (
"Couldn't find ip6 or udp header");
1085 return BFD_UDP_ERROR_BAD;
1087 const u32 udp_payload_length = udp->
length -
sizeof (*udp);
1088 if (pkt->head.length > udp_payload_length)
1091 (
"BFD packet length is larger than udp payload length (%u > %u)",
1092 pkt->head.length, udp_payload_length);
1093 return BFD_UDP_ERROR_BAD;
1097 return BFD_UDP_ERROR_BAD;
1102 BFD_DBG (
"Looking up BFD session using discriminator %u",
1109 memset (&key, 0,
sizeof (key));
1115 BFD_DBG (
"Looking up BFD session using key (sw_if_index=%u, local=%U, " 1123 BFD_ERR (
"BFD session lookup failed - no session matches BFD pkt");
1124 return BFD_UDP_ERROR_BAD;
1129 BFD_ERR (
"Packet verification failed, dropping packet");
1130 return BFD_UDP_ERROR_BAD;
1132 bfd_udp_error_t err;
1139 return BFD_UDP_ERROR_NONE;
1150 u32 n_left_from, *from;
1156 while (n_left_from > 0)
1173 :
sizeof (t0->
data);
1190 if (BFD_UDP_ERROR_NONE == error0)
1252 .name =
"bfd-udp4-input",
1253 .vector_size =
sizeof (
u32),
1256 .n_errors = BFD_UDP_N_ERROR,
1280 .name =
"bfd-udp6-input",
1281 .vector_size =
sizeof (
u32),
1284 .n_errors = BFD_UDP_N_ERROR,
1307 u32 n_left_from, *from;
1313 while (n_left_from > 0)
1328 :
sizeof (t0->
data);
1380 s =
format (s,
"BFD ECHO:\n");
1393 .name =
"bfd-udp-echo4-input",
1394 .vector_size =
sizeof (
u32),
1397 .n_errors = BFD_UDP_ECHO_N_ERROR,
1422 .name =
"bfd-udp-echo6-input",
1423 .vector_size =
sizeof (
u32),
1426 .n_errors = BFD_UDP_ECHO_N_ERROR,
1427 .error_strings = bfd_udp_echo_error_strings,
1474 sizeof (bfd_udp_key_t));
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)
static uword bfd_udp_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f, int is_ipv6)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
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)
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.
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
static vlib_node_registration_t bfd_udp4_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp4_input_node)
struct _vlib_node_registration vlib_node_registration_t
void bfd_put_session(bfd_main_t *bm, bfd_session_t *bs)
ip_lookup_main_t lookup_main
static vlib_node_registration_t bfd_udp6_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp6_input_node)
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)
#define VNET_HW_INTERFACE_FLAG_LINK_UP
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)
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[]
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
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
UDP transport specific data embedded in bfd_session's union.
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
static clib_error_t * bfd_hw_interface_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
static void bfd_rpc_update_session_cb(const bfd_rpc_update_t *a)
bfd_session_t * bfd_find_session_by_idx(bfd_main_t *bm, uword bs_idx)
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_udp_key_t key
key identifying this session
bfd_transport_e transport
transport type for this session
u16 current_length
Nbytes between current data and the end of this buffer.
vnet_api_error_t bfd_udp_set_echo_source(u32 sw_if_index)
set echo-source interface
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)
static clib_error_t * bfd_sw_interface_up_down(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(bfd_hw_interface_up_down)
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)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
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)
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
#define VNET_BUFFER_LOCALLY_ORIGINATED
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(bfd_sw_interface_up_down)
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)
#define clib_warning(format, args...)
#define VLIB_BUFFER_IS_TRACED
#define clib_memcpy(a, b, c)
static vnet_sw_interface_t * vnet_get_sw_interface_safe(vnet_main_t *vnm, u32 sw_if_index)
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)
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
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.
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
static bfd_udp_error_t bfd_udp6_verify_transport(const ip6_header_t *ip6, const udp_header_t *udp, const bfd_session_t *bs)
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)
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)
static vnet_api_error_t bfd_udp_add_session_internal(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)
BFD UDP transport layer declarations.
ip_lookup_next_t lookup_next_index
int bfd_udp_calc_next_node(const struct bfd_session_s *bs, u32 *next_node)
static void bfd_udp_del_session_internal(bfd_session_t *bs)
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
#define VLIB_REGISTER_NODE(x,...)
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)
This packet is to be rewritten and forwarded to the next processing node.
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.
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)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static void bfd_rpc_update_session(u32 bs_idx, const bfd_pkt_t *pkt)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
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 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)
void bfd_session_set_flags(bfd_session_t *bs, u8 admin_up_down)