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 | |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 73 | static uword |
| 74 | ipsec_if_tx_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, |
| 75 | vlib_frame_t * from_frame) |
| 76 | { |
| 77 | ipsec_main_t *im = &ipsec_main; |
| 78 | vnet_main_t *vnm = im->vnet_main; |
| 79 | vnet_interface_main_t *vim = &vnm->interface_main; |
| 80 | u32 *from, *to_next = 0, next_index; |
| 81 | u32 n_left_from, sw_if_index0, last_sw_if_index = ~0; |
Damjan Marion | 067cd62 | 2018-07-11 12:47:43 +0200 | [diff] [blame] | 82 | u32 thread_index = vm->thread_index; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 83 | u32 n_bytes = 0, n_packets = 0; |
| 84 | |
| 85 | from = vlib_frame_vector_args (from_frame); |
| 86 | n_left_from = from_frame->n_vectors; |
| 87 | next_index = node->cached_next_index; |
| 88 | |
| 89 | while (n_left_from > 0) |
| 90 | { |
| 91 | u32 n_left_to_next; |
| 92 | |
| 93 | vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); |
| 94 | |
| 95 | while (n_left_from > 0 && n_left_to_next > 0) |
| 96 | { |
| 97 | u32 bi0, next0, len0; |
| 98 | vlib_buffer_t *b0; |
| 99 | ipsec_tunnel_if_t *t0; |
| 100 | vnet_hw_interface_t *hi0; |
| 101 | |
| 102 | bi0 = to_next[0] = from[0]; |
| 103 | from += 1; |
| 104 | n_left_from -= 1; |
| 105 | to_next += 1; |
| 106 | n_left_to_next -= 1; |
| 107 | b0 = vlib_get_buffer (vm, bi0); |
| 108 | sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX]; |
| 109 | hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0); |
| 110 | t0 = pool_elt_at_index (im->tunnel_interfaces, hi0->dev_instance); |
| 111 | vnet_buffer (b0)->ipsec.sad_index = t0->output_sa_index; |
Klement Sekera | be5a5dd | 2018-10-09 16:05:48 +0200 | [diff] [blame] | 112 | next0 = IPSEC_OUTPUT_NEXT_ESP4_ENCRYPT; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 113 | |
| 114 | len0 = vlib_buffer_length_in_chain (vm, b0); |
| 115 | |
| 116 | if (PREDICT_TRUE (sw_if_index0 == last_sw_if_index)) |
| 117 | { |
| 118 | n_packets++; |
| 119 | n_bytes += len0; |
| 120 | } |
| 121 | else |
| 122 | { |
| 123 | vlib_increment_combined_counter (vim->combined_sw_if_counters + |
| 124 | VNET_INTERFACE_COUNTER_TX, |
| 125 | thread_index, sw_if_index0, |
| 126 | n_packets, n_bytes); |
| 127 | last_sw_if_index = sw_if_index0; |
| 128 | n_packets = 1; |
| 129 | n_bytes = len0; |
| 130 | } |
| 131 | |
| 132 | if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED)) |
| 133 | { |
| 134 | ipsec_if_tx_trace_t *tr = |
| 135 | vlib_add_trace (vm, node, b0, sizeof (*tr)); |
| 136 | ipsec_sa_t *sa0 = |
| 137 | pool_elt_at_index (im->sad, t0->output_sa_index); |
| 138 | tr->spi = sa0->spi; |
| 139 | tr->seq = sa0->seq; |
| 140 | } |
| 141 | |
| 142 | vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, |
| 143 | n_left_to_next, bi0, next0); |
| 144 | } |
| 145 | vlib_put_next_frame (vm, node, next_index, n_left_to_next); |
| 146 | } |
| 147 | |
| 148 | if (last_sw_if_index != ~0) |
| 149 | { |
| 150 | vlib_increment_combined_counter (vim->combined_sw_if_counters + |
| 151 | VNET_INTERFACE_COUNTER_TX, |
| 152 | thread_index, |
| 153 | last_sw_if_index, n_packets, n_bytes); |
| 154 | } |
| 155 | |
| 156 | return from_frame->n_vectors; |
| 157 | } |
| 158 | |
| 159 | |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 160 | static clib_error_t * |
| 161 | ipsec_admin_up_down_function (vnet_main_t * vnm, u32 hw_if_index, u32 flags) |
| 162 | { |
| 163 | ipsec_main_t *im = &ipsec_main; |
| 164 | clib_error_t *err = 0; |
| 165 | ipsec_tunnel_if_t *t; |
| 166 | vnet_hw_interface_t *hi; |
| 167 | ipsec_sa_t *sa; |
| 168 | |
| 169 | hi = vnet_get_hw_interface (vnm, hw_if_index); |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 170 | t = pool_elt_at_index (im->tunnel_interfaces, hi->hw_instance); |
| 171 | |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 172 | if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) |
| 173 | { |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 174 | sa = pool_elt_at_index (im->sad, t->input_sa_index); |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 175 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 176 | err = ipsec_check_support_cb (im, sa); |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 177 | if (err) |
| 178 | return err; |
| 179 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 180 | err = ipsec_add_del_sa_sess_cb (im, t->input_sa_index, 1); |
| 181 | if (err) |
| 182 | return err; |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 183 | |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 184 | sa = pool_elt_at_index (im->sad, t->output_sa_index); |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 185 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 186 | err = ipsec_check_support_cb (im, sa); |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 187 | if (err) |
| 188 | return err; |
| 189 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 190 | err = ipsec_add_del_sa_sess_cb (im, t->output_sa_index, 1); |
| 191 | if (err) |
| 192 | return err; |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 193 | |
Radu Nicolau | 3f90339 | 2017-01-30 14:33:39 +0000 | [diff] [blame] | 194 | vnet_hw_interface_set_flags (vnm, hw_if_index, |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 195 | VNET_HW_INTERFACE_FLAG_LINK_UP); |
| 196 | } |
| 197 | else |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 198 | { |
| 199 | vnet_hw_interface_set_flags (vnm, hw_if_index, 0 /* down */ ); |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 200 | sa = pool_elt_at_index (im->sad, t->input_sa_index); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 201 | err = ipsec_add_del_sa_sess_cb (im, t->input_sa_index, 0); |
| 202 | if (err) |
| 203 | return err; |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 204 | sa = pool_elt_at_index (im->sad, t->output_sa_index); |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 205 | err = ipsec_add_del_sa_sess_cb (im, t->output_sa_index, 0); |
| 206 | if (err) |
| 207 | return err; |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 208 | } |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 209 | |
| 210 | return /* no error */ 0; |
| 211 | } |
| 212 | |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 213 | |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 214 | /* *INDENT-OFF* */ |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 215 | VNET_DEVICE_CLASS (ipsec_device_class, static) = |
| 216 | { |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 217 | .name = "IPSec", |
| 218 | .format_device_name = format_ipsec_name, |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 219 | .format_tx_trace = format_ipsec_if_tx_trace, |
| 220 | .tx_function = ipsec_if_tx_node_fn, |
| 221 | .tx_function_n_errors = IPSEC_IF_TX_N_ERROR, |
| 222 | .tx_function_error_strings = ipsec_if_tx_error_strings, |
Sergio Gonzalez Monroy | d04b60b | 2017-01-20 15:35:23 +0000 | [diff] [blame] | 223 | .admin_up_down_function = ipsec_admin_up_down_function, |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 224 | }; |
| 225 | /* *INDENT-ON* */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 226 | |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 227 | /* *INDENT-OFF* */ |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 228 | VNET_HW_INTERFACE_CLASS (ipsec_hw_class) = |
| 229 | { |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 230 | .name = "IPSec", |
| 231 | .build_rewrite = default_build_rewrite, |
Matthew Smith | 922549a | 2017-05-24 16:18:27 -0500 | [diff] [blame] | 232 | .flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P, |
Neale Ranns | b80c536 | 2016-10-08 13:03:40 +0100 | [diff] [blame] | 233 | }; |
| 234 | /* *INDENT-ON* */ |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 235 | |
| 236 | static int |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 237 | 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] | 238 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 239 | vnet_main_t *vnm = vnet_get_main (); |
Damjan Marion | 586afd7 | 2017-04-05 19:18:20 +0200 | [diff] [blame] | 240 | ASSERT (vlib_get_thread_index () == 0); |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 241 | |
Matthew Smith | e04d09d | 2017-05-14 21:47:18 -0500 | [diff] [blame] | 242 | return ipsec_add_del_tunnel_if_internal (vnm, a, NULL); |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | int |
| 246 | ipsec_add_del_tunnel_if (ipsec_add_del_tunnel_args_t * args) |
| 247 | { |
| 248 | 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] | 249 | (u8 *) args, sizeof (*args)); |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 250 | return 0; |
| 251 | } |
| 252 | |
| 253 | int |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 254 | ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm, |
Matthew Smith | e04d09d | 2017-05-14 21:47:18 -0500 | [diff] [blame] | 255 | ipsec_add_del_tunnel_args_t * args, |
| 256 | u32 * sw_if_index) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 257 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 258 | ipsec_tunnel_if_t *t; |
| 259 | ipsec_main_t *im = &ipsec_main; |
Matthew Smith | e04d09d | 2017-05-14 21:47:18 -0500 | [diff] [blame] | 260 | vnet_hw_interface_t *hi = NULL; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 261 | u32 hw_if_index = ~0; |
| 262 | uword *p; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 263 | ipsec_sa_t *sa; |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 264 | u32 dev_instance; |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 265 | u32 slot; |
Pierre Pfister | 4c422f9 | 2018-12-10 11:19:08 +0100 | [diff] [blame] | 266 | u32 tx_fib_index = ~0; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 267 | |
| 268 | u64 key = (u64) args->remote_ip.as_u32 << 32 | (u64) args->remote_spi; |
| 269 | p = hash_get (im->ipsec_if_pool_index_by_key, key); |
| 270 | |
| 271 | if (args->is_add) |
| 272 | { |
| 273 | /* check if same src/dst pair exists */ |
| 274 | if (p) |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 275 | return VNET_API_ERROR_INVALID_VALUE; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 276 | |
Pierre Pfister | 4c422f9 | 2018-12-10 11:19:08 +0100 | [diff] [blame] | 277 | tx_fib_index = fib_table_find (FIB_PROTOCOL_IP4, args->tx_table_id); |
| 278 | if (tx_fib_index == ~((u32) 0)) |
| 279 | return VNET_API_ERROR_NO_SUCH_FIB; |
| 280 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 281 | pool_get_aligned (im->tunnel_interfaces, t, CLIB_CACHE_LINE_BYTES); |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 282 | clib_memset (t, 0, sizeof (*t)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 283 | |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 284 | dev_instance = t - im->tunnel_interfaces; |
| 285 | if (args->renumber) |
| 286 | t->show_instance = args->show_instance; |
| 287 | else |
| 288 | t->show_instance = dev_instance; |
| 289 | |
| 290 | if (hash_get (im->ipsec_if_real_dev_by_show_dev, t->show_instance)) |
| 291 | { |
| 292 | pool_put (im->tunnel_interfaces, t); |
| 293 | return VNET_API_ERROR_INSTANCE_IN_USE; |
| 294 | } |
| 295 | |
| 296 | hash_set (im->ipsec_if_real_dev_by_show_dev, t->show_instance, |
| 297 | dev_instance); |
| 298 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 299 | pool_get (im->sad, sa); |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 300 | clib_memset (sa, 0, sizeof (*sa)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 301 | t->input_sa_index = sa - im->sad; |
| 302 | sa->spi = args->remote_spi; |
| 303 | sa->tunnel_src_addr.ip4.as_u32 = args->remote_ip.as_u32; |
| 304 | sa->tunnel_dst_addr.ip4.as_u32 = args->local_ip.as_u32; |
| 305 | sa->is_tunnel = 1; |
| 306 | sa->use_esn = args->esn; |
| 307 | sa->use_anti_replay = args->anti_replay; |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 308 | sa->integ_alg = args->integ_alg; |
Radu Nicolau | 717de09 | 2018-08-03 10:37:24 +0100 | [diff] [blame] | 309 | sa->udp_encap = args->udp_encap; |
Pierre Pfister | 4c422f9 | 2018-12-10 11:19:08 +0100 | [diff] [blame] | 310 | sa->tx_fib_index = ~((u32) 0); /* Not used, but set for troubleshooting */ |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 311 | if (args->remote_integ_key_len <= sizeof (args->remote_integ_key)) |
| 312 | { |
| 313 | sa->integ_key_len = args->remote_integ_key_len; |
| 314 | clib_memcpy (sa->integ_key, args->remote_integ_key, |
| 315 | args->remote_integ_key_len); |
| 316 | } |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 317 | sa->crypto_alg = args->crypto_alg; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 318 | if (args->remote_crypto_key_len <= sizeof (args->remote_crypto_key)) |
| 319 | { |
| 320 | sa->crypto_key_len = args->remote_crypto_key_len; |
| 321 | clib_memcpy (sa->crypto_key, args->remote_crypto_key, |
| 322 | args->remote_crypto_key_len); |
| 323 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 324 | |
| 325 | pool_get (im->sad, sa); |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 326 | clib_memset (sa, 0, sizeof (*sa)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 327 | t->output_sa_index = sa - im->sad; |
| 328 | sa->spi = args->local_spi; |
| 329 | sa->tunnel_src_addr.ip4.as_u32 = args->local_ip.as_u32; |
| 330 | sa->tunnel_dst_addr.ip4.as_u32 = args->remote_ip.as_u32; |
| 331 | sa->is_tunnel = 1; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 332 | sa->use_esn = args->esn; |
| 333 | sa->use_anti_replay = args->anti_replay; |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 334 | sa->integ_alg = args->integ_alg; |
Radu Nicolau | 717de09 | 2018-08-03 10:37:24 +0100 | [diff] [blame] | 335 | sa->udp_encap = args->udp_encap; |
Pierre Pfister | 4c422f9 | 2018-12-10 11:19:08 +0100 | [diff] [blame] | 336 | sa->tx_fib_index = tx_fib_index; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 337 | if (args->local_integ_key_len <= sizeof (args->local_integ_key)) |
| 338 | { |
| 339 | sa->integ_key_len = args->local_integ_key_len; |
| 340 | clib_memcpy (sa->integ_key, args->local_integ_key, |
| 341 | args->local_integ_key_len); |
| 342 | } |
Matthew Smith | 2838a23 | 2016-06-21 16:05:09 -0500 | [diff] [blame] | 343 | sa->crypto_alg = args->crypto_alg; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 344 | if (args->local_crypto_key_len <= sizeof (args->local_crypto_key)) |
| 345 | { |
| 346 | sa->crypto_key_len = args->local_crypto_key_len; |
| 347 | clib_memcpy (sa->crypto_key, args->local_crypto_key, |
| 348 | args->local_crypto_key_len); |
| 349 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 350 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 351 | hash_set (im->ipsec_if_pool_index_by_key, key, |
| 352 | t - im->tunnel_interfaces); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 353 | |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 354 | hw_if_index = vnet_register_interface (vnm, ipsec_device_class.index, |
| 355 | t - im->tunnel_interfaces, |
| 356 | ipsec_hw_class.index, |
| 357 | t - im->tunnel_interfaces); |
Matthew Smith | e04d09d | 2017-05-14 21:47:18 -0500 | [diff] [blame] | 358 | |
| 359 | hi = vnet_get_hw_interface (vnm, hw_if_index); |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 360 | |
Matthew Smith | 0e36bbf | 2018-07-05 14:45:58 -0500 | [diff] [blame] | 361 | slot = vlib_node_add_next_with_slot |
Klement Sekera | be5a5dd | 2018-10-09 16:05:48 +0200 | [diff] [blame] | 362 | (vnm->vlib_main, hi->tx_node_index, im->esp4_encrypt_node_index, |
| 363 | IPSEC_OUTPUT_NEXT_ESP4_ENCRYPT); |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 364 | |
Klement Sekera | be5a5dd | 2018-10-09 16:05:48 +0200 | [diff] [blame] | 365 | ASSERT (slot == IPSEC_OUTPUT_NEXT_ESP4_ENCRYPT); |
Klement Sekera | 31da2e3 | 2018-06-24 22:49:55 +0200 | [diff] [blame] | 366 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 367 | t->hw_if_index = hw_if_index; |
| 368 | |
Matthew Smith | 537eeec | 2018-04-09 11:49:20 -0500 | [diff] [blame] | 369 | vnet_feature_enable_disable ("interface-output", "ipsec-if-output", |
| 370 | hi->sw_if_index, 1, 0, 0); |
| 371 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 372 | /*1st interface, register protocol */ |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 373 | if (pool_elts (im->tunnel_interfaces) == 1) |
| 374 | ip4_register_protocol (IP_PROTOCOL_IPSEC_ESP, |
| 375 | ipsec_if_input_node.index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 376 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 377 | } |
| 378 | else |
| 379 | { |
| 380 | /* check if exists */ |
| 381 | if (!p) |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 382 | return VNET_API_ERROR_INVALID_VALUE; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 383 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 384 | t = pool_elt_at_index (im->tunnel_interfaces, p[0]); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 385 | hi = vnet_get_hw_interface (vnm, t->hw_if_index); |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 386 | 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] | 387 | |
| 388 | vnet_feature_enable_disable ("interface-output", "ipsec-if-output", |
| 389 | hi->sw_if_index, 0, 0, 0); |
| 390 | |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 391 | vnet_delete_hw_interface (vnm, t->hw_if_index); |
Matthew Smith | 01034be | 2017-05-16 11:51:18 -0500 | [diff] [blame] | 392 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 393 | /* delete input and output SA */ |
Sergio Gonzalez Monroy | a10f62b | 2016-11-25 13:36:12 +0000 | [diff] [blame] | 394 | |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 395 | sa = pool_elt_at_index (im->sad, t->input_sa_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 396 | pool_put (im->sad, sa); |
Sergio Gonzalez Monroy | a10f62b | 2016-11-25 13:36:12 +0000 | [diff] [blame] | 397 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 398 | sa = pool_elt_at_index (im->sad, t->output_sa_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 399 | pool_put (im->sad, sa); |
| 400 | |
| 401 | hash_unset (im->ipsec_if_pool_index_by_key, key); |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 402 | hash_unset (im->ipsec_if_real_dev_by_show_dev, t->show_instance); |
| 403 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 404 | pool_put (im->tunnel_interfaces, t); |
| 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) |
| 436 | key = (u64) sa->tunnel_dst_addr.ip4.as_u32 << 32 | (u64) sa->spi; |
| 437 | else |
| 438 | key = (u64) args->remote_ip.as_u32 << 32 | (u64) sa->spi; |
| 439 | |
| 440 | p = hash_get (im->ipsec_if_pool_index_by_key, key); |
| 441 | |
| 442 | if (args->is_add) |
| 443 | { |
| 444 | /* check if same src/dst pair exists */ |
| 445 | if (p) |
| 446 | return VNET_API_ERROR_INVALID_VALUE; |
| 447 | |
| 448 | pool_get_aligned (im->tunnel_interfaces, t, CLIB_CACHE_LINE_BYTES); |
Dave Barach | b7b9299 | 2018-10-17 10:38:51 -0400 | [diff] [blame] | 449 | clib_memset (t, 0, sizeof (*t)); |
Matus Fabian | 694265d | 2016-08-10 01:55:36 -0700 | [diff] [blame] | 450 | |
| 451 | t->input_sa_index = isa; |
| 452 | t->output_sa_index = osa; |
| 453 | t->hw_if_index = ~0; |
| 454 | hash_set (im->ipsec_if_pool_index_by_key, key, |
| 455 | t - im->tunnel_interfaces); |
| 456 | |
| 457 | /*1st interface, register protocol */ |
| 458 | if (pool_elts (im->tunnel_interfaces) == 1) |
| 459 | ip4_register_protocol (IP_PROTOCOL_IPSEC_ESP, |
| 460 | ipsec_if_input_node.index); |
| 461 | } |
| 462 | else |
| 463 | { |
| 464 | /* check if exists */ |
| 465 | if (!p) |
| 466 | return VNET_API_ERROR_INVALID_VALUE; |
| 467 | |
| 468 | t = pool_elt_at_index (im->tunnel_interfaces, p[0]); |
| 469 | hash_unset (im->ipsec_if_pool_index_by_key, key); |
| 470 | pool_put (im->tunnel_interfaces, t); |
| 471 | } |
| 472 | return 0; |
| 473 | } |
| 474 | |
| 475 | int |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 476 | ipsec_set_interface_key (vnet_main_t * vnm, u32 hw_if_index, |
| 477 | ipsec_if_set_key_type_t type, u8 alg, u8 * key) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 478 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 479 | ipsec_main_t *im = &ipsec_main; |
| 480 | vnet_hw_interface_t *hi; |
| 481 | ipsec_tunnel_if_t *t; |
| 482 | ipsec_sa_t *sa; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 483 | |
| 484 | hi = vnet_get_hw_interface (vnm, hw_if_index); |
| 485 | t = pool_elt_at_index (im->tunnel_interfaces, hi->dev_instance); |
| 486 | |
Sergio Gonzalez Monroy | db93cd9 | 2017-08-26 15:22:05 +0100 | [diff] [blame] | 487 | if (hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) |
| 488 | return VNET_API_ERROR_SYSCALL_ERROR_1; |
| 489 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 490 | if (type == IPSEC_IF_SET_KEY_TYPE_LOCAL_CRYPTO) |
| 491 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 492 | sa = pool_elt_at_index (im->sad, t->output_sa_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 493 | sa->crypto_alg = alg; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 494 | sa->crypto_key_len = vec_len (key); |
| 495 | clib_memcpy (sa->crypto_key, key, vec_len (key)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 496 | } |
| 497 | else if (type == IPSEC_IF_SET_KEY_TYPE_LOCAL_INTEG) |
| 498 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 499 | sa = pool_elt_at_index (im->sad, t->output_sa_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 500 | sa->integ_alg = alg; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 501 | sa->integ_key_len = vec_len (key); |
| 502 | clib_memcpy (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; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 508 | sa->crypto_key_len = vec_len (key); |
| 509 | clib_memcpy (sa->crypto_key, key, vec_len (key)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 510 | } |
| 511 | else if (type == IPSEC_IF_SET_KEY_TYPE_REMOTE_INTEG) |
| 512 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 513 | sa = pool_elt_at_index (im->sad, t->input_sa_index); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 514 | sa->integ_alg = alg; |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 515 | sa->integ_key_len = vec_len (key); |
| 516 | clib_memcpy (sa->integ_key, key, vec_len (key)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 517 | } |
| 518 | else |
| 519 | return VNET_API_ERROR_INVALID_VALUE; |
| 520 | |
| 521 | return 0; |
| 522 | } |
| 523 | |
| 524 | |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 525 | int |
| 526 | ipsec_set_interface_sa (vnet_main_t * vnm, u32 hw_if_index, u32 sa_id, |
| 527 | u8 is_outbound) |
| 528 | { |
| 529 | ipsec_main_t *im = &ipsec_main; |
| 530 | vnet_hw_interface_t *hi; |
| 531 | ipsec_tunnel_if_t *t; |
| 532 | ipsec_sa_t *sa, *old_sa; |
| 533 | u32 sa_index, old_sa_index; |
| 534 | uword *p; |
| 535 | |
| 536 | hi = vnet_get_hw_interface (vnm, hw_if_index); |
| 537 | t = pool_elt_at_index (im->tunnel_interfaces, hi->dev_instance); |
| 538 | |
| 539 | sa_index = ipsec_get_sa_index_by_sa_id (sa_id); |
| 540 | if (sa_index == ~0) |
| 541 | { |
| 542 | clib_warning ("SA with ID %u not found", sa_id); |
| 543 | return VNET_API_ERROR_INVALID_VALUE; |
| 544 | } |
| 545 | |
| 546 | if (ipsec_is_sa_used (sa_index)) |
| 547 | { |
| 548 | clib_warning ("SA with ID %u is already in use", sa_id); |
| 549 | return VNET_API_ERROR_INVALID_VALUE; |
| 550 | } |
| 551 | |
| 552 | sa = pool_elt_at_index (im->sad, sa_index); |
| 553 | if (sa->is_tunnel_ip6) |
| 554 | { |
| 555 | clib_warning ("IPsec interface not supported with IPv6 endpoints"); |
| 556 | return VNET_API_ERROR_UNIMPLEMENTED; |
| 557 | } |
| 558 | |
| 559 | if (!is_outbound) |
| 560 | { |
| 561 | u64 key; |
| 562 | |
| 563 | old_sa_index = t->input_sa_index; |
| 564 | old_sa = pool_elt_at_index (im->sad, old_sa_index); |
| 565 | |
| 566 | /* unset old inbound hash entry. packets should stop arriving */ |
| 567 | key = |
Matthew Smith | 8909558 | 2017-11-06 12:12:13 -0600 | [diff] [blame] | 568 | (u64) old_sa->tunnel_src_addr.ip4.as_u32 << 32 | (u64) old_sa->spi; |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 569 | p = hash_get (im->ipsec_if_pool_index_by_key, key); |
| 570 | if (p) |
| 571 | hash_unset (im->ipsec_if_pool_index_by_key, key); |
| 572 | |
| 573 | /* set new inbound SA, then set new hash entry */ |
| 574 | t->input_sa_index = sa_index; |
Matthew Smith | 8909558 | 2017-11-06 12:12:13 -0600 | [diff] [blame] | 575 | key = (u64) sa->tunnel_src_addr.ip4.as_u32 << 32 | (u64) sa->spi; |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 576 | hash_set (im->ipsec_if_pool_index_by_key, key, hi->dev_instance); |
| 577 | } |
| 578 | else |
| 579 | { |
| 580 | old_sa_index = t->output_sa_index; |
| 581 | old_sa = pool_elt_at_index (im->sad, old_sa_index); |
| 582 | t->output_sa_index = sa_index; |
| 583 | } |
| 584 | |
| 585 | /* remove sa_id to sa_index mapping on old SA */ |
| 586 | if (ipsec_get_sa_index_by_sa_id (old_sa->id) == old_sa_index) |
| 587 | hash_unset (im->sa_index_by_sa_id, old_sa->id); |
| 588 | |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 589 | if (!ipsec_add_del_sa_sess_cb (im, old_sa_index, 0)) |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 590 | { |
Klement Sekera | b4d3053 | 2018-11-08 13:00:02 +0100 | [diff] [blame] | 591 | clib_warning ("IPsec backend add/del callback returned error"); |
| 592 | return VNET_API_ERROR_SYSCALL_ERROR_1; |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 593 | } |
Matthew Smith | ca514fd | 2017-10-12 12:06:59 -0500 | [diff] [blame] | 594 | pool_put (im->sad, old_sa); |
| 595 | |
| 596 | return 0; |
| 597 | } |
| 598 | |
| 599 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 600 | clib_error_t * |
| 601 | ipsec_tunnel_if_init (vlib_main_t * vm) |
| 602 | { |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 603 | ipsec_main_t *im = &ipsec_main; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 604 | |
| 605 | im->ipsec_if_pool_index_by_key = hash_create (0, sizeof (uword)); |
Matthew Smith | 8e1039a | 2018-04-12 07:32:56 -0500 | [diff] [blame] | 606 | 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] | 607 | |
| 608 | return 0; |
| 609 | } |
| 610 | |
| 611 | VLIB_INIT_FUNCTION (ipsec_tunnel_if_init); |
| 612 | |
Keith Burns (alagalah) | 166a9d4 | 2016-08-06 11:00:56 -0700 | [diff] [blame] | 613 | |
| 614 | /* |
| 615 | * fd.io coding-style-patch-verification: ON |
| 616 | * |
| 617 | * Local Variables: |
| 618 | * eval: (c-set-style "gnu") |
| 619 | * End: |
| 620 | */ |