blob: 6d34d056003eea050e63055c4448b4f20f7ced63 [file] [log] [blame]
Neale Ranns17dcec02019-01-09 21:22:20 -08001/* Hey Emacs use -*- mode: C -*- */
Pavel Kotucek9c7ef032016-12-21 07:46:45 +01002/*
3 * Copyright (c) 2015-2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Neale Ranns17dcec02019-01-09 21:22:20 -080017option version = "3.0.0";
18
Prashant Maheshwaridbf68c92019-11-14 12:42:59 +053019import "vnet/ipsec/ipsec_types.api";
Neale Rannsc87b66c2019-02-07 07:26:12 -080020import "vnet/interface_types.api";
Dave Barach0d056e52017-09-28 15:11:16 -040021
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010022/** \brief IPsec: Add/delete Security Policy Database
23 @param client_index - opaque cookie to identify the sender
24 @param context - sender context, to match reply w/ request
25 @param is_add - add SPD if non-zero, else delete
26 @param spd_id - SPD instance id (control plane allocated)
27*/
28
Dave Barach11b8dbf2017-04-24 10:46:54 -040029autoreply define ipsec_spd_add_del
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010030{
31 u32 client_index;
32 u32 context;
33 u8 is_add;
34 u32 spd_id;
35};
36
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010037/** \brief IPsec: Add/delete SPD from interface
38
39 @param client_index - opaque cookie to identify the sender
40 @param context - sender context, to match reply w/ request
41 @param is_add - add security mode if non-zero, else delete
42 @param sw_if_index - index of the interface
43 @param spd_id - SPD instance id to use for lookups
44*/
45
46
Dave Barach11b8dbf2017-04-24 10:46:54 -040047autoreply define ipsec_interface_add_del_spd
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010048{
49 u32 client_index;
50 u32 context;
51
52 u8 is_add;
53 u32 sw_if_index;
54 u32 spd_id;
55};
56
Neale Ranns17dcec02019-01-09 21:22:20 -080057
58enum ipsec_spd_action
59{
60 /* bypass - no IPsec processing */
61 IPSEC_API_SPD_ACTION_BYPASS = 0,
62 /* discard - discard packet with ICMP processing */
63 IPSEC_API_SPD_ACTION_DISCARD,
64 /* resolve - send request to control plane for SA resolving */
65 IPSEC_API_SPD_ACTION_RESOLVE,
66 /* protect - apply IPsec policy using following parameters */
67 IPSEC_API_SPD_ACTION_PROTECT,
68};
69
70/** \brief IPsec: Security Policy Database entry
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010071
72 See RFC 4301, 4.4.1.1 on how to match packet to selectors
73
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010074 @param spd_id - SPD instance id (control plane allocated)
75 @param priority - priority of SPD entry (non-unique value). Used to order SPD matching - higher priorities match before lower
76 @param is_outbound - entry applies to outbound traffic if non-zero, otherwise applies to inbound traffic
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010077 @param remote_address_start - start of remote address range to match
78 @param remote_address_stop - end of remote address range to match
79 @param local_address_start - start of local address range to match
80 @param local_address_stop - end of local address range to match
Neale Ranns17dcec02019-01-09 21:22:20 -080081 @param protocol - protocol type to match [0 means any] otherwise IANA value
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010082 @param remote_port_start - start of remote port range to match ...
83 @param remote_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
84 @param local_port_start - start of local port range to match ...
85 @param local_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
Neale Ranns17dcec02019-01-09 21:22:20 -080086 @param policy - action to perform on match
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010087 @param sa_id - SAD instance id (control plane allocated)
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010088*/
Neale Ranns17dcec02019-01-09 21:22:20 -080089typedef ipsec_spd_entry
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010090{
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010091 u32 spd_id;
92 i32 priority;
93 u8 is_outbound;
94
Neale Ranns17dcec02019-01-09 21:22:20 -080095 u32 sa_id;
96 vl_api_ipsec_spd_action_t policy;
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010097 u8 protocol;
98
Neale Ranns17dcec02019-01-09 21:22:20 -080099 // Selector
Neale Ranns17dcec02019-01-09 21:22:20 -0800100 vl_api_address_t remote_address_start;
101 vl_api_address_t remote_address_stop;
102 vl_api_address_t local_address_start;
103 vl_api_address_t local_address_stop;
104
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100105 u16 remote_port_start;
106 u16 remote_port_stop;
107 u16 local_port_start;
108 u16 local_port_stop;
Neale Ranns17dcec02019-01-09 21:22:20 -0800109};
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100110
Neale Ranns17dcec02019-01-09 21:22:20 -0800111/** \brief IPsec: Add/delete Security Policy Database entry
112
113 @param client_index - opaque cookie to identify the sender
114 @param context - sender context, to match reply w/ request
115 @param is_add - add SPD if non-zero, else delete
116 @param entry - Description of the entry to add/dell
117*/
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800118define ipsec_spd_entry_add_del
Neale Ranns17dcec02019-01-09 21:22:20 -0800119{
120 u32 client_index;
121 u32 context;
122 u8 is_add;
123 vl_api_ipsec_spd_entry_t entry;
124};
125
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800126/** \brief IPsec: Reply Add/delete Security Policy Database entry
127
128 @param context - sender context, to match reply w/ request
129 @param retval - success/fail rutrun code
130 @param stat_index - An index for the policy in the stats segment @ /net/ipec/policy
131*/
132define ipsec_spd_entry_add_del_reply
133{
134 u32 context;
135 i32 retval;
136 u32 stat_index;
137};
138
Neale Ranns17dcec02019-01-09 21:22:20 -0800139/** \brief Dump IPsec all SPD IDs
140 @param client_index - opaque cookie to identify the sender
141 @param context - sender context, to match reply w/ request
142*/
143define ipsec_spds_dump {
144 u32 client_index;
145 u32 context;
146};
147
148/** \brief Dump IPsec all SPD IDs response
149 @param client_index - opaque cookie to identify the sender
150 @param spd_id - SPD instance id (control plane allocated)
151 @param npolicies - number of policies in SPD
152*/
153define ipsec_spds_details {
154 u32 context;
155 u32 spd_id;
156 u32 npolicies;
157};
158
159/** \brief Dump ipsec policy database data
160 @param client_index - opaque cookie to identify the sender
161 @param context - sender context, to match reply w/ request
162 @param spd_id - SPD instance id
163 @param sa_id - SA id, optional, set to ~0 to see all policies in SPD
164*/
165define ipsec_spd_dump {
166 u32 client_index;
167 u32 context;
168 u32 spd_id;
169 u32 sa_id;
170};
171
172/** \brief IPsec policy database response
173 @param context - sender context which was passed in the request
174 €param entry - The SPD entry.
175 @param bytes - byte count of packets matching this policy
176 @param packets - count of packets matching this policy
177*/
178define ipsec_spd_details {
179 u32 context;
180 vl_api_ipsec_spd_entry_t entry;
Neale Ranns17dcec02019-01-09 21:22:20 -0800181};
182
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100183/** \brief IPsec: Add/delete Security Association Database entry
184 @param client_index - opaque cookie to identify the sender
185 @param context - sender context, to match reply w/ request
Neale Ranns17dcec02019-01-09 21:22:20 -0800186 @param entry - Entry to add or delete
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100187 */
Neale Rannseba31ec2019-02-17 18:04:27 +0000188define ipsec_sad_entry_add_del
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100189{
190 u32 client_index;
191 u32 context;
192 u8 is_add;
Neale Ranns17dcec02019-01-09 21:22:20 -0800193 vl_api_ipsec_sad_entry_t entry;
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100194};
Neale Rannseba31ec2019-02-17 18:04:27 +0000195define ipsec_sad_entry_add_del_reply
196{
197 u32 context;
198 i32 retval;
199 u32 stat_index;
200};
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100201
Neale Rannsc87b66c2019-02-07 07:26:12 -0800202/** \brief Add or Update Protection for a tunnel with IPSEC
203
204 Tunnel protection directly associates an SA with all packets
205 ingress and egress on the tunnel. This could also be achieved by
206 assigning an SPD to the tunnel, but that would incur an unnessccary
207 SPD entry lookup.
208
209 For tunnels the ESP acts on the post-encapsulated packet. So if this
210 packet:
211 +---------+------+
212 | Payload | O-IP |
213 +---------+------+
214 where O-IP is the overlay IP addrees that was routed into the tunnel,
215 the resulting encapsulated packet will be:
216 +---------+------+------+
217 | Payload | O-IP | T-IP |
218 +---------+------+------+
219 where T-IP is the tunnel's src.dst IP addresses.
220 If the SAs used for protection are in transport mode then the ESP is
221 inserted before T-IP, i.e.:
222 +---------+------+-----+------+
223 | Payload | O-IP | ESP | T-IP |
224 +---------+------+-----+------+
225 If the SAs used for protection are in tunnel mode then another
226 encapsulation occurs, i.e.:
227 +---------+------+------+-----+------+
228 | Payload | O-IP | T-IP | ESP | C-IP |
229 +---------+------+------+-----+------+
230 where C-IP are the crypto endpoint IP addresses defined as the tunnel
231 endpoints in the SA.
232 The mode for the inbound and outbound SA must be the same.
233
234 @param client_index - opaque cookie to identify the sender
235 @param context - sender context, to match reply w/ request
236 @param sw_id_index - Tunnel interface to protect
237 @param sa_in - The ID [set] of inbound SAs
238 @param sa_out - The ID of outbound SA
239*/
240typedef ipsec_tunnel_protect
241{
242 vl_api_interface_index_t sw_if_index;
243 u32 sa_out;
244 u8 n_sa_in;
245 u32 sa_in[n_sa_in];
246};
247
248autoreply define ipsec_tunnel_protect_update
249{
250 u32 client_index;
251 u32 context;
252
253 vl_api_ipsec_tunnel_protect_t tunnel;
254};
255
256autoreply define ipsec_tunnel_protect_del
257{
258 u32 client_index;
259 u32 context;
260
261 vl_api_interface_index_t sw_if_index;
262};
263
Neale Ranns12989b52019-09-26 16:20:19 +0000264/**
265 * @brief Dump all tunnel protections
266 */
Neale Rannsc87b66c2019-02-07 07:26:12 -0800267define ipsec_tunnel_protect_dump
268{
269 u32 client_index;
270 u32 context;
271 vl_api_interface_index_t sw_if_index;
272};
273
274define ipsec_tunnel_protect_details
275{
276 u32 context;
277 vl_api_ipsec_tunnel_protect_t tun;
278};
279
Filip Varga871bca92018-11-02 13:51:44 +0100280/** \brief IPsec: Get SPD interfaces
281 @param client_index - opaque cookie to identify the sender
282 @param context - sender context, to match reply w/ request
283 @param spd_index - SPD index
284 @param spd_index_valid - if 1 spd_index is used to filter
285 spd_index's, if 0 no filtering is done
286*/
287define ipsec_spd_interface_dump {
288 u32 client_index;
289 u32 context;
290 u32 spd_index;
291 u8 spd_index_valid;
292};
293
294/** \brief IPsec: SPD interface response
295 @param context - sender context which was passed in the request
296 @param spd_index - SPD index
297 @param sw_if_index - index of the interface
298*/
299define ipsec_spd_interface_details {
300 u32 context;
301 u32 spd_index;
302 u32 sw_if_index;
303};
304
Matthew Smithb0972cb2017-05-02 16:20:41 -0500305/** \brief Add or delete IPsec tunnel interface
Neale Ranns12989b52019-09-26 16:20:19 +0000306
307 !!DEPRECATED!!
308 use the tunnel protect APIs instead
309
Matthew Smithb0972cb2017-05-02 16:20:41 -0500310 @param client_index - opaque cookie to identify the sender
311 @param context - sender context, to match reply w/ request
312 @param is_add - add IPsec tunnel interface if nonzero, else delete
Kingwel Xie1ba5bc82019-03-20 07:21:58 -0400313 @param is_ip6 - tunnel v6 or v4
Matthew Smithb0972cb2017-05-02 16:20:41 -0500314 @param esn - enable extended sequence numbers if nonzero, else disable
315 @param anti_replay - enable anti replay check if nonzero, else disable
316 @param local_ip - local IP address
317 @param remote_ip - IP address of remote IPsec peer
318 @param local_spi - SPI of outbound IPsec SA
319 @param remote_spi - SPI of inbound IPsec SA
320 @param crypto_alg - encryption algorithm ID
321 @param local_crypto_key_len - length of local crypto key in bytes
322 @param local_crypto_key - crypto key for outbound IPsec SA
323 @param remote_crypto_key_len - length of remote crypto key in bytes
324 @param remote_crypto_key - crypto key for inbound IPsec SA
325 @param integ_alg - integrity algorithm ID
326 @param local_integ_key_len - length of local integrity key in bytes
327 @param local_integ_key - integrity key for outbound IPsec SA
328 @param remote_integ_key_len - length of remote integrity key in bytes
329 @param remote_integ_key - integrity key for inbound IPsec SA
Matthew Smith8e1039a2018-04-12 07:32:56 -0500330 @param renumber - intf display name uses a specified instance if != 0
331 @param show_instance - instance to display for intf if renumber is set
Filip Tehlarb4a7a7d2018-11-30 07:27:27 -0800332 @param udp_encap - enable UDP encapsulation for NAT traversal
Pierre Pfister4c422f92018-12-10 11:19:08 +0100333 @param tx_table_id - the FIB id used after packet encap
Neale Ranns80f6fd52019-04-16 02:41:34 +0000334 @param salt - for use with counter mode ciphers
Matthew Smithb0972cb2017-05-02 16:20:41 -0500335*/
Matthew Smithe04d09d2017-05-14 21:47:18 -0500336define ipsec_tunnel_if_add_del {
Matthew Smithb0972cb2017-05-02 16:20:41 -0500337 u32 client_index;
338 u32 context;
339 u8 is_add;
340 u8 esn;
341 u8 anti_replay;
Kingwel Xie1ba5bc82019-03-20 07:21:58 -0400342 vl_api_address_t local_ip;
343 vl_api_address_t remote_ip;
Matthew Smithb0972cb2017-05-02 16:20:41 -0500344 u32 local_spi;
345 u32 remote_spi;
346 u8 crypto_alg;
347 u8 local_crypto_key_len;
348 u8 local_crypto_key[128];
349 u8 remote_crypto_key_len;
350 u8 remote_crypto_key[128];
351 u8 integ_alg;
352 u8 local_integ_key_len;
353 u8 local_integ_key[128];
354 u8 remote_integ_key_len;
355 u8 remote_integ_key[128];
Matthew Smith8e1039a2018-04-12 07:32:56 -0500356 u8 renumber;
357 u32 show_instance;
Filip Tehlarb4a7a7d2018-11-30 07:27:27 -0800358 u8 udp_encap;
Pierre Pfister4c422f92018-12-10 11:19:08 +0100359 u32 tx_table_id;
Neale Ranns80f6fd52019-04-16 02:41:34 +0000360 u32 salt;
Matthew Smithb0972cb2017-05-02 16:20:41 -0500361};
362
Matthew Smithe04d09d2017-05-14 21:47:18 -0500363/** \brief Add/delete IPsec tunnel interface response
364 @param context - sender context, to match reply w/ request
365 @param retval - return status
366 @param sw_if_index - sw_if_index of new interface (for successful add)
367*/
368define ipsec_tunnel_if_add_del_reply {
369 u32 context;
370 i32 retval;
371 u32 sw_if_index;
372};
373
Matthew Smith28029532017-09-26 13:33:44 -0500374/** \brief Dump IPsec security association
375 @param client_index - opaque cookie to identify the sender
376 @param context - sender context, to match reply w/ request
377 @param sa_id - optional ID of an SA to dump, if ~0 dump all SAs in SAD
378*/
379define ipsec_sa_dump {
380 u32 client_index;
381 u32 context;
382 u32 sa_id;
383};
384
385/** \brief IPsec security association database response
386 @param context - sender context which was passed in the request
387 @param sa_id - SA ID, policy-based SAs >=0, tunnel interface SAs = 0
388 @param sw_if_index - sw_if_index of tunnel interface, policy-based SAs = ~0
389 @param spi - security parameter index
390 @param protocol - IPsec protocol (value from ipsec_protocol_t)
391 @param crypto_alg - crypto algorithm (value from ipsec_crypto_alg_t)
392 @param crypto_key_len - length of crypto_key in bytes
393 @param crypto_key - crypto keying material
394 @param integ_alg - integrity algorithm (value from ipsec_integ_alg_t)
395 @param integ_key_len - length of integ_key in bytes
396 @param integ_key - integrity keying material
397 @param use_esn - using extended sequence numbers when non-zero
398 @param use_anti_replay - using anti-replay window when non-zero
399 @param is_tunnel - IPsec tunnel mode when non-zero, else transport mode
400 @param is_tunnel_ipv6 - If using tunnel mode, endpoints are IPv6
401 @param tunnel_src_addr - Tunnel source address if using tunnel mode
402 @param tunnel_dst_addr - Tunnel destination address is using tunnel mode
403 @param salt - 4 byte salt
404 @param seq - current sequence number for outbound
405 @param seq_hi - high 32 bits of ESN for outbound
406 @param last_seq - highest sequence number received inbound
407 @param last_seq_hi - high 32 bits of highest ESN received inbound
408 @param replay_window - bit map of seq nums received relative to last_seq if using anti-replay
409 @param total_data_size - total bytes sent or received
Klement Sekera4b089f22018-04-17 18:04:57 +0200410 @param udp_encap - 1 if UDP encap enabled, 0 otherwise
Matthew Smith28029532017-09-26 13:33:44 -0500411*/
412define ipsec_sa_details {
413 u32 context;
Neale Ranns8d7c5022019-02-06 01:41:05 -0800414 vl_api_ipsec_sad_entry_t entry;
415
Matthew Smith28029532017-09-26 13:33:44 -0500416 u32 sw_if_index;
Matthew Smith28029532017-09-26 13:33:44 -0500417 u32 salt;
418 u64 seq_outbound;
419 u64 last_seq_inbound;
420 u64 replay_window;
421
422 u64 total_data_size;
423};
424
Matthew Smithca514fd2017-10-12 12:06:59 -0500425/** \brief Set new SA on IPsec interface
Neale Ranns12989b52019-09-26 16:20:19 +0000426
427 !! DEPRECATED !!
428
Matthew Smithca514fd2017-10-12 12:06:59 -0500429 @param client_index - opaque cookie to identify the sender
430 @param context - sender context, to match reply w/ request
431 @param sw_if_index - index of tunnel interface
432 @param sa_id - ID of SA to use
433 @param is_outbound - 1 if outbound (local) SA, 0 if inbound (remote)
434*/
435autoreply define ipsec_tunnel_if_set_sa {
436 u32 client_index;
437 u32 context;
438 u32 sw_if_index;
439 u32 sa_id;
440 u8 is_outbound;
441};
442
Klement Sekerab4d30532018-11-08 13:00:02 +0100443/** \brief Dump IPsec backends
444 @param client_index - opaque cookie to identify the sender
445 @param context - sender context, to match reply w/ request
446*/
447define ipsec_backend_dump {
448 u32 client_index;
449 u32 context;
450};
451
452/** \brief IPsec backend details
453 @param name - name of the backend
454 @param protocol - IPsec protocol (value from ipsec_protocol_t)
455 @param index - backend index
456 @param active - set to 1 if the backend is active, otherwise 0
457*/
458define ipsec_backend_details {
459 u32 context;
460 u8 name[128];
Neale Ranns17dcec02019-01-09 21:22:20 -0800461 vl_api_ipsec_proto_t protocol;
Klement Sekerab4d30532018-11-08 13:00:02 +0100462 u8 index;
463 u8 active;
464};
465
466/** \brief Select IPsec backend
467 @param client_index - opaque cookie to identify the sender
468 @param context - sender context, to match reply w/ request
469 @param protocol - IPsec protocol (value from ipsec_protocol_t)
470 @param index - backend index
471*/
472autoreply define ipsec_select_backend {
473 u32 client_index;
474 u32 context;
Neale Ranns17dcec02019-01-09 21:22:20 -0800475 vl_api_ipsec_proto_t protocol;
Klement Sekerab4d30532018-11-08 13:00:02 +0100476 u8 index;
477};
478
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100479/*
480 * Local Variables:
481 * eval: (c-set-style "gnu")
482 * End:
483 */
Dave Barach11b8dbf2017-04-24 10:46:54 -0400484