|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
93 return VNET_API_ERROR_BFD_ENOENT;
109 BFD_DBG (
"UDP echo source not set - echo not available");
122 if (BFD_TRANSPORT_UDP4 == transport)
130 if (ia->address_length <= 31)
137 else if (BFD_TRANSPORT_UDP6 == transport)
145 if (ia->address_length <= 127)
153 BFD_DBG (
"No usable IP address for UDP echo - echo not available");
168 return 49152 + bs_idx % (65535 - 49152 + 1);
176 BFD_ERR (
"cannot find ip4 address, echo source not set");
187 ip_interface_address_get_address (&im->lookup_main, ia);
188 if (ia->address_length <= 31)
190 addr->as_u32 = clib_host_to_net_u32 (x->as_u32);
196 addr->as_u32 = clib_net_to_host_u32 (addr->as_u32);
201 BFD_ERR (
"cannot find ip4 address, no usable address found");
210 BFD_ERR (
"cannot find ip6 address, echo source not set");
221 ip_interface_address_get_address (&im->lookup_main, ia);
222 if (ia->address_length <= 127)
225 addr->as_u8[15] ^= 1;
230 BFD_ERR (
"cannot find ip6 address, no usable address found");
237 int *have_usable_ip6, ip6_address_t *
ip6)
257 const bfd_udp_key_t *
key = &
bus->key;
260 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
270 ip4_udp_headers *headers = NULL;
274 headers->ip4.ip_version_and_header_length = 0x45;
275 headers->ip4.ttl = 255;
276 headers->ip4.protocol = IP_PROTOCOL_UDP;
277 headers->udp.src_port =
286 headers->ip4.dst_address.as_u32 =
key->local_addr.ip4.as_u32;
287 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd_echo4);
291 headers->ip4.src_address.as_u32 =
key->local_addr.ip4.as_u32;
292 headers->ip4.dst_address.as_u32 =
key->peer_addr.ip4.as_u32;
293 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd4);
299 headers->ip4.length = clib_host_to_net_u16 (ip_length);
302 const u16 udp_length = ip_length - (
sizeof (headers->ip4));
303 headers->udp.length = clib_host_to_net_u16 (udp_length);
312 const bfd_udp_key_t *
key = &
bus->key;
315 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
325 ip6_udp_headers *headers = NULL;
329 headers->ip6.ip_version_traffic_class_and_flow_label =
330 clib_host_to_net_u32 (0x6 << 28);
331 headers->ip6.hop_limit = 255;
332 headers->ip6.protocol = IP_PROTOCOL_UDP;
333 headers->udp.src_port =
343 sizeof (headers->ip6.dst_address));
345 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd_echo6);
350 sizeof (headers->ip6.src_address));
352 sizeof (headers->ip6.dst_address));
353 headers->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_bfd6);
357 const u16 udp_length =
359 headers->udp.length = clib_host_to_net_u16 (udp_length);
360 headers->ip6.payload_length = headers->udp.length;
364 headers->udp.checksum =
367 if (headers->udp.checksum == 0)
369 headers->udp.checksum = 0xffff;
400 case BFD_TRANSPORT_UDP4:
403 case BFD_TRANSPORT_UDP6:
411 case BFD_TRANSPORT_UDP4:
414 case BFD_TRANSPORT_UDP6:
422 case BFD_TRANSPORT_UDP4:
425 case BFD_TRANSPORT_UDP6:
474 const ip46_address_t * local_addr,
475 const ip46_address_t * peer_addr)
479 key->local_addr.as_u64[0] = local_addr->as_u64[0];
480 key->local_addr.as_u64[1] = local_addr->as_u64[1];
481 key->peer_addr.as_u64[0] = peer_addr->as_u64[0];
482 key->peer_addr.as_u64[1] = peer_addr->as_u64[1];
488 u32 required_min_rx_usec,
u8 detect_mult,
489 const ip46_address_t * local_addr,
490 const ip46_address_t * peer_addr,
497 t = BFD_TRANSPORT_UDP6;
502 return VNET_API_ERROR_BFD_EAGAIN;
506 bfd_udp_key_t *
key = &
bus->key;
512 "duplicate bfd-udp session, existing bs_idx=%d",
515 return VNET_API_ERROR_BFD_EEXIST;
518 BFD_DBG (
"session created, bs_idx=%u, sw_if_index=%d, local=%U, peer=%U",
524 if (BFD_TRANSPORT_UDP4 == t)
529 BFD_DBG (
"adj_nbr_add_or_lock(FIB_PROTOCOL_IP4, VNET_LINK_IP4, %U, %d) "
546 BFD_DBG (
"adj_nbr_add_or_lock(FIB_PROTOCOL_IP6, VNET_LINK_IP6, %U, %d) "
560 required_min_rx_usec, detect_mult);
565 const ip46_address_t * local_addr,
566 const ip46_address_t * peer_addr)
571 u8 local_ip_valid = 0;
576 "got NULL sw_if when getting interface by index %u",
578 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
585 "IP family mismatch (local is ipv4, peer is ipv6)");
586 return VNET_API_ERROR_INVALID_ARGUMENT;
594 ip_interface_address_get_address (&im->lookup_main, ia);
595 if (x->as_u32 == local_addr->ip4.as_u32)
609 "IP family mismatch (local is ipv6, peer is ipv4)");
610 return VNET_API_ERROR_INVALID_ARGUMENT;
615 const ip6_address_t *ll_addr;
630 ip_interface_address_get_address (&im->lookup_main, ia);
631 if (local_addr->ip6.as_u64[0] == x->as_u64[0] &&
632 local_addr->ip6.as_u64[1] == x->as_u64[1])
646 "local address %U not found on interface with index %u",
649 return VNET_API_ERROR_ADDRESS_NOT_FOUND_FOR_INTERFACE;
657 const ip46_address_t * local_addr,
658 const ip46_address_t * peer_addr,
676 "BFD session not found, sw_if_index=%u, local=%U, peer=%U",
680 return VNET_API_ERROR_BFD_ENOENT;
688 u32 required_min_rx_usec,
u8 detect_mult,
689 const ip46_address_t * local_addr,
690 const ip46_address_t * peer_addr)
702 return VNET_API_ERROR_INVALID_ARGUMENT;
704 if (desired_min_tx_usec < 1)
707 return VNET_API_ERROR_INVALID_ARGUMENT;
721 case BFD_TRANSPORT_UDP4:
729 case BFD_TRANSPORT_UDP6:
743 const ip46_address_t * peer_addr,
744 u32 desired_min_tx_usec,
u32 required_min_rx_usec,
745 u8 detect_mult,
u8 is_authenticated,
u32 conf_key_id,
753 required_min_rx_usec, detect_mult,
754 local_addr, peer_addr);
761 required_min_rx_usec, detect_mult,
762 local_addr, peer_addr, &bs);
764 if (!
rv && is_authenticated)
784 const ip46_address_t * local_addr,
785 const ip46_address_t * peer_addr,
786 u32 desired_min_tx_usec,
787 u32 required_min_rx_usec,
u8 detect_mult)
803 desired_min_tx_usec, required_min_rx_usec,
811 const ip46_address_t * local_addr,
812 const ip46_address_t * peer_addr)
832 const ip46_address_t * local_addr,
833 const ip46_address_t * peer_addr,
u8 admin_up_down)
853 const ip46_address_t * local_addr,
854 const ip46_address_t * peer_addr,
855 u32 conf_key_id,
u8 key_id,
u8 is_delayed)
877 const ip46_address_t * local_addr,
878 const ip46_address_t * peer_addr,
u8 is_delayed)
907 #define foreach_bfd_udp_error(F) \
908 F (NONE, "good bfd packets (processed)") \
909 F (BAD, "invalid bfd packets")
911 #define F(sym, string) static char BFD_UDP_ERR_##sym##_STR[] = string;
916 #define F(sym, string) BFD_UDP_ERR_##sym##_STR,
923 #define F(sym, str) BFD_UDP_ERROR_##sym,
938 #define foreach_bfd_udp_echo_error(F) \
939 F (NONE, "good bfd echo packets (processed)") \
940 F (BAD, "invalid bfd echo packets")
942 #define F(sym, string) static char BFD_UDP_ECHO_ERR_##sym##_STR[] = string;
947 #define F(sym, string) BFD_UDP_ECHO_ERR_##sym##_STR,
954 #define F(sym, str) BFD_UDP_ECHO_ERROR_##sym,
957 BFD_UDP_ECHO_N_ERROR,
966 if (start < 0 && start <
sizeof (
b->
pre_data))
968 BFD_ERR (
"Start of ip header is before pre_data, ignoring");
976 BFD_ERR (
"Start of ip header is beyond current data, ignoring");
989 const bfd_udp_key_t *
key = &
bus->key;
990 if (
ip4->src_address.as_u32 !=
key->peer_addr.ip4.as_u32)
992 BFD_ERR (
"IPv4 src addr mismatch, got %U, expected %U",
994 key->peer_addr.ip4.as_u8);
995 return BFD_UDP_ERROR_BAD;
997 if (
ip4->dst_address.as_u32 !=
key->local_addr.ip4.as_u32)
999 BFD_ERR (
"IPv4 dst addr mismatch, got %U, expected %U",
1001 key->local_addr.ip4.as_u8);
1002 return BFD_UDP_ERROR_BAD;
1004 const u8 expected_ttl = 255;
1005 if (
ip4->ttl != expected_ttl)
1007 BFD_ERR (
"IPv4 unexpected TTL value %u, expected %u",
ip4->ttl,
1009 return BFD_UDP_ERROR_BAD;
1011 if (clib_net_to_host_u16 (udp->
src_port) < 49152)
1013 BFD_ERR (
"Invalid UDP src port %u, out of range <49152,65535>",
1016 return BFD_UDP_ERROR_NONE;
1042 (
"Payload size %d too small to hold bfd packet of minimum size %d",
1044 return BFD_UDP_ERROR_BAD;
1051 BFD_ERR (
"Couldn't find ip4 or udp header");
1052 return BFD_UDP_ERROR_BAD;
1054 const u32 udp_payload_length = udp->
length -
sizeof (*udp);
1055 if (pkt->head.length > udp_payload_length)
1058 (
"BFD packet length is larger than udp payload length (%u > %u)",
1059 pkt->head.length, udp_payload_length);
1060 return BFD_UDP_ERROR_BAD;
1064 return BFD_UDP_ERROR_BAD;
1069 BFD_DBG (
"Looking up BFD session using discriminator %u",
1078 key.local_addr.ip4.as_u32 =
ip4->dst_address.as_u32;
1079 key.peer_addr.ip4.as_u32 =
ip4->src_address.as_u32;
1080 BFD_DBG (
"Looking up BFD session using key (sw_if_index=%u, local=%U, "
1088 BFD_ERR (
"BFD session lookup failed - no session matches BFD pkt");
1089 return BFD_UDP_ERROR_BAD;
1094 BFD_ERR (
"Packet verification failed, dropping packet");
1095 return BFD_UDP_ERROR_BAD;
1104 return BFD_UDP_ERROR_NONE;
1113 if (start < 0 && start <
sizeof (
b->
pre_data))
1115 BFD_ERR (
"Start of ip header is before pre_data, ignoring");
1123 BFD_ERR (
"Start of ip header is beyond current data, ignoring");
1128 if ((*ip6)->protocol != IP_PROTOCOL_UDP)
1130 BFD_ERR (
"Unexpected protocol in IPv6 header '%u', expected '%u' (== "
1131 "IP_PROTOCOL_UDP)", (*ip6)->protocol, IP_PROTOCOL_UDP);
1144 const bfd_udp_key_t *
key = &
bus->key;
1145 if (
ip6->src_address.as_u64[0] !=
key->peer_addr.ip6.as_u64[0] &&
1146 ip6->src_address.as_u64[1] !=
key->peer_addr.ip6.as_u64[1])
1148 BFD_ERR (
"IP src addr mismatch, got %U, expected %U",
1150 &
key->peer_addr.ip6);
1151 return BFD_UDP_ERROR_BAD;
1153 if (
ip6->dst_address.as_u64[0] !=
key->local_addr.ip6.as_u64[0] &&
1154 ip6->dst_address.as_u64[1] !=
key->local_addr.ip6.as_u64[1])
1156 BFD_ERR (
"IP dst addr mismatch, got %U, expected %U",
1158 &
key->local_addr.ip6);
1159 return BFD_UDP_ERROR_BAD;
1161 const u8 expected_hop_limit = 255;
1162 if (
ip6->hop_limit != expected_hop_limit)
1164 BFD_ERR (
"IPv6 unexpected hop-limit value %u, expected %u",
1165 ip6->hop_limit, expected_hop_limit);
1166 return BFD_UDP_ERROR_BAD;
1168 if (clib_net_to_host_u16 (udp->
src_port) < 49152)
1170 BFD_ERR (
"Invalid UDP src port %u, out of range <49152,65535>",
1173 return BFD_UDP_ERROR_NONE;
1184 (
"Payload size %d too small to hold bfd packet of minimum size %d",
1186 return BFD_UDP_ERROR_BAD;
1193 BFD_ERR (
"Couldn't find ip6 or udp header");
1194 return BFD_UDP_ERROR_BAD;
1196 const u32 udp_payload_length = udp->
length -
sizeof (*udp);
1197 if (pkt->head.length > udp_payload_length)
1200 (
"BFD packet length is larger than udp payload length (%u > %u)",
1201 pkt->head.length, udp_payload_length);
1202 return BFD_UDP_ERROR_BAD;
1206 return BFD_UDP_ERROR_BAD;
1211 BFD_DBG (
"Looking up BFD session using discriminator %u",
1220 key.local_addr.ip6.as_u64[0] =
ip6->dst_address.as_u64[0];
1221 key.local_addr.ip6.as_u64[1] =
ip6->dst_address.as_u64[1];
1222 key.peer_addr.ip6.as_u64[0] =
ip6->src_address.as_u64[0];
1223 key.peer_addr.ip6.as_u64[1] =
ip6->src_address.as_u64[1];
1224 BFD_DBG (
"Looking up BFD session using key (sw_if_index=%u, local=%U, "
1232 BFD_ERR (
"BFD session lookup failed - no session matches BFD pkt");
1233 return BFD_UDP_ERROR_BAD;
1238 BFD_ERR (
"Packet verification failed, dropping packet");
1239 return BFD_UDP_ERROR_BAD;
1248 return BFD_UDP_ERROR_NONE;
1278 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
1283 :
sizeof (t0->
data);
1298 b0->
error =
rt->errors[error0];
1301 if (BFD_UDP_ERROR_NONE == error0)
1366 .name =
"bfd-udp4-input",
1367 .vector_size =
sizeof (
u32),
1370 .n_errors = BFD_UDP_N_ERROR,
1395 .name =
"bfd-udp6-input",
1396 .vector_size =
sizeof (
u32),
1399 .n_errors = BFD_UDP_N_ERROR,
1440 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
1445 :
sizeof (t0->
data);
1453 b0->
error =
rt->errors[BFD_UDP_ERROR_NONE];
1459 b0->
error =
rt->errors[BFD_UDP_ERROR_NONE];
1499 s =
format (s,
"BFD ECHO:\n");
1512 .name =
"bfd-udp-echo4-input",
1513 .vector_size =
sizeof (
u32),
1516 .n_errors = BFD_UDP_ECHO_N_ERROR,
1541 .name =
"bfd-udp-echo6-input",
1542 .vector_size =
sizeof (
u32),
1545 .n_errors = BFD_UDP_ECHO_N_ERROR,
1573 if (bs->
transport != BFD_TRANSPORT_UDP4 &&
1589 "removal of sw_if_index=%u forces removal of bfd session "
1608 sizeof (bfd_udp_key_t));
static uword bfd_udp4_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
void bfd_session_start(bfd_main_t *bm, bfd_session_t *bs)
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
static uword ip6_address_is_equal(const ip6_address_t *a, const ip6_address_t *b)
@ BFD_UDP_INPUT_NEXT_NORMAL
vnet_interface_main_t * im
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)
bfd_transport_e transport
transport type for this session
@ IP_LOOKUP_NEXT_ARP
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
int bfd_udp_get_echo_src_ip6(ip6_address_t *addr)
@ BFD_UDP_ECHO_INPUT_NEXT_REPLY_REWRITE
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
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.
ip4_main_t ip4_main
Global ip4 main structure.
static void bfd_lock(bfd_main_t *bm)
static void bfd_udp4_find_headers(vlib_buffer_t *b, ip4_header_t **ip4, udp_header_t **udp)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static bfd_session_t * bfd_lookup_session(bfd_udp_main_t *bum, const bfd_udp_key_t *key)
vnet_api_error_t bfd_auth_activate(bfd_session_t *bs, u32 conf_key_id, u8 bfd_key_id, u8 is_delayed)
static clib_error_t * bfd_udp_sw_if_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_create)
static vnet_sw_interface_t * vnet_get_sw_interface_or_null(vnet_main_t *vnm, u32 sw_if_index)
@ VLIB_NODE_TYPE_INTERNAL
static bfd_udp_error_t bfd_udp6_verify_transport(const ip6_header_t *ip6, const udp_header_t *udp, const bfd_session_t *bs)
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
@ BFD_UDP_ECHO_INPUT_NEXT_NORMAL
static void bfd_create_frame_to_next_node(vlib_main_t *vm, u32 bi, u32 next_node)
vlib_main_t vlib_node_runtime_t * node
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
static uword * mhash_get(mhash_t *h, const void *key)
@ IP_LOOKUP_NEXT_MIDCHAIN
This packets follow a mid-chain adjacency.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static bfd_udp_error_t bfd_udp4_verify_transport(const ip4_header_t *ip4, const udp_header_t *udp, const bfd_session_t *bs)
mhash_t bfd_session_idx_by_bfd_key
bfd_udp_echo_input_next_t
u8 * bfd_echo_input_format_trace(u8 *s, va_list *args)
__clib_export void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
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)
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.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
#define vlib_log_info(...)
void bfd_put_session(bfd_main_t *bm, bfd_session_t *bs)
#define vlib_log_err(...)
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)
bfd_udp_main_t bfd_udp_main
vnet_sw_interface_flags_t flags
u32 bs_idx
index in bfd_main.sessions pool
u32 echo_source_sw_if_index
bfd_session_t * bfd_get_session(bfd_main_t *bm, bfd_transport_e t)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static vlib_node_registration_t bfd_udp6_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp6_input_node)
#define pool_foreach(VAR, POOL)
Iterate through pool.
int bfd_add_udp6_transport(vlib_main_t *vm, u32 bi, const bfd_session_t *bs, int is_echo)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
@ BFD_UDP_INPUT_NEXT_REPLY_MIDCHAIN
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)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
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)
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
const ip6_address_t * ip6_get_link_local_address(u32 sw_if_index)
#define foreach_bfd_udp_error(F)
vnet_main_t * vnet_get_main(void)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
int bfd_add_udp4_transport(vlib_main_t *vm, u32 bi, const bfd_session_t *bs, int is_echo)
@ BFD_UDP_INPUT_NEXT_REPLY_REWRITE
@ IP_LOOKUP_NEXT_REWRITE
This packet is to be rewritten and forwarded to the next processing node.
static clib_error_t * bfd_udp_init(vlib_main_t *vm)
int bfd_transport_udp4(vlib_main_t *vm, u32 bi, const struct bfd_session_s *bs)
transport packet over udpv4
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
bfd_session_t * sessions
pool of bfd sessions context data
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static uword bfd_udp_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f, int is_ipv6)
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
static char * bfd_udp_error_strings[]
@ BFD_UDP_ECHO_INPUT_NEXT_REPLY_ARP
@ BFD_UDP_INPUT_NEXT_REPLY_ARP
void udp_unregister_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u8 is_ip4)
#define vlib_log_debug(...)
static uword bfd_udp_echo4_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
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)
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)
struct _vlib_node_registration vlib_node_registration_t
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
vlib_log_class_t log_class
u8 * bfd_input_format_trace(u8 *s, va_list *args)
u16 current_length
Nbytes between current data and the end of this buffer.
static char * bfd_udp_echo_error_strings[]
static uword bfd_udp_echo6_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
bfd_session_t * bfd_find_session_by_disc(bfd_main_t *bm, u32 disc)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
int bfd_verify_pkt_common(const bfd_pkt_t *pkt)
verify bfd packet - common checks
int bfd_verify_pkt_auth(vlib_main_t *vm, const bfd_pkt_t *pkt, u16 pkt_size, bfd_session_t *bs)
verify bfd packet - authentication
static void bfd_unlock(bfd_main_t *bm)
description fragment has unexpected format
format_function_t format_ip46_address
static void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
u8 bfd_pkt_get_poll(const bfd_pkt_t *pkt)
#define VLIB_INIT_FUNCTION(x)
bfd_session_t * bfd_find_session_by_idx(bfd_main_t *bm, uword bs_idx)
vnet_api_error_t bfd_udp_del_echo_source(u32 sw_if_index)
bfd_udp_key_t key
key identifying this session
#define vec_foreach(var, vec)
Vector iterator.
static void bfd_udp_del_session_internal(vlib_main_t *vm, bfd_session_t *bs)
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)
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 vlib_node_registration_t bfd_udp4_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp4_input_node)
void bfd_session_set_flags(vlib_main_t *vm, bfd_session_t *bs, u8 admin_up_down)
static uword bfd_udp6_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
static uword bfd_udp_echo_input(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f, int is_ipv6)
#define vlib_log_notice(...)
vnet_api_error_t bfd_auth_deactivate(bfd_session_t *bs, u8 is_delayed)
#define foreach_bfd_udp_echo_error(F)
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(bfd_udp_sw_if_add_del)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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
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
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static vlib_main_t * vlib_get_main(void)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_interface_output_runtime_t * rt
@ BFD_UDP_ECHO_INPUT_N_NEXT
static u16 ip4_header_checksum(ip4_header_t *i)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
int bfd_consume_echo_pkt(vlib_main_t *vm, bfd_main_t *bm, vlib_buffer_t *b)
int bfd_udp_is_echo_available(bfd_transport_e transport)
check if the bfd udp layer is echo-capable at this time
static uword vnet_sw_interface_is_up(vnet_main_t *vnm, u32 sw_if_index)
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)
int bfd_udp_get_echo_src_ip4(ip4_address_t *addr)
void bfd_consume_pkt(vlib_main_t *vm, bfd_main_t *bm, const bfd_pkt_t *pkt, u32 bs_idx)
static void bfd_udp6_find_headers(vlib_buffer_t *b, ip6_header_t **ip6, udp_header_t **udp)
vnet_api_error_t bfd_udp_set_echo_source(u32 sw_if_index)
set echo-source interface
static void bfd_rpc_update_session(vlib_main_t *vm, u32 bs_idx, const bfd_pkt_t *pkt)
static vlib_node_registration_t bfd_udp_echo6_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp_echo6_input_node)
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
BFD UDP transport layer declarations.
vl_api_interface_index_t sw_if_index
u8 * format_bfd_session(u8 *s, va_list *args)
#define STRUCT_SIZE_OF(t, f)
int bfd_transport_udp6(vlib_main_t *vm, u32 bi, const struct bfd_session_s *bs)
transport packet over udpv6
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
__clib_export uword mhash_unset(mhash_t *h, void *key, uword *old_value)
static u16 bfd_udp_bs_idx_to_sport(u32 bs_idx)
vl_api_fib_path_type_t type
int bfd_udp_calc_next_node(const struct bfd_session_s *bs, u32 *next_node)
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
adj_index_t adj_index
adjacency index returned from adj lock call
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
static vlib_node_registration_t bfd_udp_echo4_input_node
(constructor) VLIB_REGISTER_NODE (bfd_udp_echo4_input_node)
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)