blob: be45c3e24013eca4b50d892d1f886020b9628410 [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 Rannsff2e4132021-06-24 14:57:56 +000017option version = "5.0.2";
Neale Ranns17dcec02019-01-09 21:22:20 -080018
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";
Jakub Grajciar287d5e12020-02-28 08:26:32 +010021import "vnet/ip/ip_types.api";
22import "vnet/interface_types.api";
Neale Rannsdd4ccf22020-06-30 07:47:14 +000023import "vnet/tunnel/tunnel_types.api";
Dave Barach0d056e52017-09-28 15:11:16 -040024
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010025/** \brief IPsec: Add/delete Security Policy Database
26 @param client_index - opaque cookie to identify the sender
27 @param context - sender context, to match reply w/ request
28 @param is_add - add SPD if non-zero, else delete
29 @param spd_id - SPD instance id (control plane allocated)
30*/
31
Dave Barach11b8dbf2017-04-24 10:46:54 -040032autoreply define ipsec_spd_add_del
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010033{
34 u32 client_index;
35 u32 context;
Jakub Grajciar287d5e12020-02-28 08:26:32 +010036 bool is_add;
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010037 u32 spd_id;
38};
39
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010040/** \brief IPsec: Add/delete SPD from interface
41
42 @param client_index - opaque cookie to identify the sender
43 @param context - sender context, to match reply w/ request
44 @param is_add - add security mode if non-zero, else delete
45 @param sw_if_index - index of the interface
46 @param spd_id - SPD instance id to use for lookups
47*/
48
49
Dave Barach11b8dbf2017-04-24 10:46:54 -040050autoreply define ipsec_interface_add_del_spd
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010051{
52 u32 client_index;
53 u32 context;
54
Jakub Grajciar287d5e12020-02-28 08:26:32 +010055 bool is_add;
56 vl_api_interface_index_t sw_if_index;
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010057 u32 spd_id;
58};
59
Neale Ranns17dcec02019-01-09 21:22:20 -080060
61enum ipsec_spd_action
62{
63 /* bypass - no IPsec processing */
64 IPSEC_API_SPD_ACTION_BYPASS = 0,
65 /* discard - discard packet with ICMP processing */
66 IPSEC_API_SPD_ACTION_DISCARD,
67 /* resolve - send request to control plane for SA resolving */
68 IPSEC_API_SPD_ACTION_RESOLVE,
69 /* protect - apply IPsec policy using following parameters */
70 IPSEC_API_SPD_ACTION_PROTECT,
71};
72
73/** \brief IPsec: Security Policy Database entry
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010074
75 See RFC 4301, 4.4.1.1 on how to match packet to selectors
76
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010077 @param spd_id - SPD instance id (control plane allocated)
78 @param priority - priority of SPD entry (non-unique value). Used to order SPD matching - higher priorities match before lower
79 @param is_outbound - entry applies to outbound traffic if non-zero, otherwise applies to inbound traffic
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010080 @param remote_address_start - start of remote address range to match
81 @param remote_address_stop - end of remote address range to match
82 @param local_address_start - start of local address range to match
83 @param local_address_stop - end of local address range to match
Neale Ranns17dcec02019-01-09 21:22:20 -080084 @param protocol - protocol type to match [0 means any] otherwise IANA value
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010085 @param remote_port_start - start of remote port range to match ...
86 @param remote_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
87 @param local_port_start - start of local port range to match ...
88 @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 -080089 @param policy - action to perform on match
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010090 @param sa_id - SAD instance id (control plane allocated)
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010091*/
Neale Ranns17dcec02019-01-09 21:22:20 -080092typedef ipsec_spd_entry
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010093{
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010094 u32 spd_id;
95 i32 priority;
Jakub Grajciar287d5e12020-02-28 08:26:32 +010096 bool is_outbound;
Pavel Kotucek9c7ef032016-12-21 07:46:45 +010097
Neale Ranns17dcec02019-01-09 21:22:20 -080098 u32 sa_id;
99 vl_api_ipsec_spd_action_t policy;
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100100 /* Which protocol?? */
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100101 u8 protocol;
102
Neale Ranns17dcec02019-01-09 21:22:20 -0800103 // Selector
Neale Ranns17dcec02019-01-09 21:22:20 -0800104 vl_api_address_t remote_address_start;
105 vl_api_address_t remote_address_stop;
106 vl_api_address_t local_address_start;
107 vl_api_address_t local_address_stop;
108
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100109 u16 remote_port_start;
110 u16 remote_port_stop;
111 u16 local_port_start;
112 u16 local_port_stop;
Neale Ranns17dcec02019-01-09 21:22:20 -0800113};
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100114
Neale Ranns17dcec02019-01-09 21:22:20 -0800115/** \brief IPsec: Add/delete Security Policy Database entry
116
117 @param client_index - opaque cookie to identify the sender
118 @param context - sender context, to match reply w/ request
119 @param is_add - add SPD if non-zero, else delete
120 @param entry - Description of the entry to add/dell
121*/
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800122define ipsec_spd_entry_add_del
Neale Ranns17dcec02019-01-09 21:22:20 -0800123{
124 u32 client_index;
125 u32 context;
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100126 bool is_add;
Neale Ranns17dcec02019-01-09 21:22:20 -0800127 vl_api_ipsec_spd_entry_t entry;
128};
129
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800130/** \brief IPsec: Reply Add/delete Security Policy Database entry
131
132 @param context - sender context, to match reply w/ request
133 @param retval - success/fail rutrun code
134 @param stat_index - An index for the policy in the stats segment @ /net/ipec/policy
135*/
136define ipsec_spd_entry_add_del_reply
137{
138 u32 context;
139 i32 retval;
140 u32 stat_index;
141};
142
Neale Ranns17dcec02019-01-09 21:22:20 -0800143/** \brief Dump IPsec all SPD IDs
144 @param client_index - opaque cookie to identify the sender
145 @param context - sender context, to match reply w/ request
146*/
147define ipsec_spds_dump {
148 u32 client_index;
149 u32 context;
150};
151
152/** \brief Dump IPsec all SPD IDs response
153 @param client_index - opaque cookie to identify the sender
154 @param spd_id - SPD instance id (control plane allocated)
155 @param npolicies - number of policies in SPD
156*/
157define ipsec_spds_details {
158 u32 context;
159 u32 spd_id;
160 u32 npolicies;
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100161};
Neale Ranns17dcec02019-01-09 21:22:20 -0800162
163/** \brief Dump ipsec policy database data
164 @param client_index - opaque cookie to identify the sender
165 @param context - sender context, to match reply w/ request
166 @param spd_id - SPD instance id
167 @param sa_id - SA id, optional, set to ~0 to see all policies in SPD
168*/
169define ipsec_spd_dump {
170 u32 client_index;
171 u32 context;
172 u32 spd_id;
173 u32 sa_id;
174};
175
176/** \brief IPsec policy database response
177 @param context - sender context which was passed in the request
178 €param entry - The SPD entry.
179 @param bytes - byte count of packets matching this policy
180 @param packets - count of packets matching this policy
181*/
182define ipsec_spd_details {
183 u32 context;
184 vl_api_ipsec_spd_entry_t entry;
Neale Ranns17dcec02019-01-09 21:22:20 -0800185};
186
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100187/** \brief IPsec: Add/delete Security Association Database entry
188 @param client_index - opaque cookie to identify the sender
189 @param context - sender context, to match reply w/ request
Neale Ranns17dcec02019-01-09 21:22:20 -0800190 @param entry - Entry to add or delete
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100191 */
Neale Rannseba31ec2019-02-17 18:04:27 +0000192define ipsec_sad_entry_add_del
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100193{
Neale Ranns9ec846c2021-02-09 14:04:02 +0000194 option deprecated;
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100195 u32 client_index;
196 u32 context;
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100197 bool is_add;
Neale Ranns17dcec02019-01-09 21:22:20 -0800198 vl_api_ipsec_sad_entry_t entry;
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100199};
Neale Ranns041add72020-01-02 04:06:10 +0000200define ipsec_sad_entry_add_del_v2
201{
202 u32 client_index;
203 u32 context;
204 bool is_add;
205 vl_api_ipsec_sad_entry_v2_t entry;
206};
Neale Ranns9ec846c2021-02-09 14:04:02 +0000207define ipsec_sad_entry_add_del_v3
208{
209 u32 client_index;
210 u32 context;
211 bool is_add;
212 vl_api_ipsec_sad_entry_v3_t entry;
213};
Neale Rannsff2e4132021-06-24 14:57:56 +0000214define ipsec_sad_entry_add
215{
216 u32 client_index;
217 u32 context;
218 vl_api_ipsec_sad_entry_v3_t entry;
219};
220autoreply define ipsec_sad_entry_del
221{
222 u32 client_index;
223 u32 context;
224 u32 id;
225};
Neale Ranns9ec846c2021-02-09 14:04:02 +0000226
Neale Rannseba31ec2019-02-17 18:04:27 +0000227define ipsec_sad_entry_add_del_reply
228{
Neale Ranns9ec846c2021-02-09 14:04:02 +0000229 option deprecated;
Neale Rannseba31ec2019-02-17 18:04:27 +0000230 u32 context;
231 i32 retval;
232 u32 stat_index;
233};
Neale Ranns041add72020-01-02 04:06:10 +0000234define ipsec_sad_entry_add_del_v2_reply
235{
236 u32 context;
237 i32 retval;
238 u32 stat_index;
239};
Neale Ranns9ec846c2021-02-09 14:04:02 +0000240define ipsec_sad_entry_add_del_v3_reply
241{
242 u32 context;
243 i32 retval;
244 u32 stat_index;
245};
Neale Rannsff2e4132021-06-24 14:57:56 +0000246define ipsec_sad_entry_add_reply
247{
248 u32 context;
249 i32 retval;
250 u32 stat_index;
251};
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100252
Neale Rannsc87b66c2019-02-07 07:26:12 -0800253/** \brief Add or Update Protection for a tunnel with IPSEC
254
255 Tunnel protection directly associates an SA with all packets
256 ingress and egress on the tunnel. This could also be achieved by
257 assigning an SPD to the tunnel, but that would incur an unnessccary
258 SPD entry lookup.
259
260 For tunnels the ESP acts on the post-encapsulated packet. So if this
261 packet:
262 +---------+------+
263 | Payload | O-IP |
264 +---------+------+
265 where O-IP is the overlay IP addrees that was routed into the tunnel,
266 the resulting encapsulated packet will be:
267 +---------+------+------+
268 | Payload | O-IP | T-IP |
269 +---------+------+------+
270 where T-IP is the tunnel's src.dst IP addresses.
271 If the SAs used for protection are in transport mode then the ESP is
272 inserted before T-IP, i.e.:
273 +---------+------+-----+------+
274 | Payload | O-IP | ESP | T-IP |
275 +---------+------+-----+------+
276 If the SAs used for protection are in tunnel mode then another
277 encapsulation occurs, i.e.:
278 +---------+------+------+-----+------+
279 | Payload | O-IP | T-IP | ESP | C-IP |
280 +---------+------+------+-----+------+
281 where C-IP are the crypto endpoint IP addresses defined as the tunnel
282 endpoints in the SA.
283 The mode for the inbound and outbound SA must be the same.
284
285 @param client_index - opaque cookie to identify the sender
286 @param context - sender context, to match reply w/ request
287 @param sw_id_index - Tunnel interface to protect
Neale Ranns28287212019-12-16 00:53:11 +0000288 @param nh - The peer/next-hop on the tunnel to which the traffic
289 should be protected. For a P2P interface set this to the
290 all 0s address.
Neale Rannsc87b66c2019-02-07 07:26:12 -0800291 @param sa_in - The ID [set] of inbound SAs
292 @param sa_out - The ID of outbound SA
293*/
294typedef ipsec_tunnel_protect
295{
296 vl_api_interface_index_t sw_if_index;
Neale Ranns28287212019-12-16 00:53:11 +0000297 vl_api_address_t nh;
Neale Rannsc87b66c2019-02-07 07:26:12 -0800298 u32 sa_out;
299 u8 n_sa_in;
300 u32 sa_in[n_sa_in];
301};
302
303autoreply define ipsec_tunnel_protect_update
304{
305 u32 client_index;
306 u32 context;
307
308 vl_api_ipsec_tunnel_protect_t tunnel;
309};
310
311autoreply define ipsec_tunnel_protect_del
312{
313 u32 client_index;
314 u32 context;
315
316 vl_api_interface_index_t sw_if_index;
Neale Ranns28287212019-12-16 00:53:11 +0000317 vl_api_address_t nh;
Neale Rannsc87b66c2019-02-07 07:26:12 -0800318};
319
Neale Ranns12989b52019-09-26 16:20:19 +0000320/**
321 * @brief Dump all tunnel protections
322 */
Neale Rannsc87b66c2019-02-07 07:26:12 -0800323define ipsec_tunnel_protect_dump
324{
325 u32 client_index;
326 u32 context;
327 vl_api_interface_index_t sw_if_index;
328};
329
330define ipsec_tunnel_protect_details
331{
332 u32 context;
333 vl_api_ipsec_tunnel_protect_t tun;
334};
335
Filip Varga871bca92018-11-02 13:51:44 +0100336/** \brief IPsec: Get SPD interfaces
337 @param client_index - opaque cookie to identify the sender
338 @param context - sender context, to match reply w/ request
339 @param spd_index - SPD index
340 @param spd_index_valid - if 1 spd_index is used to filter
341 spd_index's, if 0 no filtering is done
342*/
343define ipsec_spd_interface_dump {
344 u32 client_index;
345 u32 context;
346 u32 spd_index;
347 u8 spd_index_valid;
348};
349
350/** \brief IPsec: SPD interface response
351 @param context - sender context which was passed in the request
352 @param spd_index - SPD index
353 @param sw_if_index - index of the interface
354*/
355define ipsec_spd_interface_details {
356 u32 context;
357 u32 spd_index;
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100358 vl_api_interface_index_t sw_if_index;
Filip Varga871bca92018-11-02 13:51:44 +0100359};
360
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000361typedef ipsec_itf
362{
363 u32 user_instance [default=0xffffffff];
364 vl_api_tunnel_mode_t mode;
365 vl_api_interface_index_t sw_if_index;
366};
367
368/** \brief Create an IPSec interface
369 */
370define ipsec_itf_create {
371 u32 client_index;
372 u32 context;
373 vl_api_ipsec_itf_t itf;
374};
375
376/** \brief Add IPsec interface interface response
377 @param context - sender context, to match reply w/ request
378 @param retval - return status
379 @param sw_if_index - sw_if_index of new interface (for successful add)
380*/
381define ipsec_itf_create_reply
382{
383 u32 context;
384 i32 retval;
385 vl_api_interface_index_t sw_if_index;
386};
387
388autoreply define ipsec_itf_delete
389{
390 u32 client_index;
391 u32 context;
392 vl_api_interface_index_t sw_if_index;
393};
394
395define ipsec_itf_dump
396{
397 u32 client_index;
398 u32 context;
399 vl_api_interface_index_t sw_if_index;
400};
401
402define ipsec_itf_details
403{
404 u32 context;
405 vl_api_ipsec_itf_t itf;
406};
407
Matthew Smith28029532017-09-26 13:33:44 -0500408/** \brief Dump IPsec security association
409 @param client_index - opaque cookie to identify the sender
410 @param context - sender context, to match reply w/ request
411 @param sa_id - optional ID of an SA to dump, if ~0 dump all SAs in SAD
412*/
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000413define ipsec_sa_dump
414{
Neale Ranns9ec846c2021-02-09 14:04:02 +0000415 option deprecated;
Matthew Smith28029532017-09-26 13:33:44 -0500416 u32 client_index;
417 u32 context;
418 u32 sa_id;
419};
Neale Ranns041add72020-01-02 04:06:10 +0000420define ipsec_sa_v2_dump
421{
422 u32 client_index;
423 u32 context;
424 u32 sa_id;
425};
Neale Ranns9ec846c2021-02-09 14:04:02 +0000426define ipsec_sa_v3_dump
427{
428 u32 client_index;
429 u32 context;
430 u32 sa_id;
431};
Matthew Smith28029532017-09-26 13:33:44 -0500432
433/** \brief IPsec security association database response
434 @param context - sender context which was passed in the request
Neale Ranns041add72020-01-02 04:06:10 +0000435 @param entry - The SA details
Matthew Smith28029532017-09-26 13:33:44 -0500436 @param sw_if_index - sw_if_index of tunnel interface, policy-based SAs = ~0
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100437 @param salt - 4 byte salt
Matthew Smith28029532017-09-26 13:33:44 -0500438 @param seq - current sequence number for outbound
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100439 @param seq_hi - high 32 bits of ESN for outbound
Matthew Smith28029532017-09-26 13:33:44 -0500440 @param last_seq - highest sequence number received inbound
441 @param last_seq_hi - high 32 bits of highest ESN received inbound
442 @param replay_window - bit map of seq nums received relative to last_seq if using anti-replay
Matthew Smith48d32b42020-04-02 07:45:49 -0500443 @param stat_index - index for the SA in the stats segment @ /net/ipsec/sa
Matthew Smith28029532017-09-26 13:33:44 -0500444*/
445define ipsec_sa_details {
Neale Ranns9ec846c2021-02-09 14:04:02 +0000446 option deprecated;
Matthew Smith28029532017-09-26 13:33:44 -0500447 u32 context;
Neale Ranns8d7c5022019-02-06 01:41:05 -0800448 vl_api_ipsec_sad_entry_t entry;
449
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100450 vl_api_interface_index_t sw_if_index;
Matthew Smith28029532017-09-26 13:33:44 -0500451 u32 salt;
452 u64 seq_outbound;
453 u64 last_seq_inbound;
454 u64 replay_window;
455
Matthew Smith48d32b42020-04-02 07:45:49 -0500456 u32 stat_index;
Matthew Smith28029532017-09-26 13:33:44 -0500457};
Neale Ranns041add72020-01-02 04:06:10 +0000458define ipsec_sa_v2_details {
459 u32 context;
460 vl_api_ipsec_sad_entry_v2_t entry;
461
462 vl_api_interface_index_t sw_if_index;
463 u32 salt;
464 u64 seq_outbound;
465 u64 last_seq_inbound;
466 u64 replay_window;
467
468 u32 stat_index;
469};
Neale Ranns9ec846c2021-02-09 14:04:02 +0000470define ipsec_sa_v3_details {
471 u32 context;
472 vl_api_ipsec_sad_entry_v3_t entry;
473
474 vl_api_interface_index_t sw_if_index;
475 u64 seq_outbound;
476 u64 last_seq_inbound;
477 u64 replay_window;
478
479 u32 stat_index;
480};
Matthew Smith28029532017-09-26 13:33:44 -0500481
Klement Sekerab4d30532018-11-08 13:00:02 +0100482/** \brief Dump IPsec backends
483 @param client_index - opaque cookie to identify the sender
484 @param context - sender context, to match reply w/ request
485*/
486define ipsec_backend_dump {
487 u32 client_index;
488 u32 context;
489};
490
491/** \brief IPsec backend details
492 @param name - name of the backend
493 @param protocol - IPsec protocol (value from ipsec_protocol_t)
494 @param index - backend index
495 @param active - set to 1 if the backend is active, otherwise 0
496*/
497define ipsec_backend_details {
498 u32 context;
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100499 string name[128];
Neale Ranns17dcec02019-01-09 21:22:20 -0800500 vl_api_ipsec_proto_t protocol;
Klement Sekerab4d30532018-11-08 13:00:02 +0100501 u8 index;
Jakub Grajciar287d5e12020-02-28 08:26:32 +0100502 bool active;
Klement Sekerab4d30532018-11-08 13:00:02 +0100503};
504
505/** \brief Select IPsec backend
506 @param client_index - opaque cookie to identify the sender
507 @param context - sender context, to match reply w/ request
508 @param protocol - IPsec protocol (value from ipsec_protocol_t)
509 @param index - backend index
510*/
511autoreply define ipsec_select_backend {
512 u32 client_index;
513 u32 context;
Neale Ranns17dcec02019-01-09 21:22:20 -0800514 vl_api_ipsec_proto_t protocol;
Klement Sekerab4d30532018-11-08 13:00:02 +0100515 u8 index;
516};
517
Yulong Pei2e84d662020-08-14 18:21:08 +0800518
519/** \brief IPsec Set Async mode
520 @param client_index - opaque cookie to identify the sender
521 @param context - sender context, to match reply w/ request
522 @param async_enable - ipsec async mode on or off
523*/
524autoreply define ipsec_set_async_mode {
525 u32 client_index;
526 u32 context;
527 bool async_enable;
528};
529
Pavel Kotucek9c7ef032016-12-21 07:46:45 +0100530/*
531 * Local Variables:
532 * eval: (c-set-style "gnu")
533 * End:
534 */