blob: 3d042f0af010b47b92e9b96b6c4238b785ca0206 [file] [log] [blame]
Neale Ranns999c8ee2019-02-01 03:31:24 -08001/*
2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef __IPSEC_IF_H__
16#define __IPSEC_IF_H__
17
18#include <vnet/ipsec/ipsec_sa.h>
19
20typedef enum
21{
22 IPSEC_IF_SET_KEY_TYPE_NONE,
23 IPSEC_IF_SET_KEY_TYPE_LOCAL_CRYPTO,
24 IPSEC_IF_SET_KEY_TYPE_REMOTE_CRYPTO,
25 IPSEC_IF_SET_KEY_TYPE_LOCAL_INTEG,
26 IPSEC_IF_SET_KEY_TYPE_REMOTE_INTEG,
27} ipsec_if_set_key_type_t;
28
29typedef struct
30{
31 /* Required for pool_get_aligned */
32 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
33 u32 input_sa_index;
34 u32 output_sa_index;
35 u32 hw_if_index;
Neale Rannsfe480f62019-02-28 12:03:58 +000036 u32 sw_if_index;
37 vnet_hw_interface_flags_t flags;
Neale Ranns999c8ee2019-02-01 03:31:24 -080038 u32 show_instance;
39} ipsec_tunnel_if_t;
40
41typedef struct
42{
43 u8 is_add;
44 u8 esn;
45 u8 anti_replay;
Neale Ranns8d7c5022019-02-06 01:41:05 -080046 ip46_address_t local_ip, remote_ip;
Neale Ranns999c8ee2019-02-01 03:31:24 -080047 u32 local_spi;
48 u32 remote_spi;
49 ipsec_crypto_alg_t crypto_alg;
50 u8 local_crypto_key_len;
51 u8 local_crypto_key[128];
52 u8 remote_crypto_key_len;
53 u8 remote_crypto_key[128];
54 ipsec_integ_alg_t integ_alg;
55 u8 local_integ_key_len;
56 u8 local_integ_key[128];
57 u8 remote_integ_key_len;
58 u8 remote_integ_key[128];
59 u8 renumber;
60 u32 show_instance;
61 u8 udp_encap;
62 u32 tx_table_id;
63} ipsec_add_del_tunnel_args_t;
64
65typedef struct
66{
67 u8 is_add;
68 u32 local_sa_id;
69 u32 remote_sa_id;
70 ip4_address_t local_ip;
71 ip4_address_t remote_ip;
72} ipsec_add_del_ipsec_gre_tunnel_args_t;
73
74extern int ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm,
75 ipsec_add_del_tunnel_args_t *
76 args, u32 * sw_if_index);
77extern int ipsec_add_del_tunnel_if (ipsec_add_del_tunnel_args_t * args);
78extern int ipsec_add_del_ipsec_gre_tunnel (vnet_main_t * vnm,
79 ipsec_add_del_ipsec_gre_tunnel_args_t
80 * args);
81
82extern int ipsec_set_interface_key (vnet_main_t * vnm, u32 hw_if_index,
83 ipsec_if_set_key_type_t type,
84 u8 alg, u8 * key);
85extern int ipsec_set_interface_sa (vnet_main_t * vnm, u32 hw_if_index,
86 u32 sa_id, u8 is_outbound);
87
88#endif /* __IPSEC_IF_H__ */
89
90/*
91 * fd.io coding-style-patch-verification: ON
92 *
93 * Local Variables:
94 * eval: (c-set-style "gnu")
95 * End:
96 */