60 u32 disable_default_route)
64 uword * p, * hash, key;
65 i32 i, i_min, dst_address, ai;
67 i_min = disable_default_route ? 1 : 0;
123 uword * p, fib_index;
125 fib_index = table_index_or_id;
130 if (table_index_or_id == ~0) {
131 table_index_or_id = 0;
179 u32 dst_address_length,
197 hash = _hash_set3 (hash, dst_address_u32,
214 &d, dst_address_length,
218 p =
hash_get (hash, dst_address_u32);
232 u32 dst_address, dst_address_length, adj_index, old_adj_index;
233 uword * hash, is_del;
250 dst_address &= im->
fib_masks[dst_address_length];
285 if (old_adj_index == adj_index
295 is_del ? old_adj_index : adj_index,
300 && old_adj_index != ~0
301 && old_adj_index != adj_index)
310 u32 next_hop_sw_if_index,
311 u32 explicit_fib_index)
315 uword * nh_hash, * nh_result;
316 int is_interface_next_hop;
322 is_interface_next_hop = next_hop->
data_u32 == 0;
323 if (is_interface_next_hop)
327 nh_adj_index = *nh_result;
338 else if (next_hop_sw_if_index == ~0)
346 memset (&add_adj, 0,
sizeof(add_adj));
370 adj->
arp.next_hop.ip4.as_u32 == 0)
377 nh_adj_index = *nh_result;
381 return (nh_adj_index);
388 u32 dst_address_length,
390 u32 next_hop_sw_if_index,
391 u32 next_hop_weight,
u32 adj_index,
392 u32 explicit_fib_index)
398 u32 dst_address_u32, old_mp_adj_index, new_mp_adj_index;
399 u32 dst_adj_index, nh_adj_index;
400 uword * dst_hash, * dst_result;
406 if (explicit_fib_index == (
u32)~0)
409 fib_index = explicit_fib_index;
414 if (adj_index == (
u32)~0)
418 next_hop_sw_if_index,
423 nh_adj_index = adj_index;
429 dst_result =
hash_get (dst_hash, dst_address_u32);
432 dst_adj_index = dst_result[0];
440 vnm->
api_errno = VNET_API_ERROR_UNKNOWN_DESTINATION;
453 && dst_address_length == 32
455 && adj_index != (
u32)~0)
457 vnm->
api_errno = VNET_API_ERROR_PREFIX_MATCHES_NEXT_HOP;
466 if (dst_adj_index == ~0 && next_hop_weight == 1 && next_hop_sw_if_index == ~0)
487 old_mp_adj_index = dst_adj ? dst_adj->
heap_handle : ~0;
496 vnm->
api_errno = VNET_API_ERROR_NEXT_HOP_NOT_FOUND_MP;
497 error =
clib_error_return (0,
"requested deleting next-hop %U not found in multi-path",
503 if (old_mp_adj_index != ~0)
505 if (new_mp_adj_index != ~0)
508 if (old_mp != new_mp)
538 u32 table_index_or_table_id,
544 u32 dst_address = * (
u32 *) address;
548 dst_address &= im->
fib_masks[address_length];
557 u32 table_index_or_table_id,
562 u8 ** result_lengths)
566 u32 this_length = address_length;
569 _vec_len (*results) = 0;
571 _vec_len (*result_lengths) = 0;
573 while (this_length <= 32 &&
vec_len (results) == 0)
577 if (0 == ((k ^ dst_address) & im->fib_masks[address_length]))
581 vec_add1 (*results, a);
582 vec_add1 (*result_lengths, this_length);
591 u32 table_index_or_table_id,
604 for (l = 0; l <= 32; l++)
613 _vec_len (to_delete) = 0;
647 for (i = 0; i <
vec_len (to_delete); i++)
649 hash = _hash_unset (hash, to_delete[i].data_u32, fib->
old_hash_values);
671 u32 table_index_or_table_id,
677 static u8 * matching_address_lengths;
687 for (l = address_length + 1; l <= 32; l++)
693 &matching_address_lengths);
694 for (i = 0; i <
vec_len (matching_addresses); i++)
715 int lookup_for_responses_to_locally_received_packets,
721 u32 n_left_from, n_left_to_next, * from, * to_next;
729 while (n_left_from > 0)
732 to_next, n_left_to_next);
734 while (n_left_from >= 4 && n_left_to_next >= 2)
744 __attribute__((unused))
u32 pi0, fib_index0, adj_index0, is_tcp_udp0;
745 __attribute__((unused))
u32 pi1, fib_index1, adj_index1, is_tcp_udp1;
746 u32 flow_hash_config0, flow_hash_config1;
747 u32 hash_c0, hash_c1;
764 pi0 = to_next[0] = from[0];
765 pi1 = to_next[1] = from[1];
778 dst_addr0 = &iadj0->
indirect.next_hop.ip4;
779 dst_addr1 = &iadj1->
indirect.next_hop.ip4;
795 if (! lookup_for_responses_to_locally_received_packets)
806 tcp0 = (
void *) (ip0 + 1);
807 tcp1 = (
void *) (ip1 + 1);
809 is_tcp_udp0 = (ip0->
protocol == IP_PROTOCOL_TCP
810 || ip0->
protocol == IP_PROTOCOL_UDP);
811 is_tcp_udp1 = (ip1->
protocol == IP_PROTOCOL_TCP
812 || ip1->
protocol == IP_PROTOCOL_UDP);
814 if (! lookup_for_responses_to_locally_received_packets)
820 if (! lookup_for_responses_to_locally_received_packets)
826 if (! lookup_for_responses_to_locally_received_packets)
832 if (lookup_for_responses_to_locally_received_packets)
881 adj_index0 += (hash_c0 & (adj0->
n_adj - 1));
882 adj_index1 += (hash_c1 & (adj1->
n_adj - 1));
897 (cm, cpu_index, adj_index0, 1,
901 (cm, cpu_index, adj_index1, 1,
910 wrong_next = (next0 != next) + 2*(next1 != next);
947 while (n_left_from > 0 && n_left_to_next > 0)
957 __attribute__((unused))
u32 pi0, fib_index0, adj_index0, is_tcp_udp0;
958 u32 flow_hash_config0, hash_c0;
971 dst_addr0 = &iadj0->
indirect.next_hop.ip4;
982 if (! lookup_for_responses_to_locally_received_packets)
991 tcp0 = (
void *) (ip0 + 1);
993 is_tcp_udp0 = (ip0->
protocol == IP_PROTOCOL_TCP
994 || ip0->
protocol == IP_PROTOCOL_UDP);
996 if (! lookup_for_responses_to_locally_received_packets)
999 if (! lookup_for_responses_to_locally_received_packets)
1002 if (! lookup_for_responses_to_locally_received_packets)
1005 if (lookup_for_responses_to_locally_received_packets)
1035 adj_index0 += (hash_c0 & (adj0->
n_adj - 1));
1047 (cm, cpu_index, adj_index0, 1,
1053 n_left_to_next -= 1;
1058 n_left_to_next += 1;
1062 to_next, n_left_to_next);
1065 n_left_to_next -= 1;
1124 u32 if_address_index)
1145 adj->
arp.next_hop.ip4.as_u32 = 0;
1147 packet_type = VNET_L3_PACKET_TYPE_ARP;
1153 packet_type = VNET_L3_PACKET_TYPE_IP4;
1163 &adj->rewrite_header,
1164 sizeof (adj->rewrite_data));
1178 u32 classify_table_index;
1205 classify_table_index = ~0;
1208 if (classify_table_index != (
u32) ~0)
1211 adj->
classify.table_index = classify_table_index;
1217 adj->rewrite_header.sw_if_index = sw_if_index;
1223 adj->rewrite_header.data_bytes = 0;
1246 if (address_length < 32)
1287 u32 if_address_index, elts_before;
1302 ip4_address_t * x = ip_interface_address_get_address (&im->lookup_main, ia);
1304 if (ip4_destination_matches_route (im, address, x, ia->address_length)
1305 || ip4_destination_matches_route (im, x, address, address_length))
1306 return clib_error_create (
"failed to add %U which conflicts with %U for interface %U",
1307 format_ip4_address_and_length, address, address_length,
1308 format_ip4_address_and_length, x, ia->address_length,
1309 format_vnet_sw_if_index_name, vnm, sw_if_index);
1344 address, address_length,
1360 (vm, sw_if_index, address, address_length,
1374 u32 is_admin_up, fib_index;
1388 a = ip_interface_address_get_address (&im->lookup_main, ia);
1390 ip4_add_interface_routes (sw_if_index,
1394 ip4_del_interface_routes (im, fib_index,
1395 a, ia->address_length);
1405 .node_name =
"ip4-inacl",
1406 .runs_before = {
"ip4-source-check-via-rx", 0},
1411 .node_name =
"ip4-source-check-via-rx",
1412 .runs_before = {
"ip4-source-check-via-any", 0},
1418 .node_name =
"ip4-source-check-via-any",
1419 .runs_before = {
"ip4-policer-classify", 0},
1425 .node_name =
"ip4-source-and-port-range-check",
1426 .runs_before = {
"ip4-policer-classify", 0},
1432 .node_name =
"ip4-policer-classify",
1433 .runs_before = {
"ipsec-input-ip4", 0},
1439 .node_name =
"ipsec-input-ip4",
1440 .runs_before = {
"vpath-input-ip4", 0},
1445 .node_name =
"vpath-input-ip4",
1446 .runs_before = {
"ip4-lookup", 0},
1451 .node_name =
"ip4-lookup",
1458 .node_name =
"vpath-input-ip4",
1459 .runs_before = {
"ip4-lookup-multicast", 0},
1464 .node_name =
"ip4-lookup-multicast",
1470 {
"ip4-input",
"ip4-input-no-checksum"};
1543 .name =
"ip4-lookup",
1544 .vector_size =
sizeof (
u32),
1566 .name =
"ip4-indirect",
1567 .vector_size =
sizeof (
u32),
1568 .sibling_of =
"ip4-lookup",
1612 memset (&h, 0,
sizeof (h));
1617 #define _16(f,v) h.f = clib_host_to_net_u16 (v); 1618 #define _8(f,v) h.f = v; 1619 _16 (l2_type, ETHERNET_ARP_HARDWARE_TYPE_ethernet);
1620 _16 (l3_type, ETHERNET_TYPE_IP4);
1621 _8 (n_l2_address_bytes, 6);
1622 _8 (n_l3_address_bytes, 4);
1623 _16 (opcode, ETHERNET_ARP_OPCODE_request);
1673 s =
format (s,
"fib %d adj-idx %d : %U flow hash: 0x%08x",
1691 s =
format (s,
"tx_sw_if_index %d adj-idx %d : %U flow hash: 0x%08x",
1834 .vector_size =
sizeof (
u32),
1849 .vector_size =
sizeof (
u32),
1864 .vector_size =
sizeof (
u32),
1882 u32 ip_header_length, payload_length_host_byte_order;
1883 u32 n_this_buffer, n_bytes_left;
1885 void * data_this_buffer;
1889 payload_length_host_byte_order = clib_net_to_host_u16 (ip0->
length) - ip_header_length;
1890 sum0 = clib_host_to_net_u32 (payload_length_host_byte_order + (ip0->
protocol << 16));
1900 n_bytes_left = n_this_buffer = payload_length_host_byte_order;
1901 data_this_buffer = (
void *) ip0 + ip_header_length;
1907 n_bytes_left -= n_this_buffer;
1908 if (n_bytes_left == 0)
1930 || ip0->
protocol == IP_PROTOCOL_UDP);
1932 udp0 = (
void *) (ip0 + 1);
1956 u32 * from, * to_next, n_left_from, n_left_to_next;
1966 while (n_left_from > 0)
1970 while (n_left_from >= 4 && n_left_to_next >= 2)
1978 u32 pi0, ip_len0, udp_len0, flags0, next0, fib_index0, adj_index0;
1979 u32 pi1, ip_len1, udp_len1, flags1, next1, fib_index1, adj_index1;
1980 i32 len_diff0, len_diff1;
1981 u8 error0, is_udp0, is_tcp_udp0, good_tcp_udp0, proto0;
1982 u8 error1, is_udp1, is_tcp_udp1, good_tcp_udp1, proto1;
1985 pi0 = to_next[0] = from[0];
1986 pi1 = to_next[1] = from[1];
1990 n_left_to_next -= 2;
2015 is_udp0 = proto0 == IP_PROTOCOL_UDP;
2016 is_udp1 = proto1 == IP_PROTOCOL_UDP;
2017 is_tcp_udp0 = is_udp0 || proto0 == IP_PROTOCOL_TCP;
2018 is_tcp_udp1 = is_udp1 || proto1 == IP_PROTOCOL_TCP;
2030 good_tcp_udp0 |= is_udp0 && udp0->
checksum == 0;
2031 good_tcp_udp1 |= is_udp1 && udp1->
checksum == 0;
2037 ip_len0 = clib_net_to_host_u16 (ip0->
length);
2038 ip_len1 = clib_net_to_host_u16 (ip1->
length);
2039 udp_len0 = clib_net_to_host_u16 (udp0->
length);
2040 udp_len1 = clib_net_to_host_u16 (udp1->
length);
2042 len_diff0 = ip_len0 - udp_len0;
2043 len_diff1 = ip_len1 - udp_len1;
2045 len_diff0 = is_udp0 ? len_diff0 : 0;
2046 len_diff1 = is_udp1 ? len_diff1 : 0;
2049 & good_tcp_udp0 & good_tcp_udp1)))
2058 good_tcp_udp0 |= is_udp0 && udp0->
checksum == 0;
2067 good_tcp_udp1 |= is_udp1 && udp1->
checksum == 0;
2071 good_tcp_udp0 &= len_diff0 >= 0;
2072 good_tcp_udp1 &= len_diff1 >= 0;
2077 error0 = error1 = IP4_ERROR_UNKNOWN_PROTOCOL;
2079 error0 = len_diff0 < 0 ? IP4_ERROR_UDP_LENGTH : error0;
2080 error1 = len_diff1 < 0 ? IP4_ERROR_UDP_LENGTH : error1;
2082 ASSERT (IP4_ERROR_TCP_CHECKSUM + 1 == IP4_ERROR_UDP_CHECKSUM);
2083 error0 = (is_tcp_udp0 && ! good_tcp_udp0
2084 ? IP4_ERROR_TCP_CHECKSUM + is_udp0
2086 error1 = (is_tcp_udp1 && ! good_tcp_udp1
2087 ? IP4_ERROR_TCP_CHECKSUM + is_udp1
2113 error0 = (error0 == IP4_ERROR_UNKNOWN_PROTOCOL
2118 ? IP4_ERROR_SRC_LOOKUP_MISS
2120 error1 = (error1 == IP4_ERROR_UNKNOWN_PROTOCOL
2125 ? IP4_ERROR_SRC_LOOKUP_MISS
2134 p0->
error = error0 ? error_node->
errors[error0] : 0;
2135 p1->
error = error1 ? error_node->
errors[error1] : 0;
2137 enqueue_code = (next0 != next_index) + 2*(next1 != next_index);
2141 switch (enqueue_code)
2147 n_left_to_next += 1;
2154 n_left_to_next += 1;
2161 n_left_to_next += 2;
2175 while (n_left_from > 0 && n_left_to_next > 0)
2183 u32 pi0, next0, ip_len0, udp_len0, flags0, fib_index0, adj_index0;
2185 u8 error0, is_udp0, is_tcp_udp0, good_tcp_udp0, proto0;
2187 pi0 = to_next[0] = from[0];
2191 n_left_to_next -= 1;
2209 is_udp0 = proto0 == IP_PROTOCOL_UDP;
2210 is_tcp_udp0 = is_udp0 || proto0 == IP_PROTOCOL_TCP;
2219 good_tcp_udp0 |= is_udp0 && udp0->
checksum == 0;
2224 ip_len0 = clib_net_to_host_u16 (ip0->
length);
2225 udp_len0 = clib_net_to_host_u16 (udp0->
length);
2227 len_diff0 = ip_len0 - udp_len0;
2229 len_diff0 = is_udp0 ? len_diff0 : 0;
2240 good_tcp_udp0 |= is_udp0 && udp0->
checksum == 0;
2244 good_tcp_udp0 &= len_diff0 >= 0;
2248 error0 = IP4_ERROR_UNKNOWN_PROTOCOL;
2250 error0 = len_diff0 < 0 ? IP4_ERROR_UDP_LENGTH : error0;
2252 ASSERT (IP4_ERROR_TCP_CHECKSUM + 1 == IP4_ERROR_UDP_CHECKSUM);
2253 error0 = (is_tcp_udp0 && ! good_tcp_udp0
2254 ? IP4_ERROR_TCP_CHECKSUM + is_udp0
2269 error0 = (error0 == IP4_ERROR_UNKNOWN_PROTOCOL
2274 ? IP4_ERROR_SRC_LOOKUP_MISS
2281 p0->
error = error0? error_node->
errors[error0] : 0;
2285 n_left_to_next += 1;
2292 n_left_to_next -= 1;
2304 .name =
"ip4-local",
2305 .vector_size =
sizeof (
u32),
2351 .path =
"show ip local",
2353 .short_help =
"Show ip local protocol table",
2364 u32 * from, * to_next_drop;
2365 uword n_left_from, n_left_to_next_drop, next_index;
2366 static f64 time_last_seed_change = -1e100;
2367 static u32 hash_seeds[3];
2375 if (time_now - time_last_seed_change > 1e-3)
2379 sizeof (hash_seeds));
2380 for (i = 0; i <
ARRAY_LEN (hash_seeds); i++)
2381 hash_seeds[i] = r[i];
2384 for (i = 0; i <
ARRAY_LEN (hash_bitmap); i++)
2387 time_last_seed_change = time_now;
2396 while (n_left_from > 0)
2399 to_next_drop, n_left_to_next_drop);
2401 while (n_left_from > 0 && n_left_to_next_drop > 0)
2406 u32 pi0, adj_index0, a0, b0, c0, m0, sw_if_index0, drop0;
2419 if (adj0->
arp.next_hop.ip4.as_u32)
2433 while ((*etype == clib_host_to_net_u16 (0x8100))
2434 || (*etype == clib_host_to_net_u16 (0x88a8)))
2439 if (*etype == clib_host_to_net_u16 (0x0806))
2451 sw_if_index0 = adj0->rewrite_header.sw_if_index;
2459 c0 &=
BITS (hash_bitmap) - 1;
2463 bm0 = hash_bitmap[c0];
2464 drop0 = (bm0 & m0) != 0;
2467 hash_bitmap[c0] = bm0 | m0;
2471 to_next_drop[0] = pi0;
2473 n_left_to_next_drop -= 1;
2545 .vector_size =
sizeof (
u32),
2558 #define foreach_notrace_ip4_arp_error \ 2571 vnet_pcap_drop_trace_filter_add_del \ 2572 (rt->errors[IP4_ARP_ERROR_##a], \ 2610 vnm->
api_errno = VNET_API_ERROR_NO_MATCHING_INTERFACE;
2612 (0,
"no matching interface address for destination %U (interface %U)",
2656 int rewrite_for_locally_received_packets)
2660 u32 n_left_from, n_left_to_next, * to_next, next_index;
2668 while (n_left_from > 0)
2672 while (n_left_from >= 4 && n_left_to_next >= 2)
2677 u32 pi0, rw_len0, next0, error0, checksum0, adj_index0;
2678 u32 pi1, rw_len1, next1, error1, checksum1, adj_index1;
2679 u32 next0_override, next1_override;
2681 if (rewrite_for_locally_received_packets)
2682 next0_override = next1_override = 0;
2698 pi0 = to_next[0] = from[0];
2699 pi1 = to_next[1] = from[1];
2704 n_left_to_next -= 2;
2709 adj_index0 =
vnet_buffer (p0)->ip.adj_index[adj_rx_tx];
2710 adj_index1 =
vnet_buffer (p1)->ip.adj_index[adj_rx_tx];
2713 ASSERT(adj_index0 && adj_index1);
2718 error0 = error1 = IP4_ERROR_NONE;
2723 if (! rewrite_for_locally_received_packets)
2731 checksum0 = ip0->
checksum + clib_host_to_net_u16 (0x0100);
2732 checksum1 = ip1->
checksum + clib_host_to_net_u16 (0x0100);
2734 checksum0 += checksum0 >= 0xffff;
2735 checksum1 += checksum1 >= 0xffff;
2752 error0 = IP4_ERROR_TIME_EXPIRED;
2755 ICMP4_time_exceeded_ttl_exceeded_in_transit, 0);
2760 error1 = IP4_ERROR_TIME_EXPIRED;
2763 ICMP4_time_exceeded_ttl_exceeded_in_transit, 0);
2776 if (rewrite_for_locally_received_packets)
2786 error0 = IP4_ERROR_SPOOFED_LOCAL_PACKETS;
2792 error1 = IP4_ERROR_SPOOFED_LOCAL_PACKETS;
2799 rw_len0 = adj0[0].rewrite_header.data_bytes;
2800 rw_len1 = adj1[0].rewrite_header.data_bytes;
2804 ? IP4_ERROR_MTU_EXCEEDED
2807 ? IP4_ERROR_MTU_EXCEEDED
2810 next0 = (error0 == IP4_ERROR_NONE)
2811 ? adj0[0].rewrite_header.next_index : next0;
2813 if (rewrite_for_locally_received_packets)
2814 next0 = next0 && next0_override ? next0_override : next0;
2816 next1 = (error1 == IP4_ERROR_NONE)
2817 ? adj1[0].rewrite_header.next_index : next1;
2819 if (rewrite_for_locally_received_packets)
2820 next1 = next1 && next1_override ? next1_override : next1;
2828 cpu_index, adj_index0,
2835 cpu_index, adj_index1,
2847 adj0[0].rewrite_header.sw_if_index;
2855 adj1[0].rewrite_header.sw_if_index;
2864 to_next, n_left_to_next,
2865 pi0, pi1, next0, next1);
2868 while (n_left_from > 0 && n_left_to_next > 0)
2873 u32 pi0, rw_len0, adj_index0, next0, error0, checksum0;
2876 if (rewrite_for_locally_received_packets)
2879 pi0 = to_next[0] = from[0];
2883 adj_index0 =
vnet_buffer (p0)->ip.adj_index[adj_rx_tx];
2892 error0 = IP4_ERROR_NONE;
2896 if (! rewrite_for_locally_received_packets)
2900 checksum0 = ip0->
checksum + clib_host_to_net_u16 (0x0100);
2902 checksum0 += checksum0 >= 0xffff;
2920 error0 = IP4_ERROR_TIME_EXPIRED;
2924 ICMP4_time_exceeded_ttl_exceeded_in_transit, 0);
2928 if (rewrite_for_locally_received_packets)
2938 error0 = IP4_ERROR_SPOOFED_LOCAL_PACKETS;
2953 rw_len0 = adj0[0].rewrite_header.data_bytes;
2958 cpu_index, adj_index0,
2964 > adj0[0].rewrite_header.max_l3_packet_bytes
2965 ? IP4_ERROR_MTU_EXCEEDED
2978 adj0[0].rewrite_header.sw_if_index;
2979 next0 = adj0[0].rewrite_header.next_index;
2982 if (rewrite_for_locally_received_packets)
2983 next0 = next0 && next0_override ? next0_override : next0;
2988 n_left_to_next -= 1;
2991 to_next, n_left_to_next,
3090 .name =
"ip4-rewrite-transit",
3091 .vector_size =
sizeof (
u32),
3107 .name =
"ip4-rewrite-local",
3108 .vector_size =
sizeof (
u32),
3110 .sibling_of =
"ip4-rewrite-transit",
3126 u32 sw_if_index, table_id;
3137 if (
unformat (input,
"%d", &table_id))
3176 .path =
"set interface ip table",
3178 .short_help =
"Add/delete FIB table id for interface",
3190 u32 n_left_from, n_left_to_next, * from, * to_next;
3198 while (n_left_from > 0)
3201 to_next, n_left_to_next);
3203 while (n_left_from >= 4 && n_left_to_next >= 2)
3206 u32 pi0, pi1, adj_index0, adj_index1, wrong_next;
3210 u32 fib_index0, fib_index1;
3211 u32 flow_hash_config0, flow_hash_config1;
3227 pi0 = to_next[0] = from[0];
3228 pi1 = to_next[1] = from[1];
3261 (ip0, flow_hash_config0);
3264 (ip1, flow_hash_config1);
3278 (cm, cpu_index, adj_index0, 1,
3282 (cm, cpu_index, adj_index1, 1,
3287 n_left_to_next -= 2;
3290 wrong_next = (next0 != next) + 2*(next1 != next);
3299 n_left_to_next += 1;
3306 n_left_to_next += 1;
3313 n_left_to_next += 2;
3327 while (n_left_from > 0 && n_left_to_next > 0)
3331 u32 pi0, adj_index0;
3335 u32 flow_hash_config0;
3370 (cm, cpu_index, adj_index0, 1,
3375 n_left_to_next -= 1;
3380 n_left_to_next += 1;
3384 to_next, n_left_to_next);
3387 n_left_to_next -= 1;
3402 .name =
"ip4-lookup-multicast",
3403 .vector_size =
sizeof (
u32),
3404 .sibling_of =
"ip4-lookup",
3414 .name =
"ip4-multicast",
3415 .vector_size =
sizeof (
u32),
3463 if (
unformat (input,
"table %d", &table_id))
3465 else if (
unformat (input,
"count %f", &count))
3478 for (i = 0; i < n; i++)
3483 ip4_base_address.
as_u32 =
3484 clib_host_to_net_u32 (1 +
3485 clib_net_to_host_u32 (ip4_base_address.
as_u32));
3497 .path =
"test lookup",
3498 .short_help =
"test lookup",
3509 return VNET_API_ERROR_NO_SUCH_FIB;
3524 u32 flow_hash_config = 0;
3528 if (
unformat (input,
"table %d", &table_id))
3531 else if (unformat (input, #a)) { flow_hash_config |= v; matched=1;} 3547 case VNET_API_ERROR_NO_SUCH_FIB:
3551 clib_warning (
"BUG: illegal flow hash config 0x%x", flow_hash_config);
3559 .path =
"set ip flow-hash",
3561 "set ip table flow-hash table <fib-id> src dst sport dport proto reverse",
3575 return VNET_API_ERROR_NO_MATCHING_INTERFACE;
3578 return VNET_API_ERROR_NO_SUCH_ENTRY;
3591 u32 table_index = ~0;
3592 int table_index_set = 0;
3593 u32 sw_if_index = ~0;
3597 if (
unformat (input,
"table-index %d", &table_index))
3598 table_index_set = 1;
3606 if (table_index_set == 0)
3609 if (sw_if_index == ~0)
3619 case VNET_API_ERROR_NO_MATCHING_INTERFACE:
3622 case VNET_API_ERROR_NO_SUCH_ENTRY:
3629 .path =
"set ip classify",
3631 "set ip classify intfc <int> table-index <index>",
struct ip_adjacency_t::@143::@147 indirect
IP_LOOKUP_NEXT_INDIRECT only.
static vlib_node_registration_t ip4_miss_node
(constructor) VLIB_REGISTER_NODE (ip4_miss_node)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void ip4_fib_set_adj_index(ip4_main_t *im, ip4_fib_t *fib, u32 flags, u32 dst_address_u32, u32 dst_address_length, u32 adj_index)
static void ip_call_add_del_adjacency_callbacks(ip_lookup_main_t *lm, u32 adj_index, u32 is_del)
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.
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
ip_lookup_next_t
Common (IP4/IP6) next index stored in adjacency.
#define vec_zero(var)
Zero all vector elements.
static uword ip4_rewrite_local(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
IPv4 local rewrite node.
VNET_IP4_UNICAST_FEATURE_INIT(ip4_inacl, static)
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)
#define VNET_REWRITE_FOR_SW_INTERFACE_ADDRESS_BROADCAST
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
uword vlib_error_drop_buffers(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u32 next_buffer_stride, u32 n_buffers, u32 next_index, u32 drop_error_node, u32 drop_error_code)
u32 ip4_multicast_rx_feature_vpath
Built-in multicast feature path indices.
static vlib_node_registration_t ip4_drop_node
(constructor) VLIB_REGISTER_NODE (ip4_drop_node)
u32 * config_index_by_sw_if_index
int vnet_set_ip4_flow_hash(u32 table_id, u32 flow_hash_config)
static uword ip4_drop(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
ip4_add_del_interface_address_callback_t * add_del_interface_address_callbacks
Functions to call when interface address changes.
u32 ip4_unicast_rx_feature_source_reachable_via_any
Built-in unicast feature path indice, see ip_feature_init_cast()
static vlib_main_t * vlib_get_main(void)
uword * interface_route_adj_index_by_sw_if_index
Hash table mapping interface route rewrite adjacency index by sw if index.
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.
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
u16 n_adj
Number of adjecencies in block.
vnet_interface_main_t interface_main
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
ip_lookup_next_t lookup_next_index
void ip4_add_del_route(ip4_main_t *im, ip4_add_del_route_args_t *a)
static int ip4_header_bytes(ip4_header_t *i)
u32 miss_adj_index
Adjacency index for routing table misses, local punts, and drops.
static f64 vlib_time_now(vlib_main_t *vm)
ip4_fib_t * find_ip4_fib_by_table_index_or_id(ip4_main_t *im, u32 table_index_or_id, u32 flags)
Find existing or Create new FIB based on index.
static void * clib_random_buffer_get_data(clib_random_buffer_t *b, uword n_bytes)
u32 vnet_config_del_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
vlib_node_registration_t ip4_indirect_node
(constructor) VLIB_REGISTER_NODE (ip4_indirect_node)
ip_config_main_t rx_config_mains[VNET_N_CAST]
rx/tx interface/feature configuration.
#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)
u32 share_count
Number of FIB entries sharing this adjacency.
ip_adjacency_t * ip_add_adjacency(ip_lookup_main_t *lm, ip_adjacency_t *copy_adj, u32 n_adj, u32 *adj_index_return)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static clib_error_t * ip4_feature_init(vlib_main_t *vm, ip4_main_t *im)
ip_lookup_main_t lookup_main
static uword ip4_rewrite_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int rewrite_for_locally_received_packets)
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)
void ip4_foreach_matching_route(ip4_main_t *im, u32 table_index_or_table_id, u32 flags, ip4_address_t *address, u32 address_length, ip4_address_t **results, u8 **result_lengths)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
unformat_function_t unformat_vnet_sw_interface
#define clib_error_report(e)
static u8 * format_ip4_forward_next_trace(u8 *s, va_list *args)
#define vec_bytes(v)
Number of data bytes in vector.
static uword ip4_arp(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
u32 neighbor_probe_adj_index
format_function_t format_vnet_sw_if_index_name
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
void * ip4_get_route(ip4_main_t *im, u32 table_index_or_table_id, u32 flags, u8 *address, u32 address_length)
#define IP4_FIB_MTRIE_LEAF_EMPTY
static u32 ip4_fib_lookup_buffer(ip4_main_t *im, u32 fib_index, ip4_address_t *dst, vlib_buffer_t *b)
static pg_node_t * pg_get_node(uword node_index)
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_physmem_alloc, char *fmt,...)
u32 fwd_classify_table_index
u32 ip4_unicast_rx_feature_policer_classify
Built-in unicast feature path indice, see ip_feature_init_cast()
vnet_main_t * vnet_get_main(void)
static void ip4_fib_init_adj_index_by_dst_address(ip_lookup_main_t *lm, ip4_fib_t *fib, u32 address_length)
static clib_error_t * show_ip_local_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
void ip4_adjacency_set_interface_route(vnet_main_t *vnm, ip_adjacency_t *adj, u32 sw_if_index, u32 if_address_index)
void ip4_add_del_route_next_hop(ip4_main_t *im, u32 flags, ip4_address_t *dst_address, u32 dst_address_length, ip4_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_weight, u32 adj_index, u32 explicit_fib_index)
#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...
u32 ip4_unicast_rx_feature_ipsec
Built-in unicast feature path indice, see ip_feature_init_cast()
static ip4_fib_t * create_fib_with_table_id(ip4_main_t *im, u32 table_id)
Create FIB from table ID and init all hashing.
ip_csum_t ip_incremental_checksum(ip_csum_t sum, void *_data, uword n_bytes)
#define VLIB_INIT_FUNCTION(x)
static uword pow2_mask(uword x)
static u32 ip4_tcp_udp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static void ip4_add_interface_routes(u32 sw_if_index, ip4_main_t *im, u32 fib_index, ip_interface_address_t *a)
#define IP_BUFFER_L4_CHECKSUM_CORRECT
u32 * adjacency_remap_table
u32 vnet_arp_glean_add(u32 fib_index, void *next_hop_arg)
#define hash_foreach(key_var, value_var, h, body)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
void ip4_fib_mtrie_add_del_route(ip4_fib_t *fib, ip4_address_t dst_address, u32 dst_address_length, u32 adj_index, u32 is_del)
u32 ip_multipath_adjacency_add_del_next_hop(ip_lookup_main_t *lm, u32 is_del, u32 old_mp_adj_index, u32 next_hop_adj_index, u32 next_hop_weight, u32 *new_mp_adj_index)
#define IP4_LOOKUP_NEXT_NODES
#define clib_warning(format, args...)
vlib_node_registration_t ip4_arp_node
(constructor) VLIB_REGISTER_NODE (ip4_arp_node)
static uword ip4_indirect(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void * ip4_next_header(ip4_header_t *i)
static void hash_set_flags(void *v, uword flags)
This packet is for one of our own IP addresses.
u32 rev_classify_table_index
u32 ip4_unicast_rx_feature_check_access
Built-in unicast feature path indice, see ip_feature_init_cast()
static uword hash_value_bytes(hash_t *h)
void ip_del_adjacency(ip_lookup_main_t *lm, u32 adj_index)
#define foreach_notrace_ip4_arp_error
static u32 ip4_fib_mtrie_leaf_get_adj_index(ip4_fib_mtrie_leaf_t n)
#define VLIB_BUFFER_NEXT_PRESENT
vlib_node_registration_t ip4_rewrite_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_node)
static hash_t * hash_header(void *v)
static int ip4_is_fragment(ip4_header_t *i)
vnet_api_error_t api_errno
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
uword * fib_index_by_table_id
Hash table mapping table id to fib index.
vlib_node_registration_t ip4_input_node
Global ip4 input node.
u16 current_length
Nbytes between current data and the end of this buffer.
clib_error_t * ip_feature_init_cast(vlib_main_t *vm, ip_config_main_t *cm, vnet_config_main_t *vcm, char **feature_start_nodes, int num_feature_start_nodes, vnet_cast_t cast, int is_ip4)
u32 * classify_table_index_by_sw_if_index
First table index to use for this interface, ~0 => none.
static vlib_node_registration_t ip4_local_node
(constructor) VLIB_REGISTER_NODE (ip4_local_node)
clib_error_t * arp_notrace_init(vlib_main_t *vm)
static uword ip4_rewrite_transit(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
IPv4 transit rewrite node.
void ip4_register_protocol(u32 protocol, u32 node_index)
uword os_get_cpu_number(void)
static uword ip4_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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)
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.
vnet_hw_interface_class_t srp_hw_interface_class
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#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.
static ip4_fib_mtrie_leaf_t ip4_fib_mtrie_lookup_step(ip4_fib_mtrie_t *m, ip4_fib_mtrie_leaf_t current_leaf, ip4_address_t *dst_address, u32 dst_address_byte_index)
#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.
VNET_IP4_MULTICAST_FEATURE_INIT(ip4_vpath_mc, static)
#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).
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u32 ip4_multicast_rx_feature_lookup
Built-in multicast feature path indices.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static vlib_node_registration_t ip4_punt_node
(constructor) VLIB_REGISTER_NODE (ip4_punt_node)
vnet_hw_interface_class_t ethernet_hw_interface_class
static u8 * format_ip4_lookup_trace(u8 *s, va_list *args)
This packet needs to be classified.
clib_error_t * ip4_probe_neighbor(vlib_main_t *vm, ip4_address_t *dst, u32 sw_if_index)
static uword ip4_miss(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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)
static void vlib_buffer_copy_trace_flag(vlib_main_t *vm, vlib_buffer_t *b, u32 bi_target)
void ip4_mtrie_init(ip4_fib_mtrie_t *m)
#define CLIB_PREFETCH(addr, size, type)
void ip4_maybe_remap_adjacencies(ip4_main_t *im, u32 table_index_or_table_id, u32 flags)
#define vec_free(V)
Free vector's memory (no header).
void vnet_rewrite_for_sw_interface(vnet_main_t *vnm, vnet_l3_packet_type_t packet_type, u32 sw_if_index, u32 node_index, void *dst_address, vnet_rewrite_header_t *rw, u32 max_rewrite_bytes)
u32 ip4_unicast_rx_feature_source_reachable_via_rx
Built-in unicast feature path indice, see ip_feature_init_cast()
void icmp4_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
u32 ip4_unicast_rx_feature_lookup
Built-in unicast feature path indice, see ip_feature_init_cast()
ip4_add_del_interface_address_function_t * function
static clib_error_t * add_del_interface_table(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
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
static vlib_node_registration_t ip4_multicast_node
(constructor) VLIB_REGISTER_NODE (ip4_multicast_node)
u8 packet_data[64-1 *sizeof(u32)]
void ip4_delete_matching_routes(ip4_main_t *im, u32 table_index_or_table_id, u32 flags, ip4_address_t *address, u32 address_length)
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.
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
static uword round_pow2(uword x, uword pow2)
struct ip_adjacency_t::@143::@146 classify
IP_LOOKUP_NEXT_CLASSIFY only.
u32 ip4_route_get_next_hop_adj(ip4_main_t *im, u32 fib_index, ip4_address_t *next_hop, u32 next_hop_sw_if_index, u32 explicit_fib_index)
static void ip4_addr_fib_init(ip4_address_fib_t *addr_fib, ip4_address_t *address, u32 fib_index)
#define IP4_ROUTE_FLAG_DEL
static clib_error_t * set_ip_classify_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_combined_counter_main_t adjacency_counters
Adjacency packet/byte counters indexed by adjacency index.
static clib_error_t * ip4_add_del_interface_address_internal(vlib_main_t *vm, u32 sw_if_index, ip4_address_t *new_address, u32 new_length, u32 redistribute, u32 insert_routes, u32 is_del)
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
u32 * if_address_pool_index_by_sw_if_index
Head of doubly linked list of interface addresses for each software interface.
vlib_packet_template_t ip4_arp_request_packet_template
Template used to generate IP4 ARP packets.
#define hash_create(elts, value_bytes)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
u32 max_l3_packet_bytes[VLIB_N_RX_TX]
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
Increment a combined counter.
static uword hash_elts(void *v)
#define IP4_FIB_MTRIE_LEAF_ROOT
static int ip4_src_address_for_packet(ip4_main_t *im, vlib_buffer_t *p, ip4_address_t *src, u32 sw_if_index)
ip4_fib_t * fibs
Vector of FIBs.
ip4_address_t dst_address
#define IP4_ROUTE_FLAG_ADD
#define LOG2_IP_BUFFER_L4_CHECKSUM_CORRECT
void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
#define hash_v3_finalize32(a, b, c)
u32 next_buffer
Next buffer for this linked-list of buffers.
#define VLIB_NODE_FLAG_TRACE
u32 vnet_config_add_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
vnet_classify_main_t vnet_classify_main
#define IP_FLOW_HASH_DEFAULT
Default: 5-tuple without the "reverse" bit.
clib_error_t * ip4_lookup_init(vlib_main_t *vm)
#define VLIB_BUFFER_IS_TRACED
static char * feature_start_nodes[]
vlib_node_registration_t ip4_rewrite_local_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_local_node)
static uword is_pow2(uword x)
u32 ip4_fib_lookup_with_table(ip4_main_t *im, u32 fib_index, ip4_address_t *dst, u32 disable_default_route)
static uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
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.
#define ip46_address_reset(ip46)
#define IP_BUFFER_L4_CHECKSUM_COMPUTED
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
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, int is_indirect)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_foreach_pair(p, v, body)
u32 heap_handle
Handle for this adjacency in adjacency heap.
#define IP4_ROUTE_FLAG_FIB_INDEX
vnet_sw_interface_t * sw_interfaces
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u32 table_index_or_table_id
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 clib_error_t * ip4_sw_interface_admin_up_down(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
#define IP4_ROUTE_FLAG_KEEP_OLD_ADJACENCY
#define clib_mem_unaligned(pointer, type)
static u32 ip4_compute_flow_hash(ip4_header_t *ip, u32 flow_hash_config)
static uword ip4_source_and_port_range_check(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define IP4_ROUTE_FLAG_NOT_LAST_IN_GROUP
static void ip4_del_interface_routes(ip4_main_t *im, u32 fib_index, ip4_address_t *address, u32 address_length)
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
static uword ip4_lookup_multicast(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
ip_multipath_adjacency_t * multipath_adjacencies
Indexed by heap_handle from ip_adjacency_t.
#define VLIB_REGISTER_NODE(x,...)
This packets needs to go to indirect next hop.
#define IP4_ROUTE_FLAG_TABLE_ID
u32 ip4_unicast_rx_feature_vpath
Built-in unicast feature path indice, see ip_feature_init_cast()
u32 ip4_unicast_rx_feature_source_and_port_range_check
Built-in unicast feature path indice, see ip_feature_init_cast()
int vnet_set_ip4_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
This packet is to be rewritten and forwarded to the next processing node.
ip4_add_del_route_callback_t * add_del_route_callbacks
Vector of functions to call when routes are added/deleted.
u32 if_address_index
Interface address index for this local/arp adjacency.
#define vec_foreach(var, vec)
Vector iterator.
struct ip_adjacency_t::@143::@145 arp
IP_LOOKUP_NEXT_ARP only.
static uword ip4_drop_or_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, ip4_error_t error_code)
i16 explicit_fib_index
Force re-lookup in a different FIB.
uword * adj_index_by_dst_address[33]
#define clib_error_return(e, args...)
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.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#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)
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(ip4_sw_interface_admin_up_down)
void ip4_mtrie_maybe_remap_adjacencies(ip_lookup_main_t *lm, ip4_fib_mtrie_t *m)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
#define HASH_FLAG_NO_AUTO_SHRINK
static vlib_node_registration_t ip4_lookup_multicast_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_multicast_node)
ip4_add_del_route_function_t * function
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)
clib_random_buffer_t random_buffer
vnet_config_main_t config_main
static u16 ip_csum_fold(ip_csum_t c)
static char * ip4_arp_error_strings[]
u32 fib_result_n_bytes
Number of bytes in a fib result.
#define IP4_ROUTE_FLAG_NO_REDISTRIBUTE
static ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
ip4_fib_mtrie_leaf_t default_leaf
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 uword pool_elts(void *v)
Number of active elements in a pool.