LCOV - code coverage report
Current view: top level - vnet/ipsec - ipsec_punt.c (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 13 14 92.9 %
Date: 2023-10-26 01:39:38 Functions: 4 4 100.0 %

          Line data    Source code
       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>
      20             : #include <vnet/ipsec/ipsec_tun.h>
      21             : #include <vnet/ip/punt.h>
      22             : 
      23             : static vlib_punt_hdl_t punt_hdl;
      24             : 
      25             : vlib_punt_reason_t ipsec_punt_reason[IPSEC_PUNT_N_REASONS];
      26             : 
      27             : static void
      28          47 : ipsec_punt_interested_listener (vlib_enable_or_disable_t action, void *data)
      29             : {
      30          47 :   if (action == VLIB_ENABLE)
      31             :     {
      32          28 :       ipsec_tun_register_nodes (AF_IP4);
      33          28 :       ipsec_tun_register_nodes (AF_IP6);
      34             :     }
      35             :   else
      36             :     {
      37          19 :       ipsec_tun_unregister_nodes (AF_IP4);
      38          19 :       ipsec_tun_unregister_nodes (AF_IP6);
      39             :     }
      40          47 : }
      41             : 
      42             : static clib_error_t *
      43         575 : ipsec_punt_init (vlib_main_t * vm)
      44             : {
      45             :   clib_error_t *error;
      46             : 
      47         575 :   if ((error = vlib_call_init_function (vm, punt_init)))
      48           0 :     return (error);
      49             : 
      50         575 :   punt_hdl = vlib_punt_client_register ("ipsec");
      51             : 
      52             : #define _(s, v, f)                                                            \
      53             :   vlib_punt_reason_alloc (punt_hdl, v, ipsec_punt_interested_listener, NULL,  \
      54             :                           &ipsec_punt_reason[IPSEC_PUNT_##s],                 \
      55             :                           VNET_PUNT_REASON_F_##f,                             \
      56             :                           format_vnet_punt_reason_flags);
      57         575 :   foreach_ipsec_punt_reason
      58             : #undef _
      59         575 :     return (error);
      60             : }
      61             : 
      62       52991 : VLIB_INIT_FUNCTION (ipsec_punt_init);
      63             : 
      64             : 
      65             : /*
      66             :  * fd.io coding-style-patch-verification: ON
      67             :  *
      68             :  * Local Variables:
      69             :  * eval: (c-set-style "gnu")
      70             :  * End:
      71             :  */

Generated by: LCOV version 1.14