55 int dst_address_length = 128 - i;
56 vec_add1 (im->prefix_lengths_in_search_order, dst_address_length);
66 BVT(clib_bihash_kv) kv, value;
71 kv.key[0] = dst->
as_u64[0];
72 kv.key[1] = dst->
as_u64[1];
73 fib = ((
u64)((fib_index))<<32);
75 for (i = 0; i < len; i++)
80 ASSERT(dst_address_length >= 0 && dst_address_length <= 128);
82 kv.key[0] &= mask->
as_u64[0];
83 kv.key[1] &= mask->
as_u64[1];
84 kv.key[2] = fib | dst_address_length;
121 adj->rewrite_header.data_bytes = 0;
133 adj->rewrite_header.data_bytes = 0;
136 IP6_MULTICAST_SCOPE_link_local,
137 IP6_MULTICAST_GROUP_ID_all_routers);
147 adj->rewrite_header.data_bytes = 0;
150 IP6_MULTICAST_SCOPE_link_local,
151 IP6_MULTICAST_GROUP_ID_all_hosts);
161 adj->rewrite_header.data_bytes = 0;
164 IP6_MULTICAST_SCOPE_link_local,
165 IP6_MULTICAST_GROUP_ID_mldv2_routers);
187 uword * p, fib_index;
189 fib_index = table_index_or_id;
192 if (table_index_or_id == ~0) {
193 table_index_or_id = 0;
213 u32 dst_address_length, adj_index;
215 u32 old_adj_index = ~0;
216 BVT(clib_bihash_kv) kv, value;
247 128 - dst_address_length, 0);
257 128 - dst_address_length, 1);
261 kv.key[0] = dst_address.
as_u64[0];
262 kv.key[1] = dst_address.
as_u64[1];
263 kv.key[2] = ((
u64)((fib - im->
fibs))<<32) | dst_address_length;
266 old_adj_index = value.value;
276 kv.value = adj_index;
282 if (old_adj_index == adj_index
294 && old_adj_index != ~0
295 && old_adj_index != adj_index)
304 u32 dst_address_length,
306 u32 next_hop_sw_if_index,
307 u32 next_hop_weight,
u32 adj_index,
308 u32 explicit_fib_index)
315 u32 old_mp_adj_index, new_mp_adj_index;
316 u32 dst_adj_index, nh_adj_index;
321 int is_interface_next_hop;
324 BVT(clib_bihash_kv) kv, value;
328 if (explicit_fib_index == (
u32)~0)
331 fib_index = explicit_fib_index;
337 if (adj_index == (
u32)~0)
339 if (is_interface_next_hop)
342 next_hop_sw_if_index);
344 nh_adj_index = *nh_result;
351 next_hop_sw_if_index, ~0);
353 (lm, next_hop_sw_if_index, 0);
355 next_hop_sw_if_index, nh_adj_index);
361 kv.key[0] = next_hop->
as_u64[0];
362 kv.key[1] = next_hop->
as_u64[1];
363 kv.key[2] = ((
u64)((fib - im->
fibs))<<32) | 128;
373 adj->
arp.next_hop.ip6.as_u64[0] == 0 &&
374 adj->
arp.next_hop.ip6.as_u64[1] == 0)
381 memset (&add_adj, 0,
sizeof(add_adj));
391 nh_adj_index = value.value;
398 kv.key[0] = next_hop->
as_u64[0];
399 kv.key[1] = next_hop->
as_u64[1];
400 kv.key[2] = ((
u64)((fib - im->
fibs))<<32) | 128;
404 vnm->
api_errno = VNET_API_ERROR_UNKNOWN_DESTINATION;
410 nh_adj_index = value.value;
414 masked_dst_address = dst_address[0];
417 kv.key[0] = masked_dst_address.
as_u64[0];
418 kv.key[1] = masked_dst_address.
as_u64[1];
419 kv.key[2] = ((
u64)((fib - im->
fibs))<<32) | dst_address_length;
425 dst_adj_index = value.value;
433 vnm->
api_errno = VNET_API_ERROR_UNKNOWN_DESTINATION;
446 && dst_address_length == 128
449 vnm->
api_errno = VNET_API_ERROR_PREFIX_MATCHES_NEXT_HOP;
458 if (dst_adj_index == ~0 && next_hop_weight == 1 && next_hop_sw_if_index == ~0)
478 old_mp_adj_index = dst_adj ? dst_adj->
heap_handle : ~0;
487 vnm->
api_errno = VNET_API_ERROR_NEXT_HOP_NOT_FOUND_MP;
489 (0,
"requested deleting next-hop %U not found in multi-path",
495 if (old_mp_adj_index != ~0)
497 if (new_mp_adj_index != ~0)
500 if (old_mp != new_mp)
524 u32 table_index_or_table_id,
531 BVT(clib_bihash_kv) kv, value;
534 clib_memcpy (&masked_address, address,
sizeof (masked_address));
537 kv.key[0] = masked_address.
as_u64[0];
538 kv.key[1] = masked_address.
as_u64[1];
539 kv.key[2] = ((
u64)((fib - im->
fibs))<<32) | address_length;
542 return (value.value);
548 u32 table_index_or_table_id,
553 u8 ** result_lengths)
557 BVT(clib_bihash) * h = &im->ip6_lookup_table;
558 BVT(clib_bihash_value) * v;
563 _vec_len (*results) = 0;
565 _vec_len (*result_lengths) = 0;
568 for (i = 0; i < h->nbuckets; i++)
579 if (
BV(clib_bihash_is_free)(&v->kvp[k]))
582 if ((v->kvp[k].key[2]
583 == (((
u64)((fib - im->
fibs))<<32) | address_length))
593 vec_add1 (*result_lengths, address_length);
602 u32 table_index_or_table_id,
614 clib_warning (
"unimplemented, please report to vpp-dev@cisco.com");
621 u32 table_index_or_table_id,
628 static u8 * matching_address_lengths;
640 for (l = address_length + 1; l <= 128; l++)
646 &matching_address_lengths);
647 for (i = 0; i <
vec_len (matching_addresses); i++)
673 u32 n_left_from, n_left_to_next, * from, * to_next;
681 while (n_left_from > 0)
684 to_next, n_left_to_next);
686 while (n_left_from >= 4 && n_left_to_next >= 2)
689 u32 pi0, pi1, adj_index0, adj_index1, wrong_next;
694 u32 fib_index0, fib_index1;
695 u32 flow_hash_config0, flow_hash_config1;
710 pi0 = to_next[0] = from[0];
711 pi1 = to_next[1] = from[1];
724 dst_addr0 = &iadj0->
indirect.next_hop.ip6;
725 dst_addr1 = &iadj1->
indirect.next_hop.ip6;
764 next0 = (ip0->
protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) ?
766 next1 = (ip1->
protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) ?
800 (cm, cpu_index, adj_index0, 1,
803 (cm, cpu_index, adj_index1, 1,
811 wrong_next = (next0 != next) + 2*(next1 != next);
848 while (n_left_from > 0 && n_left_to_next > 0)
856 u32 fib_index0, flow_hash_config0;
869 dst_addr0 = &iadj0->
indirect.next_hop.ip6;
895 next0 = (ip0->
protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) ?
915 (cm, cpu_index, adj_index0, 1,
929 to_next, n_left_to_next);
948 u32 if_address_index)
960 adj->
arp.next_hop.ip6.as_u64[0] = 0;
961 adj->
arp.next_hop.ip6.as_u64[1] = 0;
974 VNET_L3_PACKET_TYPE_IP6,
978 &adj->rewrite_header,
979 sizeof (adj->rewrite_data));
992 u32 classify_table_index;
1019 classify_table_index = ~0;
1022 if (classify_table_index != (
u32) ~0)
1025 adj->
classify.table_index = classify_table_index;
1031 adj->rewrite_header.sw_if_index = sw_if_index;
1033 adj->rewrite_header.data_bytes = 0;
1056 if (address_length < 128)
1059 if (address_length != 64 ||
1060 address[0].as_u64[0] != clib_net_to_host_u64(0xfe80000000000000ULL))
1102 u32 if_address_index;
1103 ip6_address_fib_t ip6_af, * addr_fib = 0;
1136 im, ip6_af.fib_index,
1144 address, address_length,
1160 (vm, sw_if_index, address, address_length,
1174 u32 is_admin_up, fib_index;
1188 a = ip_interface_address_get_address (&im->lookup_main, ia);
1190 ip6_add_interface_routes (vnm, sw_if_index,
1194 ip6_del_interface_routes (im, fib_index,
1195 a, ia->address_length);
1221 char * start_nodes[] = {
"ip6-input", };
1222 char * feature_nodes[] = {
1231 feature_nodes,
ARRAY_LEN (feature_nodes));
1269 .name =
"ip6-lookup",
1270 .vector_size =
sizeof (
u32),
1289 .name =
"ip6-indirect",
1290 .vector_size =
sizeof (
u32),
1330 s =
format (s,
"fib %d adj-idx %d : %U flow hash: 0x%08x",
1349 s =
format (s,
"tx_sw_if_index %d adj-idx %d : %U flow hash: 0x%08x",
1494 .vector_size =
sizeof (
u32),
1507 .vector_size =
sizeof (
u32),
1520 .vector_size =
sizeof (
u32),
1532 .name =
"ip6-multicast",
1533 .vector_size =
sizeof (
u32),
1547 u16 sum16, payload_length_host_byte_order;
1548 u32 i, n_this_buffer, n_bytes_left;
1549 u32 headers_size =
sizeof(ip0[0]);
1550 void * data_this_buffer;
1557 payload_length_host_byte_order = clib_net_to_host_u16 (ip0->
payload_length);
1558 data_this_buffer = (
void *) (ip0 + 1);
1572 ip6_hop_by_hop_ext_t *ext_hdr = (ip6_hop_by_hop_ext_t *)data_this_buffer;
1575 ASSERT(ext_hdr->next_hdr == IP_PROTOCOL_ICMP6);
1577 skip_bytes = 8* (1 + ext_hdr->n_data_u64s);
1578 data_this_buffer = (
void *)((
u8 *)data_this_buffer + skip_bytes);
1580 payload_length_host_byte_order -= skip_bytes;
1581 headers_size += skip_bytes;
1584 n_bytes_left = n_this_buffer = payload_length_host_byte_order;
1588 struct rte_mbuf *mb = rte_mbuf_from_vlib_buffer(p0);
1589 u8 nb_segs = mb->nb_segs;
1593 while (n_bytes_left)
1596 n_bytes_left -= n_this_buffer;
1600 if ((nb_segs == 0) || (mb == 0))
1603 data_this_buffer = rte_ctrlmbuf_data(mb);
1604 n_this_buffer = mb->data_len;
1606 if (n_bytes_left || nb_segs)
1619 n_bytes_left -= n_this_buffer;
1620 if (n_bytes_left == 0)
1648 || ip0->
protocol == IP_PROTOCOL_ICMP6
1649 || ip0->
protocol == IP_PROTOCOL_UDP
1650 || ip0->
protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS);
1652 udp0 = (
void *) (ip0 + 1);
1676 u32 * from, * to_next, n_left_from, n_left_to_next;
1686 while (n_left_from > 0)
1689 to_next, n_left_to_next);
1691 while (n_left_from >= 4 && n_left_to_next >= 2)
1696 u32 pi0, ip_len0, udp_len0, flags0, next0;
1697 u32 pi1, ip_len1, udp_len1, flags1, next1;
1698 i32 len_diff0, len_diff1;
1699 u8 error0, type0, good_l4_checksum0;
1700 u8 error1, type1, good_l4_checksum1;
1702 pi0 = to_next[0] = from[0];
1703 pi1 = to_next[1] = from[1];
1707 n_left_to_next -= 2;
1740 udp_len0 = clib_net_to_host_u16 (udp0->
length);
1741 udp_len1 = clib_net_to_host_u16 (udp1->
length);
1743 len_diff0 = ip_len0 - udp_len0;
1744 len_diff1 = ip_len1 - udp_len1;
1750 && ! good_l4_checksum0
1758 && ! good_l4_checksum1
1759 && ! (flags1 & IP_BUFFER_L4_CHECKSUM_COMPUTED)))
1766 error0 = error1 = IP6_ERROR_UNKNOWN_PROTOCOL;
1768 error0 = len_diff0 < 0 ? IP6_ERROR_UDP_LENGTH : error0;
1769 error1 = len_diff1 < 0 ? IP6_ERROR_UDP_LENGTH : error1;
1773 error0 = (! good_l4_checksum0
1774 ? IP6_ERROR_UDP_CHECKSUM + type0
1776 error1 = (! good_l4_checksum1
1777 ? IP6_ERROR_UDP_CHECKSUM + type1
1786 ? IP6_ERROR_SRC_LOOKUP_MISS
1793 ? IP6_ERROR_SRC_LOOKUP_MISS
1804 to_next, n_left_to_next,
1805 pi0, pi1, next0, next1);
1808 while (n_left_from > 0 && n_left_to_next > 0)
1813 u32 pi0, ip_len0, udp_len0, flags0, next0;
1815 u8 error0, type0, good_l4_checksum0;
1817 pi0 = to_next[0] = from[0];
1821 n_left_to_next -= 1;
1843 udp_len0 = clib_net_to_host_u16 (udp0->
length);
1845 len_diff0 = ip_len0 - udp_len0;
1850 && ! good_l4_checksum0
1858 error0 = IP6_ERROR_UNKNOWN_PROTOCOL;
1860 error0 = len_diff0 < 0 ? IP6_ERROR_UDP_LENGTH : error0;
1864 error0 = (! good_l4_checksum0
1865 ? IP6_ERROR_UDP_CHECKSUM + type0
1873 ? IP6_ERROR_SRC_LOOKUP_MISS
1882 to_next, n_left_to_next,
1894 .name =
"ip6-local",
1895 .vector_size =
sizeof (
u32),
1937 u32 * from, * to_next_drop;
1938 uword n_left_from, n_left_to_next_drop;
1939 static f64 time_last_seed_change = -1e100;
1940 static u32 hash_seeds[3];
1949 if (time_now - time_last_seed_change > 1e-3)
1953 sizeof (hash_seeds));
1954 for (i = 0; i <
ARRAY_LEN (hash_seeds); i++)
1955 hash_seeds[i] = r[i];
1958 for (i = 0; i <
ARRAY_LEN (hash_bitmap); i++)
1961 time_last_seed_change = time_now;
1967 while (n_left_from > 0)
1970 to_next_drop, n_left_to_next_drop);
1972 while (n_left_from > 0 && n_left_to_next_drop > 0)
1976 u32 pi0, adj_index0, a0, b0, c0, m0, sw_if_index0, drop0;
1992 if (adj0->
arp.next_hop.ip6.as_u64[0] ||
1993 adj0->
arp.next_hop.ip6.as_u64[1]) {
2002 sw_if_index0 = adj0->rewrite_header.sw_if_index;
2016 c0 &=
BITS (hash_bitmap) - 1;
2020 bm0 = hash_bitmap[c0];
2021 drop0 = (bm0 & m0) != 0;
2024 hash_bitmap[c0] = bm0 | m0;
2028 to_next_drop[0] = pi0;
2030 n_left_to_next_drop -= 1;
2046 icmp6_neighbor_solicitation_header_t * h0;
2071 clib_memcpy (h0->link_layer_option.ethernet_address,
2075 h0->neighbor.icmp.checksum = 0;
2076 h0->neighbor.icmp.checksum =
2080 ASSERT (bogus_length == 0);
2099 n_left_to_next_drop);
2108 =
"neighbor solicitations sent",
2113 .name =
"ip6-discover-neighbor",
2114 .vector_size =
sizeof (
u32),
2133 icmp6_neighbor_solicitation_header_t * h;
2156 vnm->
api_errno = VNET_API_ERROR_NO_MATCHING_INTERFACE;
2158 (0,
"no matching interface address for destination %U (interface %U)",
2169 h->ip.dst_address.as_u8[13] = dst->
as_u8[13];
2170 h->ip.dst_address.as_u8[14] = dst->
as_u8[14];
2171 h->ip.dst_address.as_u8[15] = dst->
as_u8[15];
2173 h->ip.src_address = src[0];
2174 h->neighbor.target_address = dst[0];
2178 h->neighbor.icmp.checksum =
2180 ASSERT(bogus_length == 0);
2209 int rewrite_for_locally_received_packets)
2213 u32 n_left_from, n_left_to_next, * to_next, next_index;
2221 while (n_left_from > 0)
2225 while (n_left_from >= 4 && n_left_to_next >= 2)
2230 u32 pi0, rw_len0, next0, error0, adj_index0;
2231 u32 pi1, rw_len1, next1, error1, adj_index1;
2250 pi0 = to_next[0] = from[0];
2251 pi1 = to_next[1] = from[1];
2256 n_left_to_next -= 2;
2261 adj_index0 =
vnet_buffer (p0)->ip.adj_index[adj_rx_tx];
2262 adj_index1 =
vnet_buffer (p1)->ip.adj_index[adj_rx_tx];
2265 ASSERT(adj_index0 && adj_index1);
2270 error0 = error1 = IP6_ERROR_NONE;
2272 if (! rewrite_for_locally_received_packets)
2286 error0 = hop_limit0 <= 0 ? IP6_ERROR_TIME_EXPIRED : error0;
2287 error1 = hop_limit1 <= 0 ? IP6_ERROR_TIME_EXPIRED : error1;
2293 if (rewrite_for_locally_received_packets)
2301 error0 = IP6_ERROR_SPOOFED_LOCAL_PACKETS;
2304 error1 = IP6_ERROR_SPOOFED_LOCAL_PACKETS;
2307 rw_len0 = adj0[0].rewrite_header.data_bytes;
2308 rw_len1 = adj1[0].rewrite_header.data_bytes;
2323 ? IP6_ERROR_MTU_EXCEEDED
2326 ? IP6_ERROR_MTU_EXCEEDED
2338 next0 = (error0 == IP6_ERROR_NONE) ?
2340 next1 = (error1 == IP6_ERROR_NONE) ?
2349 to_next, n_left_to_next,
2350 pi0, pi1, next0, next1);
2353 while (n_left_from > 0 && n_left_to_next > 0)
2359 u32 adj_index0, next0, error0;
2361 pi0 = to_next[0] = from[0];
2365 adj_index0 =
vnet_buffer (p0)->ip.adj_index[adj_rx_tx];
2374 error0 = IP6_ERROR_NONE;
2377 if (! rewrite_for_locally_received_packets)
2387 error0 = hop_limit0 <= 0 ? IP6_ERROR_TIME_EXPIRED : error0;
2390 if (rewrite_for_locally_received_packets)
2394 error0 = IP6_ERROR_SPOOFED_LOCAL_PACKETS;
2401 rw_len0 = adj0[0].rewrite_header.data_bytes;
2411 ? IP6_ERROR_MTU_EXCEEDED
2418 next0 = (error0 == IP6_ERROR_NONE) ?
2426 n_left_to_next -= 1;
2429 to_next, n_left_to_next,
2463 .name =
"ip6-rewrite",
2464 .vector_size =
sizeof (
u32),
2476 .name =
"ip6-rewrite-local",
2477 .vector_size =
sizeof (
u32),
2479 .sibling_of =
"ip6-rewrite",
2505 for (j = 0; j < i0; j++)
2536 icmp6_neighbor_solicitation_header_t p;
2538 memset (&p, 0,
sizeof (p));
2540 p.ip.ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28);
2541 p.ip.payload_length = clib_host_to_net_u16 (
sizeof (p)
2543 p.ip.protocol = IP_PROTOCOL_ICMP6;
2544 p.ip.hop_limit = 255;
2547 p.neighbor.icmp.type = ICMP6_neighbor_solicitation;
2549 p.link_layer_option.header.type = ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address;
2550 p.link_layer_option.header.n_data_u64s =
sizeof (p.link_layer_option) /
sizeof (
u64);
2556 "ip6 neighbor discovery");
2571 u32 sw_if_index, table_id;
2582 if (
unformat (input,
"%d", &table_id))
2608 .path =
"set interface ip6 table",
2610 .short_help =
"set interface ip6 table <intfc> <table-id>" 2617 ip->
as_u64[0] = clib_host_to_net_u64 (0xFE80000000000000ULL);
2619 ip->
as_u8 [8] = mac[0] ^ (1<<1);
2620 ip->
as_u8 [9] = mac[1];
2621 ip->
as_u8 [10] = mac[2];
2622 ip->
as_u8 [11] = 0xFF;
2623 ip->
as_u8 [12] = 0xFE;
2624 ip->
as_u8 [13] = mac[3];
2625 ip->
as_u8 [14] = mac[4];
2626 ip->
as_u8 [15] = mac[5];
2634 mac[0] = ip->
as_u8 [8] ^ (1<<1);
2635 mac[1] = ip->
as_u8 [9];
2636 mac[2] = ip->
as_u8 [10];
2637 mac[3] = ip->
as_u8 [13];
2638 mac[4] = ip->
as_u8 [14];
2639 mac[5] = ip->
as_u8 [15];
2664 .path =
"test ip6 link",
2666 .short_help =
"test ip6 link <mac-address>",
2691 u32 flow_hash_config = 0;
2695 if (
unformat (input,
"table %d", &table_id))
2698 else if (unformat (input, #a)) { flow_hash_config |= v; matched=1;} 2718 clib_warning (
"BUG: illegal flow hash config 0x%x", flow_hash_config);
2726 .path =
"set ip6 flow-hash",
2728 "set ip table flow-hash table <fib-id> src dst sport dport proto reverse",
2753 .path =
"show ip6 local",
2755 .short_help =
"Show ip6 local protocol table",
2768 return VNET_API_ERROR_NO_MATCHING_INTERFACE;
2771 return VNET_API_ERROR_NO_SUCH_ENTRY;
2784 u32 table_index = ~0;
2785 int table_index_set = 0;
2786 u32 sw_if_index = ~0;
2790 if (
unformat (input,
"table-index %d", &table_index))
2791 table_index_set = 1;
2799 if (table_index_set == 0)
2802 if (sw_if_index == ~0)
2812 case VNET_API_ERROR_NO_MATCHING_INTERFACE:
2815 case VNET_API_ERROR_NO_SUCH_ENTRY:
2822 .path =
"set ip6 classify",
2824 "set ip6 classify intfc <int> table-index <index>",
2837 if (
unformat (input,
"hash-buckets %d", &tmp))
2839 else if (
unformat (input,
"heap-size %dm", &tmp))
2840 heapsize = ((
u64)tmp) << 20;
2841 else if (
unformat (input,
"heap-size %dM", &tmp))
2842 heapsize = ((
u64)tmp) << 20;
2843 else if (
unformat (input,
"heap-size %dg", &tmp))
2844 heapsize = ((
u64)tmp) << 30;
2845 else if (
unformat (input,
"heap-size %dG", &tmp))
2846 heapsize = ((
u64)tmp) << 30;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
always_inline void * clib_random_buffer_get_data(clib_random_buffer_t *b, uword n_bytes)
#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)
static u8 * format_ip6_lookup_trace(u8 *s, va_list *args)
u32 * config_index_by_sw_if_index
static void compute_prefix_lengths_in_search_order(ip6_main_t *im)
#define IP6_LOOKUP_NEXT_NODES
void vnet_config_init(vlib_main_t *vm, vnet_config_main_t *cm, char *start_node_names[], int n_start_node_names, char *feature_node_names[], int n_feature_node_names)
static uword ip6_indirect(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
always_inline pg_node_t * pg_get_node(uword node_index)
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
static void(BVT(clib_bihash)*h, BVT(clib_bihash_value)*v)
ip_interface_address_t * if_address_pool
static clib_error_t * add_del_ip6_interface_table(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * set_ip6_classify_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vnet_interface_main_t interface_main
vlib_node_registration_t ip6_rewrite_local_node
(constructor) VLIB_REGISTER_NODE (ip6_rewrite_local_node)
ip_lookup_next_t lookup_next_index
always_inline void ip6_set_reserved_multicast_address(ip6_address_t *a, ip6_multicast_address_scope_t scope, u16 id)
static uword ip6_rewrite_local(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
i32 dst_address_length_refcounts[129]
vlib_node_registration_t ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (ip6_lookup_node)
static u8 * format_ip6_rewrite_trace(u8 *s, va_list *args)
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)
ip_config_main_t rx_config_mains[VNET_N_CAST]
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
ip_adjacency_t * ip_add_adjacency(ip_lookup_main_t *lm, ip_adjacency_t *copy_adj, u32 n_adj, u32 *adj_index_return)
static uword ip6_miss(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#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 * ip6_config(vlib_main_t *vm, unformat_input_t *input)
always_inline uword max_log2(uword x)
#define STRUCT_OFFSET_OF(t, f)
always_inline void * ip6_next_header(ip6_header_t *i)
static clib_error_t * test_ip6_link_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_node_registration_t ip6_multicast_node
(constructor) VLIB_REGISTER_NODE (ip6_multicast_node)
unformat_function_t unformat_vnet_sw_interface
#define clib_error_report(e)
static clib_error_t * ip6_add_del_interface_address_internal(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *new_address, u32 new_length, u32 redistribute, u32 insert_routes, u32 is_del)
#define VNET_HW_INTERFACE_FLAG_LINK_UP
void ip6_add_del_route(ip6_main_t *im, ip6_add_del_route_args_t *a)
u32 ip6_fib_lookup_with_table(ip6_main_t *im, u32 fib_index, ip6_address_t *dst)
int BV() clib_bihash_add_del(BVT(clib_bihash)*h, BVT(clib_bihash_kv)*add_v, int is_add)
always_inline u32 ip6_compute_flow_hash(ip6_header_t *ip, u32 flow_hash_config)
u32 neighbor_probe_adj_index
always_inline uword ip6_rewrite_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int rewrite_for_locally_received_packets)
#define hash_v3_mix32(a, b, c)
format_function_t format_vnet_sw_if_index_name
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
always_inline vlib_main_t * vlib_get_main(void)
uword as_uword[16/sizeof(uword)]
u32 * node_index_by_feature_index
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(ip6_sw_interface_add_del)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
always_inline void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
vlib_node_registration_t ip6_drop_node
(constructor) VLIB_REGISTER_NODE (ip6_drop_node)
ip6_discover_neighbor_error_t
static uword ip6_drop(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_packet_template_t discover_neighbor_packet_template
u32 ip6_tcp_udp_icmp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
always_inline uword ip6_address_is_zero(ip6_address_t *a)
vnet_main_t * vnet_get_main(void)
vlib_node_registration_t ip6_indirect_node
(constructor) VLIB_REGISTER_NODE (ip6_indirect_node)
clib_error_t * ip6_sw_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
u8 * format_ethernet_address(u8 *s, va_list *args)
#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...
static clib_error_t * show_ip6_local_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip_csum_t ip_incremental_checksum(ip_csum_t sum, void *_data, uword n_bytes)
#define VLIB_INIT_FUNCTION(x)
static clib_error_t * set_ip6_flow_hash_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define IP_BUFFER_L4_CHECKSUM_CORRECT
always_inline void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define IP6_FIB_DEFAULT_HASH_NUM_BUCKETS
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)
always_inline uword pool_elts(void *v)
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
always_inline uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
void BV() clib_bihash_init(BVT(clib_bihash)*h, char *name, u32 nbuckets, uword memory_size)
#define clib_warning(format, args...)
u32 table_index_or_table_id
always_inline void ip6_src_address_for_packet(ip6_main_t *im, vlib_buffer_t *p, ip6_address_t *src, u32 sw_if_index)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
void ip_del_adjacency(ip_lookup_main_t *lm, u32 adj_index)
#define VLIB_BUFFER_NEXT_PRESENT
u32 lookup_table_nbuckets
int BV() clib_bihash_search(BVT(clib_bihash)*h, BVT(clib_bihash_kv)*search_key, BVT(clib_bihash_kv)*valuep)
always_inline void vlib_buffer_copy_trace_flag(vlib_main_t *vm, vlib_buffer_t *b, u32 bi_target)
u8 packet_data[128-1 *sizeof(u32)]
always_inline u16 ip_csum_fold(ip_csum_t c)
vnet_api_error_t api_errno
ip6_fib_t * find_ip6_fib_by_table_index_or_id(ip6_main_t *im, u32 table_index_or_id, u32 flags)
Get or create an IPv6 fib.
ip6_address_t dst_address
#define clib_bitmap_foreach(i, ai, body)
#define pool_elt_at_index(p, i)
u16 current_length
Nbytes between current data and the end of this buffer.
u32 ip6_fib_lookup(ip6_main_t *im, u32 sw_if_index, ip6_address_t *dst)
u32 * classify_table_index_by_sw_if_index
static void ip6_del_interface_routes(ip6_main_t *im, u32 fib_index, ip6_address_t *address, u32 address_length)
vlib_node_registration_t ip6_input_node
(constructor) VLIB_REGISTER_NODE (ip6_input_node)
#define BIHASH_KVP_PER_PAGE
#define IP6_FIB_DEFAULT_HASH_MEMORY_SIZE
uword os_get_cpu_number(void)
vlib_node_registration_t ip6_punt_node
(constructor) VLIB_REGISTER_NODE (ip6_punt_node)
int vnet_set_ip6_flow_hash(u32 table_id, u32 flow_hash_config)
u8 local_next_by_ip_protocol[256]
vnet_hw_interface_class_t srp_hw_interface_class
always_inline uword * clib_bitmap_set(uword *ai, uword i, uword value)
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)
static uword ip6_rewrite_transit(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
ip6_add_del_interface_address_callback_t * add_del_interface_address_callbacks
void ip6_forward_next_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vlib_rx_or_tx_t which_adj_index)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
vnet_hw_interface_class_t ethernet_hw_interface_class
u32 ip6_get_route(ip6_main_t *im, u32 table_index_or_table_id, u32 flags, ip6_address_t *address, u32 address_length)
uword * fib_index_by_table_id
void vnet_ip6_fib_init(ip6_main_t *im, u32 fib_index)
static uword ip6_local(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
ip6_address_t fib_masks[129]
#define VLIB_EARLY_CONFIG_FUNCTION(x, n,...)
always_inline uword ip6_address_is_equal(ip6_address_t *a, ip6_address_t *b)
#define IP6_ROUTE_FLAG_KEEP_OLD_ADJACENCY
#define CLIB_PREFETCH(addr, size, type)
uword * non_empty_dst_address_length_bitmap
static ip6_fib_t * create_fib_with_table_id(ip6_main_t *im, u32 table_id)
void ip6_maybe_remap_adjacencies(ip6_main_t *im, u32 table_index_or_table_id, u32 flags)
#define vec_free(V)
Free vector's memory (no header).
vlib_node_registration_t ip6_local_node
(constructor) VLIB_REGISTER_NODE (ip6_local_node)
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)
clib_error_t * ip6_sw_interface_admin_up_down(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
static u8 * format_ip6_forward_next_trace(u8 *s, va_list *args)
vlib_node_registration_t ip6_miss_node
(constructor) VLIB_REGISTER_NODE (ip6_miss_node)
clib_error_t * ip6_probe_neighbor(vlib_main_t *vm, ip6_address_t *dst, u32 sw_if_index)
#define clib_memcpy(a, b, c)
always_inline vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
static uword ip6_drop_or_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, ip6_error_t error_code)
unformat_function_t * unformat_edit
#define IP6_ROUTE_FLAG_DEL
always_inline uword ip6_lookup_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_indirect)
void ip_lookup_init(ip_lookup_main_t *lm, u32 is_ip6)
#define pool_is_free_index(P, I)
void ip6_adjacency_set_interface_route(vnet_main_t *vnm, ip_adjacency_t *adj, u32 sw_if_index, u32 if_address_index)
void ip6_ethernet_mac_address_from_link_local_address(u8 *mac, ip6_address_t *ip)
always_inline uword vnet_sw_interface_is_admin_up(vnet_main_t *vnm, u32 sw_if_index)
void ip6_delete_matching_routes(ip6_main_t *im, u32 table_index_or_table_id, u32 flags, ip6_address_t *address, u32 address_length)
always_inline void ip6_set_solicited_node_multicast_address(ip6_address_t *a, u32 id)
vlib_combined_counter_main_t adjacency_counters
u8 builtin_protocol_by_ip_protocol[256]
#define VLIB_CLI_COMMAND(x,...)
struct _vnet_classify_main vnet_classify_main_t
#define foreach_flow_hash_bit
u32 * if_address_pool_index_by_sw_if_index
ip6_add_del_interface_address_function_t * function
always_inline uword is_pow2(uword x)
void ip6_register_protocol(u32 protocol, u32 node_index)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
u32 max_l3_packet_bytes[VLIB_N_RX_TX]
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
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,...)
vlib_node_registration_t ip6_discover_neighbor_node
(constructor) VLIB_REGISTER_NODE (ip6_discover_neighbor_node)
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(ip6_sw_interface_admin_up_down)
ip_lookup_main_t lookup_main
#define LOG2_IP_BUFFER_L4_CHECKSUM_CORRECT
#define IP6_ROUTE_FLAG_NOT_LAST_IN_GROUP
#define hash_v3_finalize32(a, b, c)
static uword ip6_discover_neighbor(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 next_buffer
Next buffer for this linked-list of buffers.
u8 * prefix_lengths_in_search_order
#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
int vnet_set_ip6_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
#define IP_FLOW_HASH_DEFAULT
static char * ip6_discover_neighbor_error_strings[]
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define VLIB_BUFFER_IS_TRACED
static int BV() clib_bihash_search_inline_2(BVT(clib_bihash)*h, BVT(clib_bihash_kv)*search_key, BVT(clib_bihash_kv)*valuep)
#define IP6_ROUTE_FLAG_FIB_INDEX
vlib_node_registration_t ip6_rewrite_node
(constructor) VLIB_REGISTER_NODE (ip6_rewrite_node)
always_inline ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
always_inline ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
#define vec_elt(v, i)
Get vector value at index i.
#define IP_BUFFER_L4_CHECKSUM_COMPUTED
void ip6_foreach_matching_route(ip6_main_t *im, u32 table_index_or_table_id, u32 flags, ip6_address_t *dst_address, u32 address_length, ip6_address_t **results, u8 **result_lengths)
struct ip_adjacency_t::@112::@114 arp
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void *BV() clib_bihash_get_value(BVT(clib_bihash)*h, uword offset)
always_inline void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
always_inline vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
void ip6_link_local_address_from_ethernet_mac_address(ip6_address_t *ip, u8 *mac)
vnet_sw_interface_t * sw_interfaces
struct ip_adjacency_t::@112::@115 classify
always_inline void vlib_set_next_frame_buffer(vlib_main_t *vm, vlib_node_runtime_t *node, u32 next_index, u32 buffer_index)
static void ip6_add_interface_routes(vnet_main_t *vnm, u32 sw_if_index, ip6_main_t *im, u32 fib_index, ip_interface_address_t *a)
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)
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define clib_mem_unaligned(pointer, type)
struct ip_adjacency_t::@112::@116 indirect
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
uword * interface_route_adj_index_by_sw_if_index
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
ip_multipath_adjacency_t * multipath_adjacencies
#define VLIB_REGISTER_NODE(x,...)
always_inline vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
always_inline u32 ip6_src_lookup_for_packet(ip6_main_t *im, vlib_buffer_t *b, ip6_header_t *i)
u32 vnet_ip6_neighbor_glean_add(u32 fib_index, void *next_hop_arg)
always_inline void ip_call_add_del_adjacency_callbacks(ip_lookup_main_t *lm, u32 adj_index, u32 is_del)
#define IP6_ROUTE_FLAG_ADD
#define vec_foreach(var, vec)
Vector iterator.
always_inline void ip6_addr_fib_init(ip6_address_fib_t *addr_fib, ip6_address_t *address, u32 fib_index)
#define IP6_ROUTE_FLAG_NO_REDISTRIBUTE
void ip6_add_del_route_next_hop(ip6_main_t *im, u32 flags, ip6_address_t *dst_address, u32 dst_address_length, ip6_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_weight, u32 adj_index, u32 explicit_fib_index)
always_inline f64 vlib_time_now(vlib_main_t *vm)
always_inline void ip6_address_mask(ip6_address_t *a, ip6_address_t *mask)
#define clib_error_return(e, args...)
#define IP6_ROUTE_FLAG_TABLE_ID
always_inline uword pow2_mask(uword x)
clib_error_t * ip6_add_del_interface_address(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *address, u32 address_length, u32 is_del)
always_inline void vlib_smp_unsafe_warning(void)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static clib_error_t * ip6_lookup_init(vlib_main_t *vm)
#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)
static uword ip6_lookup(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vnet_rewrite_two_headers(rw0, rw1, p0, p1, most_likely_size)
always_inline uword ip6_destination_matches_route(ip6_main_t *im, ip6_address_t *key, ip6_address_t *dest, uword dest_length)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
ip6_discover_neighbor_next_t
always_inline ip6_address_t * ip6_interface_address_matching_destination(ip6_main_t *im, ip6_address_t *dst, u32 sw_if_index, ip_interface_address_t **result_ia)
u32 * fib_index_by_sw_if_index
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
clib_random_buffer_t random_buffer
vnet_config_main_t config_main
static uword ip6_punt(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)