Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * esp_decrypt.c : IPSec ESP decrypt 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/ipsec/ipsec.h> |
| 19 | #include <vnet/ipsec/ipsec_punt.h> |
Neale Ranns | 8d6d74c | 2020-02-20 09:45:16 +0000 | [diff] [blame] | 20 | #include <vnet/ipsec/ipsec_tun.h> |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 21 | |
| 22 | static vlib_punt_hdl_t punt_hdl; |
| 23 | |
| 24 | vlib_punt_reason_t ipsec_punt_reason[IPSEC_PUNT_N_REASONS]; |
| 25 | |
Neale Ranns | 8d6d74c | 2020-02-20 09:45:16 +0000 | [diff] [blame] | 26 | static void |
| 27 | ipsec_punt_interested_listener (vlib_enable_or_disable_t action, void *data) |
| 28 | { |
| 29 | if (action == VLIB_ENABLE) |
| 30 | { |
| 31 | ipsec_tun_register_nodes (AF_IP4); |
| 32 | ipsec_tun_register_nodes (AF_IP6); |
| 33 | } |
| 34 | else |
| 35 | { |
| 36 | ipsec_tun_unregister_nodes (AF_IP4); |
| 37 | ipsec_tun_unregister_nodes (AF_IP6); |
| 38 | } |
| 39 | } |
| 40 | |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 41 | static clib_error_t * |
| 42 | ipsec_punt_init (vlib_main_t * vm) |
| 43 | { |
| 44 | clib_error_t *error; |
| 45 | |
| 46 | if ((error = vlib_call_init_function (vm, punt_init))) |
| 47 | return (error); |
| 48 | |
| 49 | punt_hdl = vlib_punt_client_register ("ipsec"); |
| 50 | |
| 51 | #define _(s,v) vlib_punt_reason_alloc (punt_hdl, v, \ |
Neale Ranns | 8d6d74c | 2020-02-20 09:45:16 +0000 | [diff] [blame] | 52 | ipsec_punt_interested_listener, \ |
| 53 | NULL, \ |
Neale Ranns | b71fa75 | 2019-04-04 12:43:36 +0000 | [diff] [blame] | 54 | &ipsec_punt_reason[IPSEC_PUNT_##s]); |
| 55 | foreach_ipsec_punt_reason |
| 56 | #undef _ |
| 57 | return (error); |
| 58 | } |
| 59 | |
| 60 | VLIB_INIT_FUNCTION (ipsec_punt_init); |
| 61 | |
| 62 | |
| 63 | /* |
| 64 | * fd.io coding-style-patch-verification: ON |
| 65 | * |
| 66 | * Local Variables: |
| 67 | * eval: (c-set-style "gnu") |
| 68 | * End: |
| 69 | */ |