Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /*--------------------------------------------------------------------------- |
| 2 | * Copyright (c) 2009-2014 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | *--------------------------------------------------------------------------- |
| 15 | */ |
| 16 | /* |
| 17 | * IPv4 Fragmentation Node |
| 18 | * |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include "ip_frag.h" |
| 23 | |
| 24 | #include <vnet/ip/ip.h> |
| 25 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 26 | typedef struct |
| 27 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 28 | u16 mtu; |
| 29 | u8 next; |
| 30 | u16 n_fragments; |
Neale Ranns | ec5371e | 2022-03-04 11:45:41 +0000 | [diff] [blame] | 31 | u16 pkt_size; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 32 | } ip_frag_trace_t; |
| 33 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 34 | static u8 * |
| 35 | format_ip_frag_trace (u8 * s, va_list * args) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 36 | { |
| 37 | CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); |
| 38 | CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 39 | ip_frag_trace_t *t = va_arg (*args, ip_frag_trace_t *); |
Neale Ranns | ec5371e | 2022-03-04 11:45:41 +0000 | [diff] [blame] | 40 | s = format (s, "mtu: %u pkt-size: %u fragments: %u next: %d", t->mtu, |
| 41 | t->pkt_size, t->n_fragments, t->next); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 42 | return s; |
| 43 | } |
| 44 | |
| 45 | static u32 running_fragment_id; |
| 46 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 47 | static void |
| 48 | frag_set_sw_if_index (vlib_buffer_t * to, vlib_buffer_t * from) |
| 49 | { |
| 50 | vnet_buffer (to)->sw_if_index[VLIB_RX] = |
| 51 | vnet_buffer (from)->sw_if_index[VLIB_RX]; |
| 52 | vnet_buffer (to)->sw_if_index[VLIB_TX] = |
| 53 | vnet_buffer (from)->sw_if_index[VLIB_TX]; |
| 54 | |
| 55 | /* Copy adj_index in case DPO based node is sending for the |
| 56 | * fragmentation, the packet would be sent back to the proper |
| 57 | * DPO next node and Index |
| 58 | */ |
| 59 | vnet_buffer (to)->ip.adj_index[VLIB_RX] = |
| 60 | vnet_buffer (from)->ip.adj_index[VLIB_RX]; |
| 61 | vnet_buffer (to)->ip.adj_index[VLIB_TX] = |
| 62 | vnet_buffer (from)->ip.adj_index[VLIB_TX]; |
Vijayabhaskar Katamreddy | 64fb995 | 2018-11-28 12:05:23 -0800 | [diff] [blame] | 63 | |
| 64 | /* Copy QoS Bits */ |
| 65 | if (PREDICT_TRUE (from->flags & VNET_BUFFER_F_QOS_DATA_VALID)) |
| 66 | { |
| 67 | vnet_buffer2 (to)->qos = vnet_buffer2 (from)->qos; |
| 68 | to->flags |= VNET_BUFFER_F_QOS_DATA_VALID; |
| 69 | } |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | static vlib_buffer_t * |
| 73 | frag_buffer_alloc (vlib_buffer_t * org_b, u32 * bi) |
| 74 | { |
| 75 | vlib_main_t *vm = vlib_get_main (); |
| 76 | if (vlib_buffer_alloc (vm, bi, 1) != 1) |
| 77 | return 0; |
| 78 | |
| 79 | vlib_buffer_t *b = vlib_get_buffer (vm, *bi); |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 80 | vlib_buffer_copy_trace_flag (vm, org_b, *bi); |
| 81 | |
| 82 | return b; |
| 83 | } |
| 84 | |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 85 | /* |
| 86 | * Limitation: Does follow buffer chains in the packet to fragment, |
| 87 | * but does not generate buffer chains. I.e. a fragment is always |
| 88 | * contained with in a single buffer and limited to the max buffer |
| 89 | * size. |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 90 | * from_bi: current pointer must point to IPv4 header |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 91 | */ |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 92 | ip_frag_error_t |
| 93 | ip4_frag_do_fragment (vlib_main_t * vm, u32 from_bi, u16 mtu, |
| 94 | u16 l2unfragmentablesize, u32 ** buffer) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 95 | { |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 96 | vlib_buffer_t *from_b; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 97 | ip4_header_t *ip4; |
Neale Ranns | 346c247 | 2022-03-08 13:24:28 +0000 | [diff] [blame] | 98 | u16 len, max, rem, ip_frag_id, ip_frag_offset, head_bytes; |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 99 | u8 *org_from_packet, more; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 100 | |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 101 | from_b = vlib_get_buffer (vm, from_bi); |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 102 | org_from_packet = vlib_buffer_get_current (from_b); |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 103 | ip4 = vlib_buffer_get_current (from_b) + l2unfragmentablesize; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 104 | |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 105 | rem = clib_net_to_host_u16 (ip4->length) - sizeof (ip4_header_t); |
Neale Ranns | 346c247 | 2022-03-08 13:24:28 +0000 | [diff] [blame] | 106 | head_bytes = sizeof (ip4_header_t) + l2unfragmentablesize; |
| 107 | max = (clib_min (mtu, vlib_buffer_get_default_data_size (vm)) - head_bytes) & |
| 108 | ~0x7; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 109 | |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 110 | if (rem > |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 111 | (vlib_buffer_length_in_chain (vm, from_b) - sizeof (ip4_header_t))) |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 112 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 113 | return IP_FRAG_ERROR_MALFORMED; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 114 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 115 | |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 116 | if (mtu < sizeof (ip4_header_t)) |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 117 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 118 | return IP_FRAG_ERROR_CANT_FRAGMENT_HEADER; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 119 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 120 | |
| 121 | if (ip4->flags_and_fragment_offset & |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 122 | clib_host_to_net_u16 (IP4_HEADER_FLAG_DONT_FRAGMENT)) |
| 123 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 124 | return IP_FRAG_ERROR_DONT_FRAGMENT_SET; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 125 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 126 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 127 | if (ip4_is_fragment (ip4)) |
| 128 | { |
| 129 | ip_frag_id = ip4->fragment_id; |
| 130 | ip_frag_offset = ip4_get_fragment_offset (ip4); |
| 131 | more = |
Vijayabhaskar Katamreddy | ce07412 | 2017-11-15 13:50:26 -0800 | [diff] [blame] | 132 | !(!(ip4->flags_and_fragment_offset & |
| 133 | clib_host_to_net_u16 (IP4_HEADER_FLAG_MORE_FRAGMENTS))); |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 134 | } |
| 135 | else |
| 136 | { |
| 137 | ip_frag_id = (++running_fragment_id); |
| 138 | ip_frag_offset = 0; |
| 139 | more = 0; |
| 140 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 141 | |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 142 | u8 *from_data = (void *) (ip4 + 1); |
| 143 | vlib_buffer_t *org_from_b = from_b; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 144 | u16 fo = 0; |
Neale Ranns | 346c247 | 2022-03-08 13:24:28 +0000 | [diff] [blame] | 145 | u16 left_in_from_buffer = from_b->current_length - head_bytes; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 146 | u16 ptr = 0; |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 147 | |
| 148 | /* Do the actual fragmentation */ |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 149 | while (rem) |
| 150 | { |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 151 | u32 to_bi; |
| 152 | vlib_buffer_t *to_b; |
| 153 | ip4_header_t *to_ip4; |
| 154 | u8 *to_data; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 155 | |
Juraj Sloboda | 68b7cb8 | 2018-10-16 12:18:21 +0200 | [diff] [blame] | 156 | len = (rem > max ? max : rem); |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 157 | if (len != rem) /* Last fragment does not need to divisible by 8 */ |
| 158 | len &= ~0x7; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 159 | if ((to_b = frag_buffer_alloc (org_from_b, &to_bi)) == 0) |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 160 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 161 | return IP_FRAG_ERROR_MEMORY; |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 162 | } |
| 163 | vec_add1 (*buffer, to_bi); |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 164 | frag_set_sw_if_index (to_b, org_from_b); |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 165 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 166 | /* Copy ip4 header */ |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 167 | to_data = vlib_buffer_get_current (to_b); |
Neale Ranns | 346c247 | 2022-03-08 13:24:28 +0000 | [diff] [blame] | 168 | clib_memcpy_fast (to_data, org_from_packet, head_bytes); |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 169 | to_ip4 = (ip4_header_t *) (to_data + l2unfragmentablesize); |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 170 | to_data = (void *) (to_ip4 + 1); |
Neale Ranns | 0b6a857 | 2019-10-30 17:34:14 +0000 | [diff] [blame] | 171 | vnet_buffer (to_b)->l3_hdr_offset = to_b->current_data; |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 172 | vlib_buffer_copy_trace_flag (vm, from_b, to_bi); |
Neale Ranns | 0b6a857 | 2019-10-30 17:34:14 +0000 | [diff] [blame] | 173 | to_b->flags |= VNET_BUFFER_F_L3_HDR_OFFSET_VALID; |
| 174 | |
| 175 | if (from_b->flags & VNET_BUFFER_F_L4_HDR_OFFSET_VALID) |
| 176 | { |
| 177 | vnet_buffer (to_b)->l4_hdr_offset = |
| 178 | (vnet_buffer (to_b)->l3_hdr_offset + |
| 179 | (vnet_buffer (from_b)->l4_hdr_offset - |
| 180 | vnet_buffer (from_b)->l3_hdr_offset)); |
| 181 | to_b->flags |= VNET_BUFFER_F_L4_HDR_OFFSET_VALID; |
| 182 | } |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 183 | |
Ole Troan | 7eb9d96 | 2018-08-10 14:39:48 +0200 | [diff] [blame] | 184 | /* Spin through from buffers filling up the to buffer */ |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 185 | u16 left_in_to_buffer = len, to_ptr = 0; |
Ole Troan | 7eb9d96 | 2018-08-10 14:39:48 +0200 | [diff] [blame] | 186 | while (1) |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 187 | { |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 188 | u16 bytes_to_copy; |
| 189 | |
Ole Troan | 7eb9d96 | 2018-08-10 14:39:48 +0200 | [diff] [blame] | 190 | /* Figure out how many bytes we can safely copy */ |
| 191 | bytes_to_copy = left_in_to_buffer <= left_in_from_buffer ? |
| 192 | left_in_to_buffer : left_in_from_buffer; |
Dave Barach | 178cf49 | 2018-11-13 16:34:13 -0500 | [diff] [blame] | 193 | clib_memcpy_fast (to_data + to_ptr, from_data + ptr, bytes_to_copy); |
Ole Troan | 7eb9d96 | 2018-08-10 14:39:48 +0200 | [diff] [blame] | 194 | left_in_to_buffer -= bytes_to_copy; |
| 195 | ptr += bytes_to_copy; |
| 196 | left_in_from_buffer -= bytes_to_copy; |
| 197 | if (left_in_to_buffer == 0) |
| 198 | break; |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 199 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 200 | ASSERT (left_in_from_buffer <= 0); |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 201 | /* Move buffer */ |
| 202 | if (!(from_b->flags & VLIB_BUFFER_NEXT_PRESENT)) |
| 203 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 204 | return IP_FRAG_ERROR_MALFORMED; |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 205 | } |
| 206 | from_b = vlib_get_buffer (vm, from_b->next_buffer); |
| 207 | from_data = (u8 *) vlib_buffer_get_current (from_b); |
Ole Troan | 7eb9d96 | 2018-08-10 14:39:48 +0200 | [diff] [blame] | 208 | ptr = 0; |
| 209 | left_in_from_buffer = from_b->current_length; |
| 210 | to_ptr += bytes_to_copy; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 211 | } |
Ole Troan | 7eb9d96 | 2018-08-10 14:39:48 +0200 | [diff] [blame] | 212 | |
Neale Ranns | 0b6a857 | 2019-10-30 17:34:14 +0000 | [diff] [blame] | 213 | to_b->flags |= VNET_BUFFER_F_IS_IP4; |
Neale Ranns | 346c247 | 2022-03-08 13:24:28 +0000 | [diff] [blame] | 214 | to_b->current_length = len + head_bytes; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 215 | |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 216 | to_ip4->fragment_id = ip_frag_id; |
| 217 | to_ip4->flags_and_fragment_offset = |
| 218 | clib_host_to_net_u16 ((fo >> 3) + ip_frag_offset); |
| 219 | to_ip4->flags_and_fragment_offset |= |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 220 | clib_host_to_net_u16 (((len != rem) || more) << 13); |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 221 | to_ip4->length = clib_host_to_net_u16 (len + sizeof (ip4_header_t)); |
| 222 | to_ip4->checksum = ip4_header_checksum (to_ip4); |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 223 | |
Neale Ranns | 0b6a857 | 2019-10-30 17:34:14 +0000 | [diff] [blame] | 224 | /* we've just done the IP checksum .. */ |
Mohsin Kazmi | 6809538 | 2021-02-10 11:26:24 +0100 | [diff] [blame] | 225 | vnet_buffer_offload_flags_clear (to_b, VNET_BUFFER_OFFLOAD_F_IP_CKSUM); |
Neale Ranns | 0b6a857 | 2019-10-30 17:34:14 +0000 | [diff] [blame] | 226 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 227 | rem -= len; |
Ole Troan | 4146c65 | 2018-08-08 22:23:19 +0200 | [diff] [blame] | 228 | fo += len; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 229 | } |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 230 | |
| 231 | return IP_FRAG_ERROR_NONE; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 232 | } |
| 233 | |
Ole Troan | 9fb8755 | 2016-01-13 22:30:43 +0100 | [diff] [blame] | 234 | void |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 235 | ip_frag_set_vnet_buffer (vlib_buffer_t * b, u16 mtu, u8 next_index, u8 flags) |
Ole Troan | 9fb8755 | 2016-01-13 22:30:43 +0100 | [diff] [blame] | 236 | { |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 237 | vnet_buffer (b)->ip_frag.mtu = mtu; |
| 238 | vnet_buffer (b)->ip_frag.next_index = next_index; |
| 239 | vnet_buffer (b)->ip_frag.flags = flags; |
Ole Troan | 9fb8755 | 2016-01-13 22:30:43 +0100 | [diff] [blame] | 240 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 241 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 242 | |
| 243 | static inline uword |
| 244 | frag_node_inline (vlib_main_t * vm, vlib_node_runtime_t * node, |
| 245 | vlib_frame_t * frame, u32 node_index, bool is_ip6) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 246 | { |
| 247 | u32 n_left_from, *from, next_index, *to_next, n_left_to_next; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 248 | vlib_node_runtime_t *error_node = vlib_node_get_runtime (vm, node_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 249 | from = vlib_frame_vector_args (frame); |
| 250 | n_left_from = frame->n_vectors; |
| 251 | next_index = node->cached_next_index; |
| 252 | u32 frag_sent = 0, small_packets = 0; |
| 253 | u32 *buffer = 0; |
| 254 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 255 | while (n_left_from > 0) |
| 256 | { |
| 257 | vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 258 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 259 | while (n_left_from > 0 && n_left_to_next > 0) |
| 260 | { |
| 261 | u32 pi0, *frag_from, frag_left; |
| 262 | vlib_buffer_t *p0; |
| 263 | ip_frag_error_t error0; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 264 | int next0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 265 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 266 | /* |
| 267 | * Note: The packet is not enqueued now. It is instead put |
| 268 | * in a vector where other fragments will be put as well. |
| 269 | */ |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 270 | pi0 = from[0]; |
| 271 | from += 1; |
| 272 | n_left_from -= 1; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 273 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 274 | p0 = vlib_get_buffer (vm, pi0); |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 275 | u16 mtu = vnet_buffer (p0)->ip_frag.mtu; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 276 | if (is_ip6) |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 277 | error0 = ip6_frag_do_fragment (vm, pi0, mtu, 0, &buffer); |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 278 | else |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 279 | error0 = ip4_frag_do_fragment (vm, pi0, mtu, 0, &buffer); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 280 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 281 | if (PREDICT_FALSE (p0->flags & VLIB_BUFFER_IS_TRACED)) |
| 282 | { |
| 283 | ip_frag_trace_t *tr = |
| 284 | vlib_add_trace (vm, node, p0, sizeof (*tr)); |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 285 | tr->mtu = mtu; |
Neale Ranns | ec5371e | 2022-03-04 11:45:41 +0000 | [diff] [blame] | 286 | tr->pkt_size = vlib_buffer_length_in_chain (vm, p0); |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 287 | tr->n_fragments = vec_len (buffer); |
| 288 | tr->next = vnet_buffer (p0)->ip_frag.next_index; |
| 289 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 290 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 291 | if (!is_ip6 && error0 == IP_FRAG_ERROR_DONT_FRAGMENT_SET) |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 292 | { |
| 293 | icmp4_error_set_vnet_buffer (p0, ICMP4_destination_unreachable, |
| 294 | ICMP4_destination_unreachable_fragmentation_needed_and_dont_fragment_set, |
| 295 | vnet_buffer (p0)->ip_frag.mtu); |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 296 | next0 = IP_FRAG_NEXT_ICMP_ERROR; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 297 | } |
| 298 | else |
Vijayabhaskar Katamreddy | ce07412 | 2017-11-15 13:50:26 -0800 | [diff] [blame] | 299 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 300 | next0 = (error0 == IP_FRAG_ERROR_NONE ? |
| 301 | vnet_buffer (p0)->ip_frag.next_index : |
| 302 | IP_FRAG_NEXT_DROP); |
Vijayabhaskar Katamreddy | ce07412 | 2017-11-15 13:50:26 -0800 | [diff] [blame] | 303 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 304 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 305 | if (error0 == IP_FRAG_ERROR_NONE) |
| 306 | { |
Ole Troan | 7eb9d96 | 2018-08-10 14:39:48 +0200 | [diff] [blame] | 307 | /* Free original buffer chain */ |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 308 | frag_sent += vec_len (buffer); |
| 309 | small_packets += (vec_len (buffer) == 1); |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 310 | vlib_buffer_free_one (vm, pi0); /* Free original packet */ |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 311 | } |
| 312 | else |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 313 | { |
| 314 | vlib_error_count (vm, node_index, error0, 1); |
| 315 | vec_add1 (buffer, pi0); /* Get rid of the original buffer */ |
| 316 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 317 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 318 | /* Send fragments that were added in the frame */ |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 319 | frag_from = buffer; |
| 320 | frag_left = vec_len (buffer); |
| 321 | |
| 322 | while (frag_left > 0) |
| 323 | { |
| 324 | while (frag_left > 0 && n_left_to_next > 0) |
| 325 | { |
| 326 | u32 i; |
| 327 | i = to_next[0] = frag_from[0]; |
| 328 | frag_from += 1; |
| 329 | frag_left -= 1; |
| 330 | to_next += 1; |
| 331 | n_left_to_next -= 1; |
| 332 | |
| 333 | vlib_get_buffer (vm, i)->error = error_node->errors[error0]; |
| 334 | vlib_validate_buffer_enqueue_x1 (vm, node, next_index, |
| 335 | to_next, n_left_to_next, i, |
| 336 | next0); |
| 337 | } |
| 338 | vlib_put_next_frame (vm, node, next_index, n_left_to_next); |
| 339 | vlib_get_next_frame (vm, node, next_index, to_next, |
| 340 | n_left_to_next); |
| 341 | } |
| 342 | vec_reset_length (buffer); |
| 343 | } |
| 344 | vlib_put_next_frame (vm, node, next_index, n_left_to_next); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 345 | } |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 346 | vec_free (buffer); |
| 347 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 348 | vlib_node_increment_counter (vm, node_index, |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 349 | IP_FRAG_ERROR_FRAGMENT_SENT, frag_sent); |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 350 | vlib_node_increment_counter (vm, node_index, |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 351 | IP_FRAG_ERROR_SMALL_PACKET, small_packets); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 352 | |
| 353 | return frame->n_vectors; |
| 354 | } |
| 355 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 356 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 357 | |
| 358 | static uword |
| 359 | ip4_frag (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 360 | { |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 361 | return frag_node_inline (vm, node, frame, ip4_frag_node.index, |
| 362 | 0 /* is_ip6 */ ); |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | static uword |
| 366 | ip6_frag (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) |
| 367 | { |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 368 | return frag_node_inline (vm, node, frame, ip6_frag_node.index, |
| 369 | 1 /* is_ip6 */ ); |
| 370 | } |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 371 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 372 | /* |
| 373 | * Fragments the packet given in from_bi. Fragments are returned in the buffer vector. |
| 374 | * Caller must ensure the original packet is freed. |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 375 | * from_bi: current pointer must point to IPv6 header |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 376 | */ |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 377 | ip_frag_error_t |
| 378 | ip6_frag_do_fragment (vlib_main_t * vm, u32 from_bi, u16 mtu, |
| 379 | u16 l2unfragmentablesize, u32 ** buffer) |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 380 | { |
| 381 | vlib_buffer_t *from_b; |
| 382 | ip6_header_t *ip6; |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 383 | u16 len, max, rem, ip_frag_id; |
| 384 | u8 *org_from_packet; |
Neale Ranns | ec5371e | 2022-03-04 11:45:41 +0000 | [diff] [blame] | 385 | u16 head_bytes; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 386 | |
| 387 | from_b = vlib_get_buffer (vm, from_bi); |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 388 | org_from_packet = vlib_buffer_get_current (from_b); |
| 389 | ip6 = vlib_buffer_get_current (from_b) + l2unfragmentablesize; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 390 | |
Neale Ranns | ec5371e | 2022-03-04 11:45:41 +0000 | [diff] [blame] | 391 | head_bytes = |
| 392 | (sizeof (ip6_header_t) + sizeof (ip6_frag_hdr_t) + l2unfragmentablesize); |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 393 | rem = clib_net_to_host_u16 (ip6->payload_length); |
Neale Ranns | ec5371e | 2022-03-04 11:45:41 +0000 | [diff] [blame] | 394 | max = (clib_min (mtu, vlib_buffer_get_default_data_size (vm)) - head_bytes) & |
| 395 | ~0x7; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 396 | |
| 397 | if (rem > |
| 398 | (vlib_buffer_length_in_chain (vm, from_b) - sizeof (ip6_header_t))) |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 399 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 400 | return IP_FRAG_ERROR_MALFORMED; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 401 | } |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 402 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 403 | /* TODO: Look through header chain for fragmentation header */ |
| 404 | if (ip6->protocol == IP_PROTOCOL_IPV6_FRAGMENTATION) |
| 405 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 406 | return IP_FRAG_ERROR_MALFORMED; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 407 | } |
| 408 | |
| 409 | u8 *from_data = (void *) (ip6 + 1); |
| 410 | vlib_buffer_t *org_from_b = from_b; |
| 411 | u16 fo = 0; |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 412 | u16 left_in_from_buffer = |
| 413 | from_b->current_length - (l2unfragmentablesize + sizeof (ip6_header_t)); |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 414 | u16 ptr = 0; |
| 415 | |
| 416 | ip_frag_id = ++running_fragment_id; // Fix |
| 417 | |
| 418 | /* Do the actual fragmentation */ |
| 419 | while (rem) |
| 420 | { |
| 421 | u32 to_bi; |
| 422 | vlib_buffer_t *to_b; |
| 423 | ip6_header_t *to_ip6; |
| 424 | ip6_frag_hdr_t *to_frag_hdr; |
| 425 | u8 *to_data; |
| 426 | |
Neale Ranns | ec5371e | 2022-03-04 11:45:41 +0000 | [diff] [blame] | 427 | len = (rem > max ? max : rem); |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 428 | if (len != rem) /* Last fragment does not need to divisible by 8 */ |
| 429 | len &= ~0x7; |
| 430 | if ((to_b = frag_buffer_alloc (org_from_b, &to_bi)) == 0) |
| 431 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 432 | return IP_FRAG_ERROR_MEMORY; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 433 | } |
| 434 | vec_add1 (*buffer, to_bi); |
| 435 | frag_set_sw_if_index (to_b, org_from_b); |
| 436 | |
| 437 | /* Copy ip6 header */ |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 438 | clib_memcpy_fast (to_b->data, org_from_packet, |
| 439 | l2unfragmentablesize + sizeof (ip6_header_t)); |
Neale Ranns | ec5371e | 2022-03-04 11:45:41 +0000 | [diff] [blame] | 440 | to_ip6 = vlib_buffer_get_current (to_b) + l2unfragmentablesize; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 441 | to_frag_hdr = (ip6_frag_hdr_t *) (to_ip6 + 1); |
| 442 | to_data = (void *) (to_frag_hdr + 1); |
| 443 | |
Neale Ranns | 0b6a857 | 2019-10-30 17:34:14 +0000 | [diff] [blame] | 444 | vnet_buffer (to_b)->l3_hdr_offset = to_b->current_data; |
| 445 | to_b->flags |= VNET_BUFFER_F_L3_HDR_OFFSET_VALID; |
| 446 | |
| 447 | if (from_b->flags & VNET_BUFFER_F_L4_HDR_OFFSET_VALID) |
| 448 | { |
| 449 | vnet_buffer (to_b)->l4_hdr_offset = |
| 450 | (vnet_buffer (to_b)->l3_hdr_offset + |
| 451 | (vnet_buffer (from_b)->l4_hdr_offset - |
| 452 | vnet_buffer (from_b)->l3_hdr_offset)); |
| 453 | to_b->flags |= VNET_BUFFER_F_L4_HDR_OFFSET_VALID; |
| 454 | } |
| 455 | to_b->flags |= VNET_BUFFER_F_IS_IP6; |
| 456 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 457 | /* Spin through from buffers filling up the to buffer */ |
| 458 | u16 left_in_to_buffer = len, to_ptr = 0; |
| 459 | while (1) |
| 460 | { |
| 461 | u16 bytes_to_copy; |
| 462 | |
| 463 | /* Figure out how many bytes we can safely copy */ |
| 464 | bytes_to_copy = left_in_to_buffer <= left_in_from_buffer ? |
| 465 | left_in_to_buffer : left_in_from_buffer; |
Dave Barach | 178cf49 | 2018-11-13 16:34:13 -0500 | [diff] [blame] | 466 | clib_memcpy_fast (to_data + to_ptr, from_data + ptr, bytes_to_copy); |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 467 | left_in_to_buffer -= bytes_to_copy; |
| 468 | ptr += bytes_to_copy; |
| 469 | left_in_from_buffer -= bytes_to_copy; |
| 470 | if (left_in_to_buffer == 0) |
| 471 | break; |
| 472 | |
| 473 | ASSERT (left_in_from_buffer <= 0); |
| 474 | /* Move buffer */ |
| 475 | if (!(from_b->flags & VLIB_BUFFER_NEXT_PRESENT)) |
| 476 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 477 | return IP_FRAG_ERROR_MALFORMED; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 478 | } |
| 479 | from_b = vlib_get_buffer (vm, from_b->next_buffer); |
| 480 | from_data = (u8 *) vlib_buffer_get_current (from_b); |
| 481 | ptr = 0; |
| 482 | left_in_from_buffer = from_b->current_length; |
| 483 | to_ptr += bytes_to_copy; |
| 484 | } |
| 485 | |
Neale Ranns | ec5371e | 2022-03-04 11:45:41 +0000 | [diff] [blame] | 486 | to_b->current_length = len + head_bytes; |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 487 | to_ip6->payload_length = |
| 488 | clib_host_to_net_u16 (len + sizeof (ip6_frag_hdr_t)); |
| 489 | to_ip6->protocol = IP_PROTOCOL_IPV6_FRAGMENTATION; |
| 490 | to_frag_hdr->fragment_offset_and_more = |
| 491 | ip6_frag_hdr_offset_and_more ((fo >> 3), len != rem); |
| 492 | to_frag_hdr->identification = ip_frag_id; |
| 493 | to_frag_hdr->next_hdr = ip6->protocol; |
| 494 | to_frag_hdr->rsv = 0; |
| 495 | |
| 496 | rem -= len; |
| 497 | fo += len; |
| 498 | } |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 499 | |
| 500 | return IP_FRAG_ERROR_NONE; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 501 | } |
| 502 | |
BenoƮt Ganne | 4328995 | 2021-09-09 11:58:28 +0200 | [diff] [blame] | 503 | char *ip4_frag_error_strings[] = { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 504 | #define _(sym,string) string, |
| 505 | foreach_ip_frag_error |
| 506 | #undef _ |
| 507 | }; |
| 508 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 509 | /* *INDENT-OFF* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 510 | VLIB_REGISTER_NODE (ip4_frag_node) = { |
| 511 | .function = ip4_frag, |
| 512 | .name = IP4_FRAG_NODE_NAME, |
| 513 | .vector_size = sizeof (u32), |
| 514 | .format_trace = format_ip_frag_trace, |
| 515 | .type = VLIB_NODE_TYPE_INTERNAL, |
| 516 | |
| 517 | .n_errors = IP_FRAG_N_ERROR, |
| 518 | .error_strings = ip4_frag_error_strings, |
| 519 | |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 520 | .n_next_nodes = IP_FRAG_N_NEXT, |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 521 | .next_nodes = { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 522 | [IP_FRAG_NEXT_IP_REWRITE] = "ip4-rewrite", |
| 523 | [IP_FRAG_NEXT_IP_REWRITE_MIDCHAIN] = "ip4-midchain", |
| 524 | [IP_FRAG_NEXT_IP4_LOOKUP] = "ip4-lookup", |
| 525 | [IP_FRAG_NEXT_IP6_LOOKUP] = "ip6-lookup", |
| 526 | [IP_FRAG_NEXT_ICMP_ERROR] = "ip4-icmp-error", |
| 527 | [IP_FRAG_NEXT_DROP] = "ip4-drop" |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 528 | }, |
| 529 | }; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 530 | /* *INDENT-ON* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 531 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 532 | /* *INDENT-OFF* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 533 | VLIB_REGISTER_NODE (ip6_frag_node) = { |
| 534 | .function = ip6_frag, |
| 535 | .name = IP6_FRAG_NODE_NAME, |
| 536 | .vector_size = sizeof (u32), |
| 537 | .format_trace = format_ip_frag_trace, |
| 538 | .type = VLIB_NODE_TYPE_INTERNAL, |
| 539 | |
| 540 | .n_errors = IP_FRAG_N_ERROR, |
| 541 | .error_strings = ip4_frag_error_strings, |
| 542 | |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 543 | .n_next_nodes = IP_FRAG_N_NEXT, |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 544 | .next_nodes = { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 545 | [IP_FRAG_NEXT_IP_REWRITE] = "ip6-rewrite", |
| 546 | [IP_FRAG_NEXT_IP_REWRITE_MIDCHAIN] = "ip6-midchain", |
| 547 | [IP_FRAG_NEXT_IP4_LOOKUP] = "ip4-lookup", |
| 548 | [IP_FRAG_NEXT_IP6_LOOKUP] = "ip6-lookup", |
| 549 | [IP_FRAG_NEXT_ICMP_ERROR] = "error-drop", |
| 550 | [IP_FRAG_NEXT_DROP] = "ip6-drop" |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 551 | }, |
| 552 | }; |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 553 | /* *INDENT-ON* */ |
| 554 | |
| 555 | /* |
| 556 | * fd.io coding-style-patch-verification: ON |
| 557 | * |
| 558 | * Local Variables: |
| 559 | * eval: (c-set-style "gnu") |
| 560 | * End: |
| 561 | */ |