Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ipsec_if.c : IPSec interface support |
| 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> |
Pierre Pfister | 4c422f9 | 2018-12-10 11:19:08 +0100 | [diff] [blame] | 21 | #include <vnet/fib/fib.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 22 | |
| 23 | #include <vnet/ipsec/ipsec.h> |
Sergio Gonzalez Monroy | a10f62b | 2016-11-25 13:36:12 +0000 | [diff] [blame] | 24 | #include <vnet/ipsec/esp.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 25 | |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 26 | void vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length); |
| 27 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 28 | static u8 * |
| 29 | format_ipsec_name (u8 * s, va_list * args) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 30 | { |
| 31 | u32 dev_instance = va_arg (*args, u32); |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 32 | ipsec_main_t *im = &ipsec_main; |
| 33 | ipsec_tunnel_if_t *t = im->tunnel_interfaces + dev_instance; |
| 34 | |
| 35 | return format (s, "ipsec%d", t->show_instance); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 36 | } |
| 37 | |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 38 | /* Statistics (not really errors) */ |
| 39 | #define foreach_ipsec_if_tx_error \ |
| 40 | _(TX, "good packets transmitted") |
| 41 | |
| 42 | static char *ipsec_if_tx_error_strings[] = { |
| 43 | #define _(sym,string) string, |
| 44 | foreach_ipsec_if_tx_error |
| 45 | #undef _ |
| 46 | }; |
| 47 | |
| 48 | typedef enum |
Klement Sekera | a98346f | 2018-05-16 10:52:45 +0200 | [diff] [blame] | 49 | { |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 50 | #define _(sym,str) IPSEC_IF_OUTPUT_ERROR_##sym, |
| 51 | foreach_ipsec_if_tx_error |
| 52 | #undef _ |
| 53 | IPSEC_IF_TX_N_ERROR, |
| 54 | } ipsec_if_tx_error_t; |
| 55 | |
| 56 | typedef struct |
| 57 | { |
| 58 | u32 spi; |
| 59 | u32 seq; |
| 60 | } ipsec_if_tx_trace_t; |
| 61 | |
| 62 | u8 * |
| 63 | format_ipsec_if_tx_trace (u8 * s, va_list * args) |
| 64 | { |
| 65 | CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); |
| 66 | CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); |
| 67 | ipsec_if_tx_trace_t *t = va_arg (*args, ipsec_if_tx_trace_t *); |
| 68 | |
| 69 | s = format (s, "IPSec: spi %u seq %u", t->spi, t->seq); |
| 70 | return s; |
Klement Sekera | a98346f | 2018-05-16 10:52:45 +0200 | [diff] [blame] | 71 | } |
| 72 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 73 | static void |
| 74 | ipsec_output_trace (vlib_main_t * vm, |
| 75 | vlib_node_runtime_t * node, |
| 76 | vlib_frame_t * frame, const ipsec_tunnel_if_t * t0) |
Neale Ranns | fe480f6 | 2019-02-28 12:03:58 +0000 | [diff] [blame] | 77 | { |
| 78 | ipsec_main_t *im = &ipsec_main; |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 79 | u32 *from, n_left; |
Neale Ranns | fe480f6 | 2019-02-28 12:03:58 +0000 | [diff] [blame] | 80 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 81 | n_left = frame->n_vectors; |
| 82 | from = vlib_frame_vector_args (frame); |
Neale Ranns | fe480f6 | 2019-02-28 12:03:58 +0000 | [diff] [blame] | 83 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 84 | while (n_left > 0) |
| 85 | { |
| 86 | vlib_buffer_t *b0; |
| 87 | |
| 88 | b0 = vlib_get_buffer (vm, from[0]); |
| 89 | |
| 90 | if (b0->flags & VLIB_BUFFER_IS_TRACED) |
| 91 | { |
| 92 | ipsec_if_tx_trace_t *tr = |
| 93 | vlib_add_trace (vm, node, b0, sizeof (*tr)); |
| 94 | ipsec_sa_t *sa0 = pool_elt_at_index (im->sad, t0->output_sa_index); |
| 95 | tr->spi = sa0->spi; |
| 96 | tr->seq = sa0->seq; |
| 97 | } |
| 98 | |
| 99 | from += 1; |
| 100 | n_left -= 1; |
| 101 | } |
Neale Ranns | fe480f6 | 2019-02-28 12:03:58 +0000 | [diff] [blame] | 102 | } |
| 103 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 104 | VNET_DEVICE_CLASS_TX_FN (ipsec_device_class) (vlib_main_t * vm, |
| 105 | vlib_node_runtime_t * node, |
| 106 | vlib_frame_t * frame) |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 107 | { |
| 108 | ipsec_main_t *im = &ipsec_main; |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 109 | u32 *from, n_left; |
| 110 | vnet_interface_output_runtime_t *rd = (void *) node->runtime_data; |
| 111 | const ipsec_tunnel_if_t *t0; |
| 112 | vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b; |
| 113 | u16 nexts[VLIB_FRAME_SIZE]; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 114 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 115 | from = vlib_frame_vector_args (frame); |
| 116 | t0 = pool_elt_at_index (im->tunnel_interfaces, rd->dev_instance); |
| 117 | n_left = frame->n_vectors; |
| 118 | b = bufs; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 119 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 120 | /* All going to encrypt */ |
| 121 | clib_memset (nexts, 0, sizeof (nexts)); |
| 122 | |
| 123 | if (node->flags & VLIB_NODE_FLAG_TRACE) |
| 124 | ipsec_output_trace (vm, node, frame, t0); |
| 125 | |
| 126 | vlib_get_buffers (vm, from, bufs, n_left); |
| 127 | |
| 128 | while (n_left >= 8) |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 129 | { |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 130 | /* Prefetch the buffer header for the N+2 loop iteration */ |
| 131 | vlib_prefetch_buffer_header (b[4], STORE); |
| 132 | vlib_prefetch_buffer_header (b[5], STORE); |
| 133 | vlib_prefetch_buffer_header (b[6], STORE); |
| 134 | vlib_prefetch_buffer_header (b[7], STORE); |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 135 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 136 | vnet_buffer (b[0])->ipsec.sad_index = t0->output_sa_index; |
| 137 | vnet_buffer (b[1])->ipsec.sad_index = t0->output_sa_index; |
| 138 | vnet_buffer (b[2])->ipsec.sad_index = t0->output_sa_index; |
| 139 | vnet_buffer (b[3])->ipsec.sad_index = t0->output_sa_index; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 140 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 141 | n_left -= 4; |
| 142 | b += 4; |
| 143 | } |
| 144 | while (n_left > 0) |
| 145 | { |
| 146 | vnet_buffer (b[0])->ipsec.sad_index = t0->output_sa_index; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 147 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 148 | n_left -= 1; |
| 149 | b += 1; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 150 | } |
| 151 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 152 | vlib_buffer_enqueue_to_next (vm, node, from, nexts, frame->n_vectors); |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 153 | |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 154 | return frame->n_vectors; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 158 | static clib_error_t * |
| 159 | ipsec_admin_up_down_function (vnet_main_t * vnm, u32 hw_if_index, u32 flags) |
| 160 | { |
| 161 | ipsec_main_t *im = &ipsec_main; |
| 162 | clib_error_t *err = 0; |
| 163 | ipsec_tunnel_if_t *t; |
| 164 | vnet_hw_interface_t *hi; |
| 165 | ipsec_sa_t *sa; |
| 166 | |
| 167 | hi = vnet_get_hw_interface (vnm, hw_if_index); |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 168 | t = pool_elt_at_index (im->tunnel_interfaces, hi->hw_instance); |
Neale Ranns | fe480f6 | 2019-02-28 12:03:58 +0000 | [diff] [blame] | 169 | t->flags = flags; |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 170 | |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 171 | if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) |
| 172 | { |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 173 | sa = pool_elt_at_index (im->sad, t->input_sa_index); |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 174 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 175 | err = ipsec_check_support_cb (im, sa); |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 176 | if (err) |
| 177 | return err; |
| 178 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 179 | err = ipsec_add_del_sa_sess_cb (im, t->input_sa_index, 1); |
| 180 | if (err) |
| 181 | return err; |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 182 | |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 183 | sa = pool_elt_at_index (im->sad, t->output_sa_index); |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 184 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 185 | err = ipsec_check_support_cb (im, sa); |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 186 | if (err) |
| 187 | return err; |
| 188 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 189 | err = ipsec_add_del_sa_sess_cb (im, t->output_sa_index, 1); |
| 190 | if (err) |
| 191 | return err; |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 192 | |
Radu Nicolau | 3f90339 | 2017-01-30 14:33:39 +0000 | [diff] [blame] | 193 | vnet_hw_interface_set_flags (vnm, hw_if_index, |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 194 | VNET_HW_INTERFACE_FLAG_LINK_UP); |
| 195 | } |
| 196 | else |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 197 | { |
| 198 | vnet_hw_interface_set_flags (vnm, hw_if_index, 0 /* down */ ); |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 199 | sa = pool_elt_at_index (im->sad, t->input_sa_index); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 200 | err = ipsec_add_del_sa_sess_cb (im, t->input_sa_index, 0); |
| 201 | if (err) |
| 202 | return err; |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 203 | sa = pool_elt_at_index (im->sad, t->output_sa_index); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 204 | err = ipsec_add_del_sa_sess_cb (im, t->output_sa_index, 0); |
| 205 | if (err) |
| 206 | return err; |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 207 | } |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 208 | |
| 209 | return /* no error */ 0; |
| 210 | } |
| 211 | |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 212 | |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 213 | /* *INDENT-OFF* */ |
Neale Ranns | 77eb28f | 2019-03-04 14:13:14 +0000 | [diff] [blame^] | 214 | VNET_DEVICE_CLASS (ipsec_device_class) = |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 215 | { |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 216 | .name = "IPSec", |
| 217 | .format_device_name = format_ipsec_name, |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 218 | .format_tx_trace = format_ipsec_if_tx_trace, |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 219 | .tx_function_n_errors = IPSEC_IF_TX_N_ERROR, |
| 220 | .tx_function_error_strings = ipsec_if_tx_error_strings, |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 221 | .admin_up_down_function = ipsec_admin_up_down_function, |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 222 | }; |
| 223 | /* *INDENT-ON* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 224 | |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 225 | /* *INDENT-OFF* */ |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 226 | VNET_HW_INTERFACE_CLASS (ipsec_hw_class) = |
| 227 | { |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 228 | .name = "IPSec", |
| 229 | .build_rewrite = default_build_rewrite, |
Matthew Smith | 922549a | 2017-05-24 16:18:27 -0500 | [diff] [blame] | 230 | .flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P, |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 231 | }; |
| 232 | /* *INDENT-ON* */ |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 233 | |
| 234 | static int |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 235 | ipsec_add_del_tunnel_if_rpc_callback (ipsec_add_del_tunnel_args_t * a) |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 236 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 237 | vnet_main_t *vnm = vnet_get_main (); |
Damjan Marion | 586afd7 | 2017-04-05 19:18:20 +0200 | [diff] [blame] | 238 | ASSERT (vlib_get_thread_index () == 0); |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 239 | |
Matthew Smith | e04d09d | 2017-05-14 21:47:18 -0500 | [diff] [blame] | 240 | return ipsec_add_del_tunnel_if_internal (vnm, a, NULL); |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | int |
| 244 | ipsec_add_del_tunnel_if (ipsec_add_del_tunnel_args_t * args) |
| 245 | { |
| 246 | vl_api_rpc_call_main_thread (ipsec_add_del_tunnel_if_rpc_callback, |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 247 | (u8 *) args, sizeof (*args)); |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 248 | return 0; |
| 249 | } |
| 250 | |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 251 | static u32 |
| 252 | ipsec_tun_mk_input_sa_id (u32 ti) |
| 253 | { |
| 254 | return (0x80000000 | ti); |
| 255 | } |
| 256 | |
| 257 | static u32 |
| 258 | ipsec_tun_mk_output_sa_id (u32 ti) |
| 259 | { |
| 260 | return (0xc0000000 | ti); |
| 261 | } |
| 262 | |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 263 | int |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 264 | ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm, |
Matthew Smith | e04d09d | 2017-05-14 21:47:18 -0500 | [diff] [blame] | 265 | ipsec_add_del_tunnel_args_t * args, |
| 266 | u32 * sw_if_index) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 267 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 268 | ipsec_tunnel_if_t *t; |
| 269 | ipsec_main_t *im = &ipsec_main; |
Matthew Smith | e04d09d | 2017-05-14 21:47:18 -0500 | [diff] [blame] | 270 | vnet_hw_interface_t *hi = NULL; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 271 | u32 hw_if_index = ~0; |
| 272 | uword *p; |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 273 | u32 dev_instance; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 274 | u32 slot; |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 275 | ipsec_key_t crypto_key, integ_key; |
| 276 | ipsec_sa_flags_t flags; |
| 277 | int rv; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 278 | |
Neale Ranns | 7ba8fe2 | 2019-02-11 11:24:07 +0000 | [diff] [blame] | 279 | u64 key = ((u64) args->remote_ip.ip4.as_u32 << 32 | |
| 280 | (u64) clib_host_to_net_u32 (args->remote_spi)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 281 | p = hash_get (im->ipsec_if_pool_index_by_key, key); |
| 282 | |
| 283 | if (args->is_add) |
| 284 | { |
| 285 | /* check if same src/dst pair exists */ |
| 286 | if (p) |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 287 | return VNET_API_ERROR_INVALID_VALUE; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 288 | |
Neale Ranns | fe480f6 | 2019-02-28 12:03:58 +0000 | [diff] [blame] | 289 | pool_get_aligned_zero (im->tunnel_interfaces, t, CLIB_CACHE_LINE_BYTES); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 290 | |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 291 | dev_instance = t - im->tunnel_interfaces; |
| 292 | if (args->renumber) |
| 293 | t->show_instance = args->show_instance; |
| 294 | else |
| 295 | t->show_instance = dev_instance; |
| 296 | |
| 297 | if (hash_get (im->ipsec_if_real_dev_by_show_dev, t->show_instance)) |
| 298 | { |
| 299 | pool_put (im->tunnel_interfaces, t); |
| 300 | return VNET_API_ERROR_INSTANCE_IN_USE; |
| 301 | } |
| 302 | |
| 303 | hash_set (im->ipsec_if_real_dev_by_show_dev, t->show_instance, |
| 304 | dev_instance); |
| 305 | |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 306 | flags = IPSEC_SA_FLAG_IS_TUNNEL; |
| 307 | if (args->udp_encap) |
| 308 | flags |= IPSEC_SA_FLAG_UDP_ENCAP; |
| 309 | if (args->esn) |
| 310 | flags |= IPSEC_SA_FLAG_USE_EXTENDED_SEQ_NUM; |
| 311 | if (args->anti_replay) |
| 312 | flags |= IPSEC_SA_FLAG_USE_ANTI_REPLAY; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 313 | |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 314 | ipsec_mk_key (&crypto_key, |
| 315 | args->remote_crypto_key, args->remote_crypto_key_len); |
| 316 | ipsec_mk_key (&integ_key, |
| 317 | args->remote_integ_key, args->remote_integ_key_len); |
| 318 | |
| 319 | rv = ipsec_sa_add (ipsec_tun_mk_input_sa_id (dev_instance), |
| 320 | args->remote_spi, |
| 321 | IPSEC_PROTOCOL_ESP, |
| 322 | args->crypto_alg, |
| 323 | &crypto_key, |
| 324 | args->integ_alg, |
| 325 | &integ_key, |
| 326 | flags, |
| 327 | args->tx_table_id, |
| 328 | &args->remote_ip, |
| 329 | &args->local_ip, &t->input_sa_index); |
| 330 | |
| 331 | if (rv) |
| 332 | return VNET_API_ERROR_UNIMPLEMENTED; |
| 333 | |
| 334 | ipsec_mk_key (&crypto_key, |
| 335 | args->local_crypto_key, args->local_crypto_key_len); |
| 336 | ipsec_mk_key (&integ_key, |
| 337 | args->local_integ_key, args->local_integ_key_len); |
| 338 | |
| 339 | rv = ipsec_sa_add (ipsec_tun_mk_output_sa_id (dev_instance), |
| 340 | args->local_spi, |
| 341 | IPSEC_PROTOCOL_ESP, |
| 342 | args->crypto_alg, |
| 343 | &crypto_key, |
| 344 | args->integ_alg, |
| 345 | &integ_key, |
| 346 | flags, |
| 347 | args->tx_table_id, |
| 348 | &args->local_ip, |
| 349 | &args->remote_ip, &t->output_sa_index); |
| 350 | |
| 351 | if (rv) |
| 352 | return VNET_API_ERROR_UNIMPLEMENTED; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 353 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 354 | hash_set (im->ipsec_if_pool_index_by_key, key, |
| 355 | t - im->tunnel_interfaces); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 356 | |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 357 | hw_if_index = vnet_register_interface (vnm, ipsec_device_class.index, |
| 358 | t - im->tunnel_interfaces, |
| 359 | ipsec_hw_class.index, |
| 360 | t - im->tunnel_interfaces); |
Matthew Smith | e04d09d | 2017-05-14 21:47:18 -0500 | [diff] [blame] | 361 | |
| 362 | hi = vnet_get_hw_interface (vnm, hw_if_index); |
Kingwel Xie | c69ac31 | 2019-02-04 01:49:29 -0800 | [diff] [blame] | 363 | /* add esp4 as the next-node-index of this tx-node */ |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 364 | |
Matthew Smith | 0e36bbf | 2018-07-05 14:45:58 -0500 | [diff] [blame] | 365 | slot = vlib_node_add_next_with_slot |
Kingwel Xie | c69ac31 | 2019-02-04 01:49:29 -0800 | [diff] [blame] | 366 | (vnm->vlib_main, hi->tx_node_index, im->esp4_encrypt_node_index, 0); |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 367 | |
Kingwel Xie | c69ac31 | 2019-02-04 01:49:29 -0800 | [diff] [blame] | 368 | ASSERT (slot == 0); |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 369 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 370 | t->hw_if_index = hw_if_index; |
Neale Ranns | fe480f6 | 2019-02-28 12:03:58 +0000 | [diff] [blame] | 371 | t->sw_if_index = hi->sw_if_index; |
| 372 | |
Matthew Smith | 537eeec | 2018-04-09 11:49:20 -0500 | [diff] [blame] | 373 | vnet_feature_enable_disable ("interface-output", "ipsec-if-output", |
| 374 | hi->sw_if_index, 1, 0, 0); |
| 375 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 376 | /*1st interface, register protocol */ |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 377 | if (pool_elts (im->tunnel_interfaces) == 1) |
| 378 | ip4_register_protocol (IP_PROTOCOL_IPSEC_ESP, |
| 379 | ipsec_if_input_node.index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 380 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 381 | } |
| 382 | else |
| 383 | { |
| 384 | /* check if exists */ |
| 385 | if (!p) |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 386 | return VNET_API_ERROR_INVALID_VALUE; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 387 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 388 | t = pool_elt_at_index (im->tunnel_interfaces, p[0]); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 389 | hi = vnet_get_hw_interface (vnm, t->hw_if_index); |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 390 | vnet_sw_interface_set_flags (vnm, hi->sw_if_index, 0); /* admin down */ |
Matthew Smith | 537eeec | 2018-04-09 11:49:20 -0500 | [diff] [blame] | 391 | |
| 392 | vnet_feature_enable_disable ("interface-output", "ipsec-if-output", |
| 393 | hi->sw_if_index, 0, 0, 0); |
| 394 | |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 395 | vnet_delete_hw_interface (vnm, t->hw_if_index); |
Matthew Smith | 01034be | 2017-05-16 11:51:18 -0500 | [diff] [blame] | 396 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 397 | hash_unset (im->ipsec_if_pool_index_by_key, key); |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 398 | hash_unset (im->ipsec_if_real_dev_by_show_dev, t->show_instance); |
| 399 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 400 | pool_put (im->tunnel_interfaces, t); |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 401 | |
| 402 | /* delete input and output SA */ |
| 403 | ipsec_sa_del (ipsec_tun_mk_input_sa_id (p[0])); |
| 404 | ipsec_sa_del (ipsec_tun_mk_output_sa_id (p[0])); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 405 | } |
Matthew Smith | e04d09d | 2017-05-14 21:47:18 -0500 | [diff] [blame] | 406 | |
| 407 | if (sw_if_index) |
| 408 | *sw_if_index = hi->sw_if_index; |
| 409 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 410 | return 0; |
| 411 | } |
| 412 | |
| 413 | int |
Matus Fabian | 694265d | 2016-08-10 01:55:36 -0700 | [diff] [blame] | 414 | ipsec_add_del_ipsec_gre_tunnel (vnet_main_t * vnm, |
| 415 | ipsec_add_del_ipsec_gre_tunnel_args_t * args) |
| 416 | { |
| 417 | ipsec_tunnel_if_t *t = 0; |
| 418 | ipsec_main_t *im = &ipsec_main; |
| 419 | uword *p; |
| 420 | ipsec_sa_t *sa; |
| 421 | u64 key; |
| 422 | u32 isa, osa; |
| 423 | |
| 424 | p = hash_get (im->sa_index_by_sa_id, args->local_sa_id); |
| 425 | if (!p) |
| 426 | return VNET_API_ERROR_INVALID_VALUE; |
| 427 | isa = p[0]; |
| 428 | |
| 429 | p = hash_get (im->sa_index_by_sa_id, args->remote_sa_id); |
| 430 | if (!p) |
| 431 | return VNET_API_ERROR_INVALID_VALUE; |
| 432 | osa = p[0]; |
| 433 | sa = pool_elt_at_index (im->sad, p[0]); |
| 434 | |
| 435 | if (sa->is_tunnel) |
Neale Ranns | 7ba8fe2 | 2019-02-11 11:24:07 +0000 | [diff] [blame] | 436 | key = ((u64) sa->tunnel_dst_addr.ip4.as_u32 << 32 | |
| 437 | (u64) clib_host_to_net_u32 (sa->spi)); |
Matus Fabian | 694265d | 2016-08-10 01:55:36 -0700 | [diff] [blame] | 438 | else |
Neale Ranns | 7ba8fe2 | 2019-02-11 11:24:07 +0000 | [diff] [blame] | 439 | key = ((u64) args->remote_ip.as_u32 << 32 | |
| 440 | (u64) clib_host_to_net_u32 (sa->spi)); |
Matus Fabian | 694265d | 2016-08-10 01:55:36 -0700 | [diff] [blame] | 441 | |
| 442 | p = hash_get (im->ipsec_if_pool_index_by_key, key); |
| 443 | |
| 444 | if (args->is_add) |
| 445 | { |
| 446 | /* check if same src/dst pair exists */ |
| 447 | if (p) |
| 448 | return VNET_API_ERROR_INVALID_VALUE; |
| 449 | |
| 450 | pool_get_aligned (im->tunnel_interfaces, t, CLIB_CACHE_LINE_BYTES); |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 451 | clib_memset (t, 0, sizeof (*t)); |
Matus Fabian | 694265d | 2016-08-10 01:55:36 -0700 | [diff] [blame] | 452 | |
| 453 | t->input_sa_index = isa; |
| 454 | t->output_sa_index = osa; |
| 455 | t->hw_if_index = ~0; |
| 456 | hash_set (im->ipsec_if_pool_index_by_key, key, |
| 457 | t - im->tunnel_interfaces); |
| 458 | |
| 459 | /*1st interface, register protocol */ |
| 460 | if (pool_elts (im->tunnel_interfaces) == 1) |
| 461 | ip4_register_protocol (IP_PROTOCOL_IPSEC_ESP, |
| 462 | ipsec_if_input_node.index); |
| 463 | } |
| 464 | else |
| 465 | { |
| 466 | /* check if exists */ |
| 467 | if (!p) |
| 468 | return VNET_API_ERROR_INVALID_VALUE; |
| 469 | |
| 470 | t = pool_elt_at_index (im->tunnel_interfaces, p[0]); |
| 471 | hash_unset (im->ipsec_if_pool_index_by_key, key); |
| 472 | pool_put (im->tunnel_interfaces, t); |
| 473 | } |
| 474 | return 0; |
| 475 | } |
| 476 | |
| 477 | int |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 478 | ipsec_set_interface_key (vnet_main_t * vnm, u32 hw_if_index, |
| 479 | ipsec_if_set_key_type_t type, u8 alg, u8 * key) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 480 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 481 | ipsec_main_t *im = &ipsec_main; |
| 482 | vnet_hw_interface_t *hi; |
| 483 | ipsec_tunnel_if_t *t; |
| 484 | ipsec_sa_t *sa; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 485 | |
| 486 | hi = vnet_get_hw_interface (vnm, hw_if_index); |
| 487 | t = pool_elt_at_index (im->tunnel_interfaces, hi->dev_instance); |
| 488 | |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 489 | if (hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) |
| 490 | return VNET_API_ERROR_SYSCALL_ERROR_1; |
| 491 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 492 | if (type == IPSEC_IF_SET_KEY_TYPE_LOCAL_CRYPTO) |
| 493 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 494 | sa = pool_elt_at_index (im->sad, t->output_sa_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 495 | sa->crypto_alg = alg; |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 496 | ipsec_mk_key (&sa->crypto_key, key, vec_len (key)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 497 | } |
| 498 | else if (type == IPSEC_IF_SET_KEY_TYPE_LOCAL_INTEG) |
| 499 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 500 | sa = pool_elt_at_index (im->sad, t->output_sa_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 501 | sa->integ_alg = alg; |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 502 | ipsec_mk_key (&sa->integ_key, key, vec_len (key)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 503 | } |
| 504 | else if (type == IPSEC_IF_SET_KEY_TYPE_REMOTE_CRYPTO) |
| 505 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 506 | sa = pool_elt_at_index (im->sad, t->input_sa_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 507 | sa->crypto_alg = alg; |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 508 | ipsec_mk_key (&sa->crypto_key, key, vec_len (key)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 509 | } |
| 510 | else if (type == IPSEC_IF_SET_KEY_TYPE_REMOTE_INTEG) |
| 511 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 512 | sa = pool_elt_at_index (im->sad, t->input_sa_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 513 | sa->integ_alg = alg; |
Neale Ranns | 8d7c502 | 2019-02-06 01:41:05 -0800 | [diff] [blame] | 514 | ipsec_mk_key (&sa->integ_key, key, vec_len (key)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 515 | } |
| 516 | else |
| 517 | return VNET_API_ERROR_INVALID_VALUE; |
| 518 | |
| 519 | return 0; |
| 520 | } |
| 521 | |
| 522 | |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 523 | int |
| 524 | ipsec_set_interface_sa (vnet_main_t * vnm, u32 hw_if_index, u32 sa_id, |
| 525 | u8 is_outbound) |
| 526 | { |
| 527 | ipsec_main_t *im = &ipsec_main; |
| 528 | vnet_hw_interface_t *hi; |
| 529 | ipsec_tunnel_if_t *t; |
| 530 | ipsec_sa_t *sa, *old_sa; |
| 531 | u32 sa_index, old_sa_index; |
| 532 | uword *p; |
| 533 | |
| 534 | hi = vnet_get_hw_interface (vnm, hw_if_index); |
| 535 | t = pool_elt_at_index (im->tunnel_interfaces, hi->dev_instance); |
| 536 | |
| 537 | sa_index = ipsec_get_sa_index_by_sa_id (sa_id); |
| 538 | if (sa_index == ~0) |
| 539 | { |
| 540 | clib_warning ("SA with ID %u not found", sa_id); |
| 541 | return VNET_API_ERROR_INVALID_VALUE; |
| 542 | } |
| 543 | |
| 544 | if (ipsec_is_sa_used (sa_index)) |
| 545 | { |
| 546 | clib_warning ("SA with ID %u is already in use", sa_id); |
| 547 | return VNET_API_ERROR_INVALID_VALUE; |
| 548 | } |
| 549 | |
| 550 | sa = pool_elt_at_index (im->sad, sa_index); |
| 551 | if (sa->is_tunnel_ip6) |
| 552 | { |
| 553 | clib_warning ("IPsec interface not supported with IPv6 endpoints"); |
| 554 | return VNET_API_ERROR_UNIMPLEMENTED; |
| 555 | } |
| 556 | |
| 557 | if (!is_outbound) |
| 558 | { |
| 559 | u64 key; |
| 560 | |
| 561 | old_sa_index = t->input_sa_index; |
| 562 | old_sa = pool_elt_at_index (im->sad, old_sa_index); |
| 563 | |
| 564 | /* unset old inbound hash entry. packets should stop arriving */ |
Neale Ranns | 7ba8fe2 | 2019-02-11 11:24:07 +0000 | [diff] [blame] | 565 | key = ((u64) old_sa->tunnel_src_addr.ip4.as_u32 << 32 | |
| 566 | (u64) clib_host_to_net_u32 (old_sa->spi)); |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 567 | p = hash_get (im->ipsec_if_pool_index_by_key, key); |
| 568 | if (p) |
| 569 | hash_unset (im->ipsec_if_pool_index_by_key, key); |
| 570 | |
| 571 | /* set new inbound SA, then set new hash entry */ |
| 572 | t->input_sa_index = sa_index; |
Neale Ranns | 7ba8fe2 | 2019-02-11 11:24:07 +0000 | [diff] [blame] | 573 | key = ((u64) sa->tunnel_src_addr.ip4.as_u32 << 32 | |
| 574 | (u64) clib_host_to_net_u32 (sa->spi)); |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 575 | hash_set (im->ipsec_if_pool_index_by_key, key, hi->dev_instance); |
| 576 | } |
| 577 | else |
| 578 | { |
| 579 | old_sa_index = t->output_sa_index; |
| 580 | old_sa = pool_elt_at_index (im->sad, old_sa_index); |
| 581 | t->output_sa_index = sa_index; |
| 582 | } |
| 583 | |
| 584 | /* remove sa_id to sa_index mapping on old SA */ |
| 585 | if (ipsec_get_sa_index_by_sa_id (old_sa->id) == old_sa_index) |
| 586 | hash_unset (im->sa_index_by_sa_id, old_sa->id); |
| 587 | |
Matthew Smith | 41b25cf | 2018-12-05 14:41:21 -0600 | [diff] [blame] | 588 | if (ipsec_add_del_sa_sess_cb (im, old_sa_index, 0)) |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 589 | { |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 590 | clib_warning ("IPsec backend add/del callback returned error"); |
| 591 | return VNET_API_ERROR_SYSCALL_ERROR_1; |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 592 | } |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 593 | pool_put (im->sad, old_sa); |
| 594 | |
| 595 | return 0; |
| 596 | } |
| 597 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 598 | clib_error_t * |
| 599 | ipsec_tunnel_if_init (vlib_main_t * vm) |
| 600 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 601 | ipsec_main_t *im = &ipsec_main; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 602 | |
| 603 | im->ipsec_if_pool_index_by_key = hash_create (0, sizeof (uword)); |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 604 | im->ipsec_if_real_dev_by_show_dev = hash_create (0, sizeof (uword)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 605 | |
| 606 | return 0; |
| 607 | } |
| 608 | |
| 609 | VLIB_INIT_FUNCTION (ipsec_tunnel_if_init); |
| 610 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 611 | |
| 612 | /* |
| 613 | * fd.io coding-style-patch-verification: ON |
| 614 | * |
| 615 | * Local Variables: |
| 616 | * eval: (c-set-style "gnu") |
| 617 | * End: |
| 618 | */ |