Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ipsec_if_in.c : IPSec interface input node |
| 3 | * |
| 4 | * Copyright (c) 2015 Cisco and/or its affiliates. |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at: |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #include <vnet/vnet.h> |
| 19 | #include <vnet/api_errno.h> |
| 20 | #include <vnet/ip/ip.h> |
| 21 | |
| 22 | #include <vnet/ipsec/ipsec.h> |
| 23 | #include <vnet/ipsec/esp.h> |
Neale Ranns | 918c161 | 2019-02-21 23:34:59 -0800 | [diff] [blame] | 24 | #include <vnet/ipsec/ipsec_io.h> |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 25 | #include <vnet/ipsec/ipsec_punt.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 26 | |
| 27 | /* Statistics (not really errors) */ |
Matthew Smith | 831fd64 | 2018-05-15 22:03:05 -0500 | [diff] [blame] | 28 | #define foreach_ipsec_if_input_error \ |
| 29 | _(RX, "good packets received") \ |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 30 | _(DISABLED, "ipsec packets received on disabled interface") \ |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 31 | _(NO_TUNNEL, "no matching tunnel") \ |
| 32 | _(SPI_0, "SPI 0") |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 33 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 34 | static char *ipsec_if_input_error_strings[] = { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 35 | #define _(sym,string) string, |
| 36 | foreach_ipsec_if_input_error |
| 37 | #undef _ |
| 38 | }; |
| 39 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 40 | typedef enum |
| 41 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 42 | #define _(sym,str) IPSEC_IF_INPUT_ERROR_##sym, |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 43 | foreach_ipsec_if_input_error |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 44 | #undef _ |
| 45 | IPSEC_IF_INPUT_N_ERROR, |
| 46 | } ipsec_if_input_error_t; |
| 47 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 48 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 49 | typedef struct |
| 50 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 51 | u32 spi; |
| 52 | u32 seq; |
| 53 | } ipsec_if_input_trace_t; |
| 54 | |
Kingwel Xie | c69ac31 | 2019-02-04 01:49:29 -0800 | [diff] [blame] | 55 | static u8 * |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 56 | format_ipsec_if_input_trace (u8 * s, va_list * args) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 57 | { |
| 58 | CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); |
| 59 | CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 60 | ipsec_if_input_trace_t *t = va_arg (*args, ipsec_if_input_trace_t *); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 61 | |
Guillaume Solignac | 8f818cc | 2019-05-15 12:02:33 +0200 | [diff] [blame] | 62 | s = format (s, "IPSec: spi %u (0x%08x) seq %u", t->spi, t->spi, t->seq); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 63 | return s; |
| 64 | } |
| 65 | |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 66 | always_inline u16 |
| 67 | ipsec_ip4_if_no_tunnel (vlib_node_runtime_t * node, |
| 68 | vlib_buffer_t * b, |
| 69 | const esp_header_t * esp, |
| 70 | const ip4_header_t * ip4, u16 offset) |
| 71 | { |
| 72 | if (PREDICT_FALSE (0 == esp->spi)) |
| 73 | { |
| 74 | b->error = node->errors[IPSEC_IF_INPUT_ERROR_SPI_0]; |
| 75 | b->punt_reason = |
| 76 | ipsec_punt_reason[(ip4->protocol == IP_PROTOCOL_UDP ? |
| 77 | IPSEC_PUNT_IP4_SPI_UDP_0 : IPSEC_PUNT_IP4_SPI_0)]; |
| 78 | } |
| 79 | else |
| 80 | { |
| 81 | b->error = node->errors[IPSEC_IF_INPUT_ERROR_NO_TUNNEL]; |
| 82 | b->punt_reason = ipsec_punt_reason[IPSEC_PUNT_IP4_NO_SUCH_TUNNEL]; |
| 83 | } |
| 84 | vlib_buffer_advance (b, -offset); |
| 85 | return IPSEC_INPUT_NEXT_PUNT; |
| 86 | } |
| 87 | |
| 88 | always_inline u16 |
| 89 | ipsec_ip6_if_no_tunnel (vlib_node_runtime_t * node, |
| 90 | vlib_buffer_t * b, |
| 91 | const esp_header_t * esp, u16 offset) |
| 92 | { |
| 93 | if (PREDICT_FALSE (0 == esp->spi)) |
| 94 | { |
| 95 | b->error = node->errors[IPSEC_IF_INPUT_ERROR_NO_TUNNEL]; |
| 96 | b->punt_reason = ipsec_punt_reason[IPSEC_PUNT_IP6_SPI_0]; |
| 97 | } |
| 98 | else |
| 99 | { |
| 100 | b->error = node->errors[IPSEC_IF_INPUT_ERROR_NO_TUNNEL]; |
| 101 | b->punt_reason = ipsec_punt_reason[IPSEC_PUNT_IP6_NO_SUCH_TUNNEL]; |
| 102 | } |
| 103 | vlib_buffer_advance (b, -offset); |
| 104 | return (IPSEC_INPUT_NEXT_PUNT); |
| 105 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 106 | |
| 107 | always_inline uword |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 108 | ipsec_if_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, |
| 109 | vlib_frame_t * from_frame, int is_ip6) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 110 | { |
| 111 | ipsec_main_t *im = &ipsec_main; |
Matthew Smith | 01034be | 2017-05-16 11:51:18 -0500 | [diff] [blame] | 112 | vnet_main_t *vnm = im->vnet_main; |
| 113 | vnet_interface_main_t *vim = &vnm->interface_main; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 114 | |
| 115 | int is_trace = node->flags & VLIB_NODE_FLAG_TRACE; |
Damjan Marion | 067cd62 | 2018-07-11 12:47:43 +0200 | [diff] [blame] | 116 | u32 thread_index = vm->thread_index; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 117 | |
| 118 | u32 n_left_from, *from; |
| 119 | u16 nexts[VLIB_FRAME_SIZE], *next; |
| 120 | vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b; |
| 121 | |
| 122 | from = vlib_frame_vector_args (from_frame); |
| 123 | n_left_from = from_frame->n_vectors; |
| 124 | |
| 125 | vlib_get_buffers (vm, from, bufs, n_left_from); |
| 126 | b = bufs; |
| 127 | next = nexts; |
| 128 | |
| 129 | clib_memset_u16 (nexts, im->esp4_decrypt_next_index, n_left_from); |
| 130 | |
Matthew Smith | 01034be | 2017-05-16 11:51:18 -0500 | [diff] [blame] | 131 | u64 n_bytes = 0, n_packets = 0; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 132 | u32 n_disabled = 0, n_no_tunnel = 0; |
| 133 | |
| 134 | u32 last_sw_if_index = ~0; |
| 135 | u32 last_tunnel_id = ~0; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 136 | ipsec4_tunnel_key_t last_key4; |
| 137 | ipsec6_tunnel_key_t last_key6; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 138 | |
Matthew Smith | 831fd64 | 2018-05-15 22:03:05 -0500 | [diff] [blame] | 139 | vlib_combined_counter_main_t *rx_counter; |
| 140 | vlib_combined_counter_main_t *drop_counter; |
Matthew Smith | 831fd64 | 2018-05-15 22:03:05 -0500 | [diff] [blame] | 141 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 142 | if (is_ip6) |
| 143 | clib_memset (&last_key6, 0xff, sizeof (last_key6)); |
| 144 | else |
| 145 | last_key4.as_u64 = ~0; |
| 146 | |
Matthew Smith | 831fd64 | 2018-05-15 22:03:05 -0500 | [diff] [blame] | 147 | rx_counter = vim->combined_sw_if_counters + VNET_INTERFACE_COUNTER_RX; |
| 148 | drop_counter = vim->combined_sw_if_counters + VNET_INTERFACE_COUNTER_DROP; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 149 | |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 150 | while (n_left_from >= 2) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 151 | { |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 152 | u32 sw_if_index0, sw_if_index1; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 153 | ip4_header_t *ip40, *ip41; |
| 154 | ip6_header_t *ip60, *ip61; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 155 | esp_header_t *esp0, *esp1; |
| 156 | u32 len0, len1; |
| 157 | u16 buf_adv0, buf_adv1; |
| 158 | u32 tid0, tid1; |
| 159 | ipsec_tunnel_if_t *t0, *t1; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 160 | ipsec4_tunnel_key_t key40, key41; |
| 161 | ipsec6_tunnel_key_t key60, key61; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 162 | |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 163 | if (n_left_from >= 4) |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 164 | { |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 165 | CLIB_PREFETCH (b[2], CLIB_CACHE_LINE_BYTES, STORE); |
| 166 | CLIB_PREFETCH (b[2]->data, CLIB_CACHE_LINE_BYTES, LOAD); |
| 167 | CLIB_PREFETCH (b[3], CLIB_CACHE_LINE_BYTES, STORE); |
| 168 | CLIB_PREFETCH (b[3]->data, CLIB_CACHE_LINE_BYTES, LOAD); |
| 169 | } |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 170 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 171 | ip40 = |
| 172 | (ip4_header_t *) (b[0]->data + vnet_buffer (b[0])->l3_hdr_offset); |
| 173 | ip41 = |
| 174 | (ip4_header_t *) (b[1]->data + vnet_buffer (b[1])->l3_hdr_offset); |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 175 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 176 | if (is_ip6) |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 177 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 178 | ip60 = (ip6_header_t *) ip40; |
| 179 | ip61 = (ip6_header_t *) ip41; |
| 180 | esp0 = (esp_header_t *) ((u8 *) ip60 + sizeof (ip6_header_t)); |
| 181 | esp1 = (esp_header_t *) ((u8 *) ip61 + sizeof (ip6_header_t)); |
| 182 | buf_adv0 = sizeof (ip6_header_t); |
| 183 | buf_adv1 = sizeof (ip6_header_t); |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 184 | } |
| 185 | else |
| 186 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 187 | /* NAT UDP port 4500 case, don't advance any more */ |
| 188 | if (ip40->protocol == IP_PROTOCOL_UDP) |
| 189 | { |
| 190 | esp0 = |
| 191 | (esp_header_t *) ((u8 *) ip40 + ip4_header_bytes (ip40) + |
| 192 | sizeof (udp_header_t)); |
| 193 | buf_adv0 = 0; |
| 194 | } |
| 195 | else |
| 196 | { |
| 197 | esp0 = (esp_header_t *) ((u8 *) ip40 + ip4_header_bytes (ip40)); |
| 198 | buf_adv0 = ip4_header_bytes (ip40); |
| 199 | } |
| 200 | /* NAT UDP port 4500 case, don't advance any more */ |
| 201 | if (ip41->protocol == IP_PROTOCOL_UDP) |
| 202 | { |
| 203 | esp1 = |
| 204 | (esp_header_t *) ((u8 *) ip41 + ip4_header_bytes (ip41) + |
| 205 | sizeof (udp_header_t)); |
| 206 | buf_adv1 = 0; |
| 207 | } |
| 208 | else |
| 209 | { |
| 210 | esp1 = (esp_header_t *) ((u8 *) ip41 + ip4_header_bytes (ip41)); |
| 211 | buf_adv1 = ip4_header_bytes (ip41); |
| 212 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 213 | } |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 214 | |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 215 | vlib_buffer_advance (b[0], buf_adv0); |
| 216 | vlib_buffer_advance (b[1], buf_adv1); |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 217 | |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 218 | len0 = vlib_buffer_length_in_chain (vm, b[0]); |
| 219 | len1 = vlib_buffer_length_in_chain (vm, b[1]); |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 220 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 221 | if (is_ip6) |
| 222 | { |
| 223 | key60.remote_ip = ip60->src_address; |
| 224 | key60.spi = esp0->spi; |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 225 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 226 | if (memcmp (&key60, &last_key6, sizeof (last_key6)) == 0) |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 227 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 228 | tid0 = last_tunnel_id; |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 229 | } |
| 230 | else |
| 231 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 232 | uword *p = |
| 233 | hash_get_mem (im->ipsec6_if_pool_index_by_key, &key60); |
| 234 | if (p) |
| 235 | { |
| 236 | tid0 = p[0]; |
| 237 | last_tunnel_id = tid0; |
| 238 | clib_memcpy_fast (&last_key6, &key60, sizeof (key60)); |
| 239 | } |
| 240 | else |
| 241 | { |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 242 | next[0] = |
| 243 | ipsec_ip6_if_no_tunnel (node, b[0], esp0, buf_adv0); |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 244 | n_no_tunnel++; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 245 | goto pkt1; |
| 246 | } |
| 247 | } |
| 248 | } |
| 249 | else /* !is_ip6 */ |
| 250 | { |
| 251 | key40.remote_ip = ip40->src_address.as_u32; |
| 252 | key40.spi = esp0->spi; |
| 253 | |
| 254 | if (key40.as_u64 == last_key4.as_u64) |
| 255 | { |
| 256 | tid0 = last_tunnel_id; |
| 257 | } |
| 258 | else |
| 259 | { |
| 260 | uword *p = |
| 261 | hash_get (im->ipsec4_if_pool_index_by_key, key40.as_u64); |
| 262 | if (p) |
| 263 | { |
| 264 | tid0 = p[0]; |
| 265 | last_tunnel_id = tid0; |
| 266 | last_key4.as_u64 = key40.as_u64; |
| 267 | } |
| 268 | else |
| 269 | { |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 270 | next[0] = |
| 271 | ipsec_ip4_if_no_tunnel (node, b[0], esp0, ip40, buf_adv0); |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 272 | n_no_tunnel++; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 273 | goto pkt1; |
| 274 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 275 | } |
| 276 | } |
| 277 | |
| 278 | t0 = pool_elt_at_index (im->tunnel_interfaces, tid0); |
| 279 | vnet_buffer (b[0])->ipsec.sad_index = t0->input_sa_index; |
| 280 | |
| 281 | if (PREDICT_TRUE (t0->hw_if_index != ~0)) |
| 282 | { |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 283 | sw_if_index0 = t0->sw_if_index; |
| 284 | vnet_buffer (b[0])->sw_if_index[VLIB_RX] = sw_if_index0; |
| 285 | |
| 286 | if (PREDICT_FALSE (!(t0->flags & VNET_HW_INTERFACE_FLAG_LINK_UP))) |
| 287 | { |
| 288 | vlib_increment_combined_counter |
| 289 | (drop_counter, thread_index, sw_if_index0, 1, len0); |
| 290 | n_disabled++; |
Neale Ranns | e524d45 | 2019-02-19 15:22:46 +0000 | [diff] [blame] | 291 | b[0]->error = node->errors[IPSEC_IF_INPUT_ERROR_DISABLED]; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 292 | next[0] = IPSEC_INPUT_NEXT_DROP; |
| 293 | goto pkt1; |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 294 | } |
| 295 | |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 296 | if (PREDICT_TRUE (sw_if_index0 == last_sw_if_index)) |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 297 | { |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 298 | n_packets++; |
| 299 | n_bytes += len0; |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 300 | } |
| 301 | else |
| 302 | { |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 303 | if (n_packets) |
| 304 | { |
| 305 | vlib_increment_combined_counter |
| 306 | (rx_counter, thread_index, last_sw_if_index, |
| 307 | n_packets, n_bytes); |
| 308 | } |
| 309 | |
| 310 | last_sw_if_index = sw_if_index0; |
| 311 | n_packets = 1; |
| 312 | n_bytes = len0; |
| 313 | } |
| 314 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 315 | |
| 316 | pkt1: |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 317 | if (is_ip6) |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 318 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 319 | key61.remote_ip = ip61->src_address; |
| 320 | key61.spi = esp1->spi; |
| 321 | |
| 322 | if (memcmp (&key61, &last_key6, sizeof (last_key6)) == 0) |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 323 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 324 | tid1 = last_tunnel_id; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 325 | } |
| 326 | else |
| 327 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 328 | uword *p = |
| 329 | hash_get_mem (im->ipsec6_if_pool_index_by_key, &key61); |
| 330 | if (p) |
| 331 | { |
| 332 | tid1 = p[0]; |
| 333 | last_tunnel_id = tid1; |
| 334 | clib_memcpy_fast (&last_key6, &key61, sizeof (key61)); |
| 335 | } |
| 336 | else |
| 337 | { |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 338 | next[1] = |
| 339 | ipsec_ip6_if_no_tunnel (node, b[1], esp1, buf_adv1); |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 340 | n_no_tunnel++; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 341 | goto trace1; |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | else /* !is_ip6 */ |
| 346 | { |
| 347 | key41.remote_ip = ip41->src_address.as_u32; |
| 348 | key41.spi = esp1->spi; |
| 349 | |
| 350 | if (key41.as_u64 == last_key4.as_u64) |
| 351 | { |
| 352 | tid1 = last_tunnel_id; |
| 353 | } |
| 354 | else |
| 355 | { |
| 356 | uword *p = |
| 357 | hash_get (im->ipsec4_if_pool_index_by_key, key41.as_u64); |
| 358 | if (p) |
| 359 | { |
| 360 | tid1 = p[0]; |
| 361 | last_tunnel_id = tid1; |
| 362 | last_key4.as_u64 = key41.as_u64; |
| 363 | } |
| 364 | else |
| 365 | { |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 366 | next[1] = |
| 367 | ipsec_ip4_if_no_tunnel (node, b[1], esp1, ip41, buf_adv1); |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 368 | n_no_tunnel++; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 369 | goto trace1; |
| 370 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 371 | } |
| 372 | } |
| 373 | |
| 374 | t1 = pool_elt_at_index (im->tunnel_interfaces, tid1); |
| 375 | vnet_buffer (b[1])->ipsec.sad_index = t1->input_sa_index; |
| 376 | |
| 377 | if (PREDICT_TRUE (t1->hw_if_index != ~0)) |
| 378 | { |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 379 | sw_if_index1 = t1->sw_if_index; |
| 380 | vnet_buffer (b[1])->sw_if_index[VLIB_RX] = sw_if_index1; |
| 381 | |
| 382 | if (PREDICT_FALSE (!(t1->flags & VNET_HW_INTERFACE_FLAG_LINK_UP))) |
| 383 | { |
| 384 | vlib_increment_combined_counter |
| 385 | (drop_counter, thread_index, sw_if_index1, 1, len1); |
| 386 | n_disabled++; |
Neale Ranns | e524d45 | 2019-02-19 15:22:46 +0000 | [diff] [blame] | 387 | b[1]->error = node->errors[IPSEC_IF_INPUT_ERROR_DISABLED]; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 388 | next[1] = IPSEC_INPUT_NEXT_DROP; |
| 389 | goto trace1; |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 390 | } |
| 391 | |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 392 | if (PREDICT_TRUE (sw_if_index1 == last_sw_if_index)) |
| 393 | { |
| 394 | n_packets++; |
| 395 | n_bytes += len1; |
| 396 | } |
| 397 | else |
| 398 | { |
| 399 | if (n_packets) |
| 400 | { |
| 401 | vlib_increment_combined_counter |
| 402 | (rx_counter, thread_index, last_sw_if_index, |
| 403 | n_packets, n_bytes); |
| 404 | } |
| 405 | |
| 406 | last_sw_if_index = sw_if_index1; |
| 407 | n_packets = 1; |
| 408 | n_bytes = len1; |
| 409 | } |
| 410 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 411 | |
| 412 | trace1: |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 413 | if (PREDICT_FALSE (is_trace)) |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 414 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 415 | if (b[0]->flags & VLIB_BUFFER_IS_TRACED) |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 416 | { |
| 417 | ipsec_if_input_trace_t *tr = |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 418 | vlib_add_trace (vm, node, b[0], sizeof (*tr)); |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 419 | tr->spi = clib_host_to_net_u32 (esp0->spi); |
| 420 | tr->seq = clib_host_to_net_u32 (esp0->seq); |
| 421 | } |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 422 | if (b[1]->flags & VLIB_BUFFER_IS_TRACED) |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 423 | { |
| 424 | ipsec_if_input_trace_t *tr = |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 425 | vlib_add_trace (vm, node, b[1], sizeof (*tr)); |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 426 | tr->spi = clib_host_to_net_u32 (esp1->spi); |
| 427 | tr->seq = clib_host_to_net_u32 (esp1->seq); |
| 428 | } |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame] | 429 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 430 | |
| 431 | /* next */ |
| 432 | b += 2; |
| 433 | next += 2; |
| 434 | n_left_from -= 2; |
| 435 | } |
| 436 | while (n_left_from > 0) |
| 437 | { |
| 438 | u32 sw_if_index0; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 439 | ip4_header_t *ip40; |
| 440 | ip6_header_t *ip60; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 441 | esp_header_t *esp0; |
| 442 | u32 len0; |
Neale Ranns | a6bee0a | 2019-06-14 01:13:25 -0700 | [diff] [blame] | 443 | u16 buf_adv0, buf_rewind0; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 444 | u32 tid0; |
| 445 | ipsec_tunnel_if_t *t0; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 446 | ipsec4_tunnel_key_t key40; |
| 447 | ipsec6_tunnel_key_t key60; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 448 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 449 | ip40 = |
| 450 | (ip4_header_t *) (b[0]->data + vnet_buffer (b[0])->l3_hdr_offset); |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 451 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 452 | if (is_ip6) |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 453 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 454 | ip60 = (ip6_header_t *) ip40; |
| 455 | esp0 = (esp_header_t *) ((u8 *) ip60 + sizeof (ip6_header_t)); |
| 456 | buf_adv0 = sizeof (ip6_header_t); |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 457 | } |
| 458 | else |
| 459 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 460 | /* NAT UDP port 4500 case, don't advance any more */ |
| 461 | if (ip40->protocol == IP_PROTOCOL_UDP) |
| 462 | { |
| 463 | esp0 = |
| 464 | (esp_header_t *) ((u8 *) ip40 + ip4_header_bytes (ip40) + |
| 465 | sizeof (udp_header_t)); |
| 466 | buf_adv0 = 0; |
Neale Ranns | a6bee0a | 2019-06-14 01:13:25 -0700 | [diff] [blame] | 467 | buf_rewind0 = ip4_header_bytes (ip40) + sizeof (udp_header_t); |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 468 | } |
| 469 | else |
| 470 | { |
| 471 | esp0 = (esp_header_t *) ((u8 *) ip40 + ip4_header_bytes (ip40)); |
Neale Ranns | a6bee0a | 2019-06-14 01:13:25 -0700 | [diff] [blame] | 472 | buf_rewind0 = buf_adv0 = ip4_header_bytes (ip40); |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 473 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 474 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 475 | |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 476 | /* stats for the tunnel include all the data after the IP header |
| 477 | just like a norml IP-IP tunnel */ |
| 478 | vlib_buffer_advance (b[0], buf_adv0); |
| 479 | len0 = vlib_buffer_length_in_chain (vm, b[0]); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 480 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 481 | if (is_ip6) |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 482 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 483 | key60.remote_ip = ip60->src_address; |
| 484 | key60.spi = esp0->spi; |
| 485 | |
| 486 | if (memcmp (&key60, &last_key6, sizeof (last_key6)) == 0) |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 487 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 488 | tid0 = last_tunnel_id; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 489 | } |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 490 | else |
| 491 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 492 | uword *p = |
| 493 | hash_get_mem (im->ipsec6_if_pool_index_by_key, &key60); |
| 494 | if (p) |
| 495 | { |
| 496 | tid0 = p[0]; |
| 497 | last_tunnel_id = tid0; |
| 498 | clib_memcpy_fast (&last_key6, &key60, sizeof (key60)); |
| 499 | } |
| 500 | else |
| 501 | { |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 502 | next[0] = |
| 503 | ipsec_ip6_if_no_tunnel (node, b[0], esp0, buf_adv0); |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 504 | n_no_tunnel++; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 505 | goto trace00; |
| 506 | } |
| 507 | } |
| 508 | } |
| 509 | else /* !is_ip6 */ |
| 510 | { |
| 511 | key40.remote_ip = ip40->src_address.as_u32; |
| 512 | key40.spi = esp0->spi; |
| 513 | |
| 514 | if (key40.as_u64 == last_key4.as_u64) |
| 515 | { |
| 516 | tid0 = last_tunnel_id; |
| 517 | } |
| 518 | else |
| 519 | { |
| 520 | uword *p = |
| 521 | hash_get (im->ipsec4_if_pool_index_by_key, key40.as_u64); |
| 522 | if (p) |
| 523 | { |
| 524 | tid0 = p[0]; |
| 525 | last_tunnel_id = tid0; |
| 526 | last_key4.as_u64 = key40.as_u64; |
| 527 | } |
| 528 | else |
| 529 | { |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 530 | next[0] = |
Neale Ranns | a6bee0a | 2019-06-14 01:13:25 -0700 | [diff] [blame] | 531 | ipsec_ip4_if_no_tunnel (node, b[0], esp0, ip40, |
| 532 | buf_rewind0); |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 533 | n_no_tunnel++; |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 534 | goto trace00; |
| 535 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 536 | } |
| 537 | } |
| 538 | |
| 539 | t0 = pool_elt_at_index (im->tunnel_interfaces, tid0); |
| 540 | vnet_buffer (b[0])->ipsec.sad_index = t0->input_sa_index; |
| 541 | |
| 542 | if (PREDICT_TRUE (t0->hw_if_index != ~0)) |
| 543 | { |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 544 | sw_if_index0 = t0->sw_if_index; |
| 545 | vnet_buffer (b[0])->sw_if_index[VLIB_RX] = sw_if_index0; |
| 546 | |
| 547 | if (PREDICT_FALSE (!(t0->flags & VNET_HW_INTERFACE_FLAG_LINK_UP))) |
| 548 | { |
| 549 | vlib_increment_combined_counter |
| 550 | (drop_counter, thread_index, sw_if_index0, 1, len0); |
| 551 | n_disabled++; |
Neale Ranns | e524d45 | 2019-02-19 15:22:46 +0000 | [diff] [blame] | 552 | b[0]->error = node->errors[IPSEC_IF_INPUT_ERROR_DISABLED]; |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 553 | next[0] = IPSEC_INPUT_NEXT_DROP; |
| 554 | goto trace00; |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 555 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 556 | |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 557 | if (PREDICT_TRUE (sw_if_index0 == last_sw_if_index)) |
| 558 | { |
| 559 | n_packets++; |
| 560 | n_bytes += len0; |
| 561 | } |
| 562 | else |
| 563 | { |
| 564 | if (n_packets) |
| 565 | { |
| 566 | vlib_increment_combined_counter |
| 567 | (rx_counter, thread_index, last_sw_if_index, |
| 568 | n_packets, n_bytes); |
| 569 | } |
| 570 | |
| 571 | last_sw_if_index = sw_if_index0; |
| 572 | n_packets = 1; |
| 573 | n_bytes = len0; |
| 574 | } |
| 575 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 576 | |
| 577 | trace00: |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 578 | if (PREDICT_FALSE (is_trace)) |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 579 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 580 | if (b[0]->flags & VLIB_BUFFER_IS_TRACED) |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 581 | { |
| 582 | ipsec_if_input_trace_t *tr = |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 583 | vlib_add_trace (vm, node, b[0], sizeof (*tr)); |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 584 | tr->spi = clib_host_to_net_u32 (esp0->spi); |
| 585 | tr->seq = clib_host_to_net_u32 (esp0->seq); |
| 586 | } |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 587 | } |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 588 | |
| 589 | /* next */ |
| 590 | b += 1; |
| 591 | next += 1; |
| 592 | n_left_from -= 1; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 593 | } |
| 594 | |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 595 | if (n_packets) |
Matthew Smith | 01034be | 2017-05-16 11:51:18 -0500 | [diff] [blame] | 596 | { |
Matthew Smith | 831fd64 | 2018-05-15 22:03:05 -0500 | [diff] [blame] | 597 | vlib_increment_combined_counter (rx_counter, |
Matthew Smith | 01034be | 2017-05-16 11:51:18 -0500 | [diff] [blame] | 598 | thread_index, |
| 599 | last_sw_if_index, n_packets, n_bytes); |
| 600 | } |
| 601 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 602 | vlib_node_increment_counter (vm, node->node_index, |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 603 | IPSEC_IF_INPUT_ERROR_RX, |
Neale Ranns | e524d45 | 2019-02-19 15:22:46 +0000 | [diff] [blame] | 604 | from_frame->n_vectors - (n_disabled + |
| 605 | n_no_tunnel)); |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 606 | |
| 607 | vlib_buffer_enqueue_to_next (vm, node, from, nexts, from_frame->n_vectors); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 608 | |
| 609 | return from_frame->n_vectors; |
| 610 | } |
| 611 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 612 | VLIB_NODE_FN (ipsec4_if_input_node) (vlib_main_t * vm, |
| 613 | vlib_node_runtime_t * node, |
| 614 | vlib_frame_t * from_frame) |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 615 | { |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 616 | return ipsec_if_input_inline (vm, node, from_frame, 0 /* is_ip6 */ ); |
Kingwel Xie | 00bff19 | 2019-03-07 01:25:32 -0500 | [diff] [blame] | 617 | } |
| 618 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 619 | /* *INDENT-OFF* */ |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 620 | VLIB_REGISTER_NODE (ipsec4_if_input_node) = { |
| 621 | .name = "ipsec4-if-input", |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 622 | .vector_size = sizeof (u32), |
| 623 | .format_trace = format_ipsec_if_input_trace, |
| 624 | .type = VLIB_NODE_TYPE_INTERNAL, |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 625 | .n_errors = ARRAY_LEN(ipsec_if_input_error_strings), |
| 626 | .error_strings = ipsec_if_input_error_strings, |
Pierre Pfister | 057b356 | 2018-12-10 17:01:01 +0100 | [diff] [blame] | 627 | .sibling_of = "ipsec4-input-feature", |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 628 | }; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 629 | /* *INDENT-ON* */ |
Damjan Marion | 1c80e83 | 2016-05-11 23:07:18 +0200 | [diff] [blame] | 630 | |
Kingwel Xie | 1ba5bc8 | 2019-03-20 07:21:58 -0400 | [diff] [blame] | 631 | VLIB_NODE_FN (ipsec6_if_input_node) (vlib_main_t * vm, |
| 632 | vlib_node_runtime_t * node, |
| 633 | vlib_frame_t * from_frame) |
| 634 | { |
| 635 | return ipsec_if_input_inline (vm, node, from_frame, 1 /* is_ip6 */ ); |
| 636 | } |
| 637 | |
| 638 | /* *INDENT-OFF* */ |
| 639 | VLIB_REGISTER_NODE (ipsec6_if_input_node) = { |
| 640 | .name = "ipsec6-if-input", |
| 641 | .vector_size = sizeof (u32), |
| 642 | .format_trace = format_ipsec_if_input_trace, |
| 643 | .type = VLIB_NODE_TYPE_INTERNAL, |
| 644 | .n_errors = ARRAY_LEN(ipsec_if_input_error_strings), |
| 645 | .error_strings = ipsec_if_input_error_strings, |
| 646 | .sibling_of = "ipsec6-input-feature", |
| 647 | }; |
| 648 | /* *INDENT-ON* */ |
| 649 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 650 | /* |
| 651 | * fd.io coding-style-patch-verification: ON |
| 652 | * |
| 653 | * Local Variables: |
| 654 | * eval: (c-set-style "gnu") |
| 655 | * End: |
| 656 | */ |