106 .name =
"ip4-lookup",
107 .vector_size =
sizeof (
u32),
121 u32 n_left_from, n_left_to_next, *from, *to_next;
132 while (n_left_from > 0)
137 while (n_left_from >= 4 && n_left_to_next >= 2)
142 u32 pi0, lbi0, hc0, pi1, lbi1, hc1;
160 pi0 = to_next[0] = from[0];
161 pi1 = to_next[1] = from[1];
238 to_next, n_left_to_next,
239 pi0, pi1, next0, next1);
242 while (n_left_from > 0 && n_left_to_next > 0)
293 to_next, n_left_to_next,
307 .name =
"ip4-load-balance",
308 .vector_size =
sizeof (
u32),
309 .sibling_of =
"ip4-lookup",
328 (lm, ia, sw_if_index,
338 *result_ia = result ? ia : 0;
352 .fp_addr.ip4 = *address,
393 else if (pfx.
fp_len == 31)
395 u32 mask = clib_host_to_net_u32(1);
399 net_pfx.
fp_addr.ip4.as_u32 ^= mask;
418 u32 classify_table_index =
420 if (classify_table_index != (
u32) ~ 0)
458 .fp_addr.ip4 = *address,
479 else if (pfx.
fp_len == 31)
481 u32 mask = clib_host_to_net_u32(1);
485 net_pfx.
fp_addr.ip4.as_u32 ^= mask;
520 sw_if_index, !is_enable, 0, 0);
527 u32 address_length,
u32 is_del)
533 u32 if_address_index, elts_before;
537 if (sw_if_index == 0)
564 ip_interface_address_get_address
565 (&im->lookup_main, ia);
566 if (ip4_destination_matches_route
567 (im, address, x, ia->address_length) ||
568 ip4_destination_matches_route (im,
574 (
"failed to add %U which conflicts with %U for interface %U",
575 format_ip4_address_and_length, address,
577 format_ip4_address_and_length, x,
579 format_vnet_sw_if_index_name, vnm,
588 (lm, sw_if_index, addr_fib, address_length, is_del, &if_address_index);
608 address, address_length, if_address_index, is_del);
620 u32 address_length,
u32 is_del)
623 (vm, sw_if_index, address, address_length, is_del);
630 .arc_name =
"ip4-unicast",
631 .start_nodes =
VNET_FEATURES (
"ip4-input",
"ip4-input-no-checksum"),
637 .arc_name =
"ip4-unicast",
638 .node_name =
"ip4-flow-classify",
644 .arc_name =
"ip4-unicast",
645 .node_name =
"ip4-inacl",
651 .arc_name =
"ip4-unicast",
652 .node_name =
"ip4-source-check-via-rx",
658 .arc_name =
"ip4-unicast",
659 .node_name =
"ip4-source-check-via-any",
665 .arc_name =
"ip4-unicast",
666 .node_name =
"ip4-source-and-port-range-check-rx",
672 .arc_name =
"ip4-unicast",
673 .node_name =
"ip4-policer-classify",
679 .arc_name =
"ip4-unicast",
680 .node_name =
"ipsec-input-ip4",
686 .arc_name =
"ip4-unicast",
687 .node_name =
"vpath-input-ip4",
693 .arc_name =
"ip4-unicast",
694 .node_name =
"ip4-vxlan-bypass",
700 .arc_name =
"ip4-unicast",
701 .node_name =
"ip4-not-enabled",
707 .arc_name =
"ip4-unicast",
708 .node_name =
"ip4-lookup",
715 .arc_name =
"ip4-multicast",
716 .start_nodes =
VNET_FEATURES (
"ip4-input",
"ip4-input-no-checksum"),
722 .arc_name =
"ip4-multicast",
723 .node_name =
"vpath-input-ip4",
729 .arc_name =
"ip4-multicast",
730 .node_name =
"ip4-not-enabled",
736 .arc_name =
"ip4-multicast",
737 .node_name =
"ip4-mfib-forward-lookup",
744 .arc_name =
"ip4-output",
745 .start_nodes =
VNET_FEATURES (
"ip4-rewrite",
"ip4-midchain",
"ip4-dvr-dpo"),
751 .arc_name =
"ip4-output",
752 .node_name =
"ip4-source-and-port-range-check-tx",
758 .arc_name =
"ip4-output",
759 .node_name =
"ip4-outacl",
765 .arc_name =
"ip4-output",
766 .node_name =
"ipsec-output-ip4",
773 .arc_name =
"ip4-output",
774 .node_name =
"interface-output",
810 sw_if_index, is_add, 0, 0);
864 memset (&h, 0,
sizeof (h));
870 #define _16(f,v) h.f = clib_host_to_net_u16 (v); 871 #define _8(f,v) h.f = v; 872 _16 (l2_type, ETHERNET_ARP_HARDWARE_TYPE_ethernet);
873 _16 (l3_type, ETHERNET_TYPE_IP4);
874 _8 (n_l2_address_bytes, 6);
875 _8 (n_l3_address_bytes, 4);
876 _16 (opcode, ETHERNET_ARP_OPCODE_request);
900 u8 packet_data[64 - 1 *
sizeof (
u32)];
925 s =
format (s,
"fib %d dpo-idx %d flow hash: 0x%08x",
941 s =
format (s,
"tx_sw_if_index %d dpo-idx %d : %U flow hash: 0x%08x",
979 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
994 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
1021 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
1045 u32 ip_header_length, payload_length_host_byte_order;
1046 u32 n_this_buffer, n_bytes_left, n_ip_bytes_this_buffer;
1048 void *data_this_buffer;
1052 payload_length_host_byte_order =
1053 clib_net_to_host_u16 (ip0->
length) - ip_header_length;
1055 clib_host_to_net_u32 (payload_length_host_byte_order +
1071 n_bytes_left = n_this_buffer = payload_length_host_byte_order;
1072 data_this_buffer = (
void *) ip0 + ip_header_length;
1073 n_ip_bytes_this_buffer =
1075 if (n_this_buffer + ip_header_length > n_ip_bytes_this_buffer)
1077 n_this_buffer = n_ip_bytes_this_buffer > ip_header_length ?
1078 n_ip_bytes_this_buffer - ip_header_length : 0;
1083 n_bytes_left -= n_this_buffer;
1084 if (n_bytes_left == 0)
1106 || ip0->
protocol == IP_PROTOCOL_UDP);
1108 udp0 = (
void *) (ip0 + 1);
1111 p0->
flags |= (VNET_BUFFER_F_L4_CHECKSUM_COMPUTED
1112 | VNET_BUFFER_F_L4_CHECKSUM_CORRECT);
1118 p0->
flags |= (VNET_BUFFER_F_L4_CHECKSUM_COMPUTED
1119 | ((sum16 == 0) << VNET_BUFFER_F_LOG2_L4_CHECKSUM_CORRECT));
1127 .arc_name =
"ip4-local",
1134 u8 is_udp,
u8 * error,
u8 * good_tcp_udp)
1138 *good_tcp_udp = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1142 u32 ip_len, udp_len;
1146 ip_len = clib_net_to_host_u16 (ip->
length);
1147 udp_len = clib_net_to_host_u16 (udp->
length);
1149 len_diff = ip_len - udp_len;
1150 *good_tcp_udp &= len_diff >= 0;
1151 *error = len_diff < 0 ? IP4_ERROR_UDP_LENGTH : *error;
1155 #define ip4_local_do_l4_check(is_tcp_udp, flags) \ 1156 (is_tcp_udp && !(flags & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED \ 1157 || flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM \ 1158 || flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) 1168 u32 *from, *to_next, n_left_from, n_left_to_next;
1180 while (n_left_from > 0)
1184 while (n_left_from >= 4 && n_left_to_next >= 2)
1192 u32 pi0, next0, fib_index0, lbi0;
1193 u32 pi1, next1, fib_index1, lbi1;
1194 u8 error0, is_udp0, is_tcp_udp0, good_tcp_udp0, proto0;
1195 u8 error1, is_udp1, is_tcp_udp1, good_tcp_udp1, proto1;
1196 u32 sw_if_index0, sw_if_index1;
1198 pi0 = to_next[0] = from[0];
1199 pi1 = to_next[1] = from[1];
1203 n_left_to_next -= 2;
1206 error0 = error1 = IP4_ERROR_UNKNOWN_PROTOCOL;
1223 if (head_of_feature_arc == 0)
1226 is_udp0 = proto0 == IP_PROTOCOL_UDP;
1227 is_udp1 = proto1 == IP_PROTOCOL_UDP;
1228 is_tcp_udp0 = is_udp0 || proto0 == IP_PROTOCOL_TCP;
1229 is_tcp_udp1 = is_udp1 || proto1 == IP_PROTOCOL_TCP;
1232 (p0->
flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT
1233 || (p0->
flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM
1234 || p0->
flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) != 0;
1235 good_tcp_udp1 = (p1->
flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT
1236 || (p1->
flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM
1238 VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) != 0;
1252 ASSERT (IP4_ERROR_TCP_CHECKSUM + 1 == IP4_ERROR_UDP_CHECKSUM);
1253 error0 = (is_tcp_udp0 && !good_tcp_udp0
1254 ? IP4_ERROR_TCP_CHECKSUM + is_udp0 : error0);
1255 error1 = (is_tcp_udp1 && !good_tcp_udp1
1256 ? IP4_ERROR_TCP_CHECKSUM + is_udp1 : error1);
1309 if (p0->
flags & VNET_BUFFER_F_IS_NATED)
1312 error0 = ((error0 == IP4_ERROR_UNKNOWN_PROTOCOL &&
1314 IP4_ERROR_SPOOFED_LOCAL_PACKETS : error0);
1315 error0 = ((error0 == IP4_ERROR_UNKNOWN_PROTOCOL &&
1318 ? IP4_ERROR_SRC_LOOKUP_MISS : error0);
1321 if (p1->
flags & VNET_BUFFER_F_IS_NATED)
1324 error1 = ((error1 == IP4_ERROR_UNKNOWN_PROTOCOL &&
1326 IP4_ERROR_SPOOFED_LOCAL_PACKETS : error1);
1327 error1 = ((error1 == IP4_ERROR_UNKNOWN_PROTOCOL &&
1330 ? IP4_ERROR_SRC_LOOKUP_MISS : error1);
1342 p0->
error = error0 ? error_node->
errors[error0] : 0;
1343 p1->
error = error1 ? error_node->
errors[error1] : 0;
1345 if (head_of_feature_arc)
1354 n_left_to_next, pi0, pi1,
1358 while (n_left_from > 0 && n_left_to_next > 0)
1364 u32 pi0, next0, fib_index0, lbi0;
1365 u8 error0, is_udp0, is_tcp_udp0, good_tcp_udp0, proto0;
1370 pi0 = to_next[0] = from[0];
1374 n_left_to_next -= 1;
1377 error0 = IP4_ERROR_UNKNOWN_PROTOCOL;
1386 if (head_of_feature_arc == 0 || p0->
flags & VNET_BUFFER_F_IS_NATED)
1389 is_udp0 = proto0 == IP_PROTOCOL_UDP;
1390 is_tcp_udp0 = is_udp0 || proto0 == IP_PROTOCOL_TCP;
1393 (p0->
flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT
1394 || (p0->
flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM
1395 || p0->
flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) != 0;
1403 ASSERT (IP4_ERROR_TCP_CHECKSUM + 1 == IP4_ERROR_UDP_CHECKSUM);
1404 error0 = (is_tcp_udp0 && !good_tcp_udp0
1405 ? IP4_ERROR_TCP_CHECKSUM + is_udp0 : error0);
1425 error0 = ((error0 == IP4_ERROR_UNKNOWN_PROTOCOL &&
1427 IP4_ERROR_SPOOFED_LOCAL_PACKETS : error0);
1428 error0 = ((error0 == IP4_ERROR_UNKNOWN_PROTOCOL &&
1431 ? IP4_ERROR_SRC_LOOKUP_MISS : error0);
1438 p0->
error = error0 ? error_node->
errors[error0] : 0;
1440 if (head_of_feature_arc)
1447 n_left_to_next, pi0, next0);
1465 .name =
"ip4-local",
1466 .vector_size =
sizeof (
u32),
1491 .name =
"ip4-local-end-of-arc",
1492 .vector_size =
sizeof (
u32),
1495 .sibling_of =
"ip4-local",
1501 .arc_name =
"ip4-local",
1502 .node_name =
"ip4-local-end-of-arc",
1559 .path =
"show ip local",
1561 .short_help =
"show ip local",
1573 u32 *from, *to_next_drop;
1574 uword n_left_from, n_left_to_next_drop, next_index;
1575 static f64 time_last_seed_change = -1e100;
1576 static u32 hash_seeds[3];
1584 if (time_now - time_last_seed_change > 1e-3)
1588 sizeof (hash_seeds));
1589 for (i = 0; i <
ARRAY_LEN (hash_seeds); i++)
1590 hash_seeds[i] = r[i];
1593 for (i = 0; i <
ARRAY_LEN (hash_bitmap); i++)
1596 time_last_seed_change = time_now;
1605 while (n_left_from > 0)
1608 to_next_drop, n_left_to_next_drop);
1610 while (n_left_from > 0 && n_left_to_next_drop > 0)
1612 u32 pi0, adj_index0, a0, b0, c0, m0, sw_if_index0, drop0;
1630 sw_if_index0 = adj0->rewrite_header.sw_if_index;
1650 c0 &=
BITS (hash_bitmap) - 1;
1654 bm0 = hash_bitmap[c0];
1655 drop0 = (bm0 & m0) != 0;
1658 hash_bitmap[c0] = bm0 | m0;
1662 to_next_drop[0] = pi0;
1664 n_left_to_next_drop -= 1;
1733 ip4_over_ethernet[0].ip4))
1756 adj0->rewrite_header.next_index,
1793 .vector_size =
sizeof (
u32),
1807 .name =
"ip4-glean",
1808 .vector_size =
sizeof (
u32),
1819 #define foreach_notrace_ip4_arp_error \ 1832 vnet_pcap_drop_trace_filter_add_del \ 1833 (rt->errors[IP4_ARP_ERROR_##a], \ 1873 vnm->
api_errno = VNET_API_ERROR_NO_MATCHING_INTERFACE;
1876 "no matching interface address for destination %U (interface %U)",
1904 ip46_address_t nh = {
1947 int do_counters,
int is_midchain,
int is_mcast)
1951 u32 n_left_from, n_left_to_next, *to_next, next_index;
1959 while (n_left_from > 0)
1963 while (n_left_from >= 4 && n_left_to_next >= 2)
1968 u32 pi0, rw_len0, next0, error0, checksum0, adj_index0;
1969 u32 pi1, rw_len1, next1, error1, checksum1, adj_index1;
1970 u32 tx_sw_if_index0, tx_sw_if_index1;
1986 pi0 = to_next[0] = from[0];
1987 pi1 = to_next[1] = from[1];
1992 n_left_to_next -= 2;
2006 thread_index, adj_index0);
2008 thread_index, adj_index1);
2014 error0 = error1 = IP4_ERROR_NONE;
2026 checksum0 = ip0->
checksum + clib_host_to_net_u16 (0x0100);
2027 checksum0 += checksum0 >= 0xffff;
2039 error0 = IP4_ERROR_TIME_EXPIRED;
2042 ICMP4_time_exceeded_ttl_exceeded_in_transit,
2049 (p0->
flags & VNET_BUFFER_F_OFFLOAD_IP_CKSUM));
2053 p0->
flags &= ~VNET_BUFFER_F_LOCALLY_ORIGINATED;
2062 checksum1 = ip1->
checksum + clib_host_to_net_u16 (0x0100);
2063 checksum1 += checksum1 >= 0xffff;
2075 error1 = IP4_ERROR_TIME_EXPIRED;
2078 ICMP4_time_exceeded_ttl_exceeded_in_transit,
2085 (p1->
flags & VNET_BUFFER_F_OFFLOAD_IP_CKSUM));
2089 p1->
flags &= ~VNET_BUFFER_F_LOCALLY_ORIGINATED;
2097 rw_len0 = adj0[0].rewrite_header.data_bytes;
2098 rw_len1 = adj1[0].rewrite_header.data_bytes;
2099 vnet_buffer (p0)->ip.save_rewrite_length = rw_len0;
2100 vnet_buffer (p1)->ip.save_rewrite_length = rw_len1;
2104 adj0[0].rewrite_header.max_l3_packet_bytes)
2106 error0 = IP4_ERROR_MTU_EXCEEDED;
2109 (p0, ICMP4_destination_unreachable,
2110 ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
2114 adj1[0].rewrite_header.max_l3_packet_bytes)
2116 error1 = IP4_ERROR_MTU_EXCEEDED;
2119 (p1, ICMP4_destination_unreachable,
2120 ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
2126 error0 = ((adj0[0].rewrite_header.sw_if_index ==
2128 IP4_ERROR_SAME_INTERFACE : error0);
2129 error1 = ((adj1[0].rewrite_header.sw_if_index ==
2131 IP4_ERROR_SAME_INTERFACE : error1);
2140 next0 = adj0[0].rewrite_header.next_index;
2143 tx_sw_if_index0 = adj0[0].rewrite_header.sw_if_index;
2149 tx_sw_if_index0, &next0, p0);
2153 next1 = adj1[0].rewrite_header.next_index;
2157 tx_sw_if_index1 = adj1[0].rewrite_header.sw_if_index;
2163 tx_sw_if_index1, &next1, p1);
2205 to_next, n_left_to_next,
2206 pi0, pi1, next0, next1);
2209 while (n_left_from > 0 && n_left_to_next > 0)
2214 u32 pi0, rw_len0, adj_index0, next0, error0, checksum0;
2215 u32 tx_sw_if_index0;
2217 pi0 = to_next[0] = from[0];
2227 error0 = IP4_ERROR_NONE;
2235 checksum0 = ip0->
checksum + clib_host_to_net_u16 (0x0100);
2237 checksum0 += checksum0 >= 0xffff;
2248 (p0->
flags & VNET_BUFFER_F_OFFLOAD_IP_CKSUM));
2256 error0 = IP4_ERROR_TIME_EXPIRED;
2260 ICMP4_time_exceeded_ttl_exceeded_in_transit,
2266 p0->
flags &= ~VNET_BUFFER_F_LOCALLY_ORIGINATED;
2271 thread_index, adj_index0);
2284 rw_len0 = adj0[0].rewrite_header.data_bytes;
2285 vnet_buffer (p0)->ip.save_rewrite_length = rw_len0;
2290 thread_index, adj_index0, 1,
2295 adj0[0].rewrite_header.max_l3_packet_bytes)
2297 error0 = IP4_ERROR_MTU_EXCEEDED;
2300 (p0, ICMP4_destination_unreachable,
2301 ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set,
2306 error0 = ((adj0[0].rewrite_header.sw_if_index ==
2308 IP4_ERROR_SAME_INTERFACE : error0);
2318 tx_sw_if_index0 = adj0[0].rewrite_header.sw_if_index;
2321 next0 = adj0[0].rewrite_header.next_index;
2332 tx_sw_if_index0, &next0, p0);
2339 n_left_to_next -= 1;
2342 to_next, n_left_to_next,
2431 .name =
"ip4-rewrite",
2432 .vector_size =
sizeof (
u32),
2446 .name =
"ip4-rewrite-mcast",
2447 .vector_size =
sizeof (
u32),
2450 .sibling_of =
"ip4-rewrite",
2456 .name =
"ip4-mcast-midchain",
2457 .vector_size =
sizeof (
u32),
2460 .sibling_of =
"ip4-rewrite",
2466 .name =
"ip4-midchain",
2467 .vector_size =
sizeof (
u32),
2469 .sibling_of =
"ip4-rewrite",
2506 if (
unformat (input,
"table %d", &table_id))
2510 if ((fib) && (fib->
index != table_id))
2514 else if (
unformat (input,
"count %f", &count))
2527 for (i = 0; i < n; i++)
2532 ip4_base_address.
as_u32 =
2533 clib_host_to_net_u32 (1 +
2534 clib_net_to_host_u32 (ip4_base_address.
as_u32));
2565 .path =
"test lookup",
2566 .short_help =
"test lookup <ipv4-addr> [table <fib-id>] [count <nn>]",
2578 if (~0 == fib_index)
2579 return VNET_API_ERROR_NO_SUCH_FIB;
2594 u32 flow_hash_config = 0;
2599 if (
unformat (input,
"table %d", &table_id))
2602 else if (unformat (input, #a)) { flow_hash_config |= v; matched=1;} 2619 case VNET_API_ERROR_NO_SUCH_FIB:
2623 clib_warning (
"BUG: illegal flow hash config 0x%x", flow_hash_config);
2716 .path =
"set ip flow-hash",
2718 "set ip flow-hash table <table-id> [src] [dst] [sport] [dport] [proto] [reverse]",
2735 return VNET_API_ERROR_NO_MATCHING_INTERFACE;
2738 return VNET_API_ERROR_NO_SUCH_ENTRY;
2745 if (
NULL != if_addr)
2750 .fp_addr.ip4 = *if_addr,
2758 if (table_index != (
u32) ~ 0)
2788 u32 table_index = ~0;
2789 int table_index_set = 0;
2790 u32 sw_if_index = ~0;
2795 if (
unformat (input,
"table-index %d", &table_index))
2796 table_index_set = 1;
2804 if (table_index_set == 0)
2807 if (sw_if_index == ~0)
2817 case VNET_API_ERROR_NO_MATCHING_INTERFACE:
2820 case VNET_API_ERROR_NO_SUCH_ENTRY:
2839 .path =
"set ip classify",
2841 "set ip classify intfc <interface> table-index <classify-idx>",
2858 "invalid heap-size parameter `%U'",
static vlib_node_registration_t ip4_mcast_midchain_node
(constructor) VLIB_REGISTER_NODE (ip4_mcast_midchain_node)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
u16 lb_n_buckets
number of buckets in the load-balance.
u32 mfib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, mfib_source_t src)
Get the index of the FIB for a Table-ID.
clib_error_t * ip4_add_del_interface_address(vlib_main_t *vm, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 is_del)
ip4_address_t * ip4_interface_first_address(ip4_main_t *im, u32 sw_if_index, ip_interface_address_t **result_ia)
static clib_error_t * ip4_config(vlib_main_t *vm, unformat_input_t *input)
static uword ip4_local_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int head_of_feature_arc)
int vnet_set_ip4_flow_hash(u32 table_id, u32 flow_hash_config)
static int fib_urpf_check_size(index_t ui)
Data-Plane function to check the size of an uRPF list, (i.e.
ip4_add_del_interface_address_callback_t * add_del_interface_address_callbacks
Functions to call when interface address changes.
format_function_t format_vlib_node_name
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
struct ip_adjacency_t_::@43::@45 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
static void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
ip_interface_address_t * if_address_pool
Pool of addresses that are assigned to interfaces.
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
static clib_error_t * ip4_add_del_interface_address_internal(vlib_main_t *vm, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 is_del)
static ip4_fib_mtrie_leaf_t ip4_fib_mtrie_lookup_step(const ip4_fib_mtrie_t *m, ip4_fib_mtrie_leaf_t current_leaf, const ip4_address_t *dst_address, u32 dst_address_byte_index)
Lookup step.
vnet_interface_main_t interface_main
static uword ip4_midchain(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
static uword ip4_not_enabled(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vnet_fixup_one_header(rw0, addr, p0)
static int ip4_header_bytes(ip4_header_t *i)
static u32 ip4_compute_flow_hash(const ip4_header_t *ip, flow_hash_config_t flow_hash_config)
static f64 vlib_time_now(vlib_main_t *vm)
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
static void * clib_random_buffer_get_data(clib_random_buffer_t *b, uword n_bytes)
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
static const dpo_id_t * load_balance_get_fwd_bucket(const load_balance_t *lb, u16 bucket)
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 clib_error_t * test_lookup_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
struct ip_adjacency_t_::@43::@44 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
ip_lookup_main_t lookup_main
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
unformat_function_t unformat_vnet_sw_interface
static uword ip4_lookup_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int lookup_for_responses_to_locally_received_packets)
static uword ip4_arp(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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.
VNET_FEATURE_ARC_INIT(ip4_unicast, static)
u8 mcast_feature_arc_index
Feature arc indices.
#define hash_v3_mix32(a, b, c)
format_function_t format_vnet_sw_if_index_name
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
ip_lookup_next_t
An adjacency is a representation of an attached L3 peer.
union ip_adjacency_t_::@43 sub_type
static pg_node_t * pg_get_node(uword node_index)
fib_node_index_t fib_table_entry_update_one_path(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Update the entry to have just one path.
u8 output_feature_arc_index
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
static clib_error_t * show_ip_local_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 * mfib_index_by_sw_if_index
Table index indexed by software interface.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
#define vlib_prefetch_buffer_with_index(vm, bi, type)
Prefetch buffer metadata by buffer index The first 64 bytes of buffer contains most header informatio...
ip_csum_t ip_incremental_checksum(ip_csum_t sum, void *_data, uword n_bytes)
#define VLIB_INIT_FUNCTION(x)
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a 'special' entry from the FIB.
static uword pow2_mask(uword x)
static void ip4_add_interface_routes(u32 sw_if_index, ip4_main_t *im, u32 fib_index, ip_interface_address_t *a)
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Aggregrate type for a prefix.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define clib_error_return(e, args...)
vlib_node_registration_t ip4_arp_node
(constructor) VLIB_REGISTER_NODE (ip4_arp_node)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
static void * ip4_next_header(ip4_header_t *i)
#define clib_error_create(args...)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u16 fp_len
The mask length.
#define vlib_call_init_function(vm, x)
#define foreach_notrace_ip4_arp_error
static clib_error_t * vnet_feature_init(vlib_main_t *vm)
static u32 ip4_fib_mtrie_leaf_get_adj_index(ip4_fib_mtrie_leaf_t n)
From the stored slot value extract the LB index value.
vlib_node_registration_t ip4_rewrite_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_node)
vnet_api_error_t api_errno
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_node_registration_t ip4_input_node
Global ip4 input node.
void vlib_packet_template_init(vlib_main_t *vm, vlib_packet_template_t *t, void *packet_data, uword n_packet_data_bytes, uword min_n_buffers_each_alloc, char *fmt,...)
u16 current_length
Nbytes between current data and the end of this buffer.
u32 * classify_table_index_by_sw_if_index
First table index to use for this interface, ~0 => none.
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
vlib_node_registration_t ip4_local_node
(constructor) VLIB_REGISTER_NODE (ip4_local_node)
index_t classify_dpo_create(dpo_proto_t proto, u32 classify_table_index)
clib_error_t * arp_notrace_init(vlib_main_t *vm)
dpo_type_t dpoi_type
the type
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
void ip4_register_protocol(u32 protocol, u32 node_index)
uword mtrie_heap_size
Heapsize for the Mtries.
static uword ip4_arp_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_glean)
void ip4_forward_next_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vlib_rx_or_tx_t which_adj_index)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u8 * ip_enabled_by_sw_if_index
static uword ip4_local_end_of_arc(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword ip4_glean(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword ip4_rewrite_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int do_counters, int is_midchain, int is_mcast)
ip4_main_t ip4_main
Global ip4 main structure.
u8 local_next_by_ip_protocol[256]
Table mapping ip protocol to ip[46]-local node next index.
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
static uword ip4_load_balance(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword ip4_inacl(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void vlib_prefetch_combined_counter(const vlib_combined_counter_main_t *cm, u32 thread_index, u32 index)
Pre-fetch a per-thread combined counter for the given object index.
void vnet_sw_interface_update_unnumbered(u32 unnumbered_sw_if_index, u32 ip_sw_if_index, u8 enable)
load_balance_main_t load_balance_main
The one instance of load-balance main.
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
vlib_combined_counter_main_t adjacency_counters
Adjacency packet counters.
ip4_fib_mtrie_t mtrie
Mtrie for fast lookups.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static u8 * format_ip4_lookup_trace(u8 *s, va_list *args)
clib_error_t * ip4_probe_neighbor(vlib_main_t *vm, ip4_address_t *dst, u32 sw_if_index)
fib_node_index_t fib_table_entry_special_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags)
Add a 'special' entry to the FIB.
#define IP4_LOOKUP_NEXT_NODES
static u8 * format_ip4_rewrite_trace(u8 *s, va_list *args)
static uword ip4_policer_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
#define VLIB_EARLY_CONFIG_FUNCTION(x, n,...)
#define VLIB_REGISTER_NODE(x,...)
static void vlib_buffer_copy_trace_flag(vlib_main_t *vm, vlib_buffer_t *b, u32 bi_target)
static_always_inline uword vlib_get_thread_index(void)
#define CLIB_PREFETCH(addr, size, type)
#define vec_free(V)
Free vector's memory (no header).
vnet_feature_arc_registration_t vnet_feat_arc_ip4_local
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
void icmp4_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
ip4_add_del_interface_address_function_t * function
static ip4_fib_t * ip4_fib_get(u32 index)
Get the FIB at the given index.
void fib_table_set_flow_hash_config(u32 fib_index, fib_protocol_t proto, flow_hash_config_t hash_config)
Set the flow hash configured used by the table.
#define clib_warning(format, args...)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define clib_memcpy(a, b, c)
int ip4_lookup_validate(ip4_address_t *a, u32 fib_index0)
static clib_error_t * set_ip_flow_hash_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
unformat_function_t * unformat_edit
u8 packet_data[64-1 *sizeof(u32)]
void ip_lookup_init(ip_lookup_main_t *lm, u32 is_ip6)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
u32 adj_index_t
An index for adjacencies.
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
vlib_combined_counter_main_t lbm_via_counters
static void ip4_addr_fib_init(ip4_address_fib_t *addr_fib, ip4_address_t *address, u32 fib_index)
static clib_error_t * set_ip_classify_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * ip4_sw_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
struct _vnet_classify_main vnet_classify_main_t
#define foreach_flow_hash_bit
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
vlib_packet_template_t ip4_arp_request_packet_template
Template used to generate IP4 ARP packets.
static clib_error_t * ip4_mtrie_module_init(vlib_main_t *vm)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
vlib_node_registration_t ip4_load_balance_node
(constructor) VLIB_REGISTER_NODE (ip4_load_balance_node)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
index_t lb_urpf
This is the index of the uRPF list for this LB.
static ip4_fib_mtrie_leaf_t ip4_fib_mtrie_lookup_step_one(const ip4_fib_mtrie_t *m, const ip4_address_t *dst_address)
Lookup step number 1.
u32 ip4_tcp_udp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
static load_balance_t * load_balance_get(index_t lbi)
#define hash_v3_finalize32(a, b, c)
The default route source.
static clib_error_t * fib_module_init(vlib_main_t *vm)
vlib_node_registration_t ip4_glean_node
(constructor) VLIB_REGISTER_NODE (ip4_glean_node)
VLIB_NODE_FUNCTION_MULTIARCH(ip4_lookup_node, ip4_lookup)
u32 next_buffer
Next buffer for this linked-list of buffers.
#define ip4_local_do_l4_check(is_tcp_udp, flags)
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
vlib_node_registration_t ip4_midchain_node
(constructor) VLIB_REGISTER_NODE (ip4_midchain_node)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vnet_classify_main_t vnet_classify_main
vlib_node_registration_t ip4_rewrite_mcast_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_mcast_node)
Route added as a result of interface configuration.
clib_error_t * ip4_lookup_init(vlib_main_t *vm)
#define VNET_FEATURES(...)
static vlib_main_t * vlib_get_main(void)
static uword ip4_local(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_elt(v, i)
Get vector value at index i.
u8 ucast_feature_arc_index
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
index_t dpoi_index
the index of objects of that type
static void ip4_local_validate_l4(vlib_main_t *vm, vlib_buffer_t *p, ip4_header_t *ip, u8 is_udp, u8 *error, u8 *good_tcp_udp)
VNET_FEATURE_INIT(ip4_flow_classify, static)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
vnet_sw_interface_t * sw_interfaces
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u8 * format_ip4_forward_next_trace(u8 *s, va_list *args)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
adj_index_t adj_glean_add_or_lock(fib_protocol_t proto, vnet_link_t linkt, u32 sw_if_index, const ip46_address_t *nh_addr)
Glean Adjacency.
clib_error_t * ip_interface_address_add_del(ip_lookup_main_t *lm, u32 sw_if_index, void *addr_fib, u32 address_length, u32 is_del, u32 *result_if_address_index)
A collection of combined counters.
static uword ip4_flow_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define clib_mem_unaligned(pointer, type)
static clib_error_t * mfib_module_init(vlib_main_t *vm)
static void ip4_del_interface_routes(ip4_main_t *im, u32 fib_index, ip4_address_t *address, u32 address_length)
static uword ip4_source_and_port_range_check_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword ip4_mcast_midchain(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
int vnet_set_ip4_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
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.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
#define vec_foreach(var, vec)
Vector iterator.
index_t ip4_fib_table_lookup_lb(ip4_fib_t *fib, const ip4_address_t *addr)
static uword ip4_rewrite_mcast(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u16 flags
Copy of main node flags.
u16 dpoi_next_node
The next VLIB node to follow.
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(ip4_sw_interface_add_del)
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
static uword ip4_lookup(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
IPv4 lookup node.
static uword ip4_rewrite(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
IPv4 rewrite node.
#define VLIB_NODE_FLAG_TRACE
static uword ip4_outacl(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
#define vnet_rewrite_two_headers(rw0, rw1, p0, p1, most_likely_size)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
This adjacency/interface has output features configured.
static int ip4_src_address_for_packet(ip_lookup_main_t *lm, u32 sw_if_index, ip4_address_t *src)
static uword ip4_vxlan_bypass(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static uword ip4_source_and_port_range_check_rx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static u16 ip4_header_checksum(ip4_header_t *i)
clib_random_buffer_t random_buffer
static u16 ip_csum_fold(ip_csum_t c)
static int adj_are_counters_enabled(void)
Get the global configuration option for enabling per-adj counters.
static char * ip4_arp_error_strings[]
struct ip_adjacency_t_::@43::@46 glean
IP_LOOKUP_NEXT_GLEAN.
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
static vlib_node_registration_t ip4_local_end_of_arc_node
(constructor) VLIB_REGISTER_NODE (ip4_local_end_of_arc_node)
static ip4_address_t * ip4_interface_address_matching_destination(ip4_main_t *im, ip4_address_t *dst, u32 sw_if_index, ip_interface_address_t **result_ia)
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
static uword pool_elts(void *v)
Number of active elements in a pool.