1 /* Hey Emacs use -*- mode: C -*- */
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 option version = "5.0.1";
19 import "vnet/ipsec/ipsec_types.api";
20 import "vnet/interface_types.api";
21 import "vnet/ip/ip_types.api";
22 import "vnet/interface_types.api";
23 import "vnet/tunnel/tunnel_types.api";
25 /** \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)
32 autoreply define ipsec_spd_add_del
40 /** \brief IPsec: Add/delete SPD from interface
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
50 autoreply define ipsec_interface_add_del_spd
56 vl_api_interface_index_t sw_if_index;
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,
73 /** \brief IPsec: Security Policy Database entry
75 See RFC 4301, 4.4.1.1 on how to match packet to selectors
77 @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
80 @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
84 @param protocol - protocol type to match [0 means any] otherwise IANA value
85 @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]
89 @param policy - action to perform on match
90 @param sa_id - SAD instance id (control plane allocated)
92 typedef ipsec_spd_entry
99 vl_api_ipsec_spd_action_t policy;
100 /* Which protocol?? */
104 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;
109 u16 remote_port_start;
110 u16 remote_port_stop;
111 u16 local_port_start;
115 /** \brief IPsec: Add/delete Security Policy Database entry
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
122 define ipsec_spd_entry_add_del
127 vl_api_ipsec_spd_entry_t entry;
130 /** \brief IPsec: Reply Add/delete Security Policy Database entry
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
136 define ipsec_spd_entry_add_del_reply
143 /** \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
147 define ipsec_spds_dump {
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
157 define ipsec_spds_details {
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
169 define ipsec_spd_dump {
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
182 define ipsec_spd_details {
184 vl_api_ipsec_spd_entry_t entry;
187 /** \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
190 @param entry - Entry to add or delete
192 define ipsec_sad_entry_add_del
198 vl_api_ipsec_sad_entry_t entry;
200 define ipsec_sad_entry_add_del_v2
205 vl_api_ipsec_sad_entry_v2_t entry;
207 define ipsec_sad_entry_add_del_v3
212 vl_api_ipsec_sad_entry_v3_t entry;
215 define ipsec_sad_entry_add_del_reply
222 define ipsec_sad_entry_add_del_v2_reply
228 define ipsec_sad_entry_add_del_v3_reply
235 /** \brief Add or Update Protection for a tunnel with IPSEC
237 Tunnel protection directly associates an SA with all packets
238 ingress and egress on the tunnel. This could also be achieved by
239 assigning an SPD to the tunnel, but that would incur an unnessccary
242 For tunnels the ESP acts on the post-encapsulated packet. So if this
247 where O-IP is the overlay IP addrees that was routed into the tunnel,
248 the resulting encapsulated packet will be:
249 +---------+------+------+
250 | Payload | O-IP | T-IP |
251 +---------+------+------+
252 where T-IP is the tunnel's src.dst IP addresses.
253 If the SAs used for protection are in transport mode then the ESP is
254 inserted before T-IP, i.e.:
255 +---------+------+-----+------+
256 | Payload | O-IP | ESP | T-IP |
257 +---------+------+-----+------+
258 If the SAs used for protection are in tunnel mode then another
259 encapsulation occurs, i.e.:
260 +---------+------+------+-----+------+
261 | Payload | O-IP | T-IP | ESP | C-IP |
262 +---------+------+------+-----+------+
263 where C-IP are the crypto endpoint IP addresses defined as the tunnel
265 The mode for the inbound and outbound SA must be the same.
267 @param client_index - opaque cookie to identify the sender
268 @param context - sender context, to match reply w/ request
269 @param sw_id_index - Tunnel interface to protect
270 @param nh - The peer/next-hop on the tunnel to which the traffic
271 should be protected. For a P2P interface set this to the
273 @param sa_in - The ID [set] of inbound SAs
274 @param sa_out - The ID of outbound SA
276 typedef ipsec_tunnel_protect
278 vl_api_interface_index_t sw_if_index;
285 autoreply define ipsec_tunnel_protect_update
290 vl_api_ipsec_tunnel_protect_t tunnel;
293 autoreply define ipsec_tunnel_protect_del
298 vl_api_interface_index_t sw_if_index;
303 * @brief Dump all tunnel protections
305 define ipsec_tunnel_protect_dump
309 vl_api_interface_index_t sw_if_index;
312 define ipsec_tunnel_protect_details
315 vl_api_ipsec_tunnel_protect_t tun;
318 /** \brief IPsec: Get SPD interfaces
319 @param client_index - opaque cookie to identify the sender
320 @param context - sender context, to match reply w/ request
321 @param spd_index - SPD index
322 @param spd_index_valid - if 1 spd_index is used to filter
323 spd_index's, if 0 no filtering is done
325 define ipsec_spd_interface_dump {
332 /** \brief IPsec: SPD interface response
333 @param context - sender context which was passed in the request
334 @param spd_index - SPD index
335 @param sw_if_index - index of the interface
337 define ipsec_spd_interface_details {
340 vl_api_interface_index_t sw_if_index;
345 u32 user_instance [default=0xffffffff];
346 vl_api_tunnel_mode_t mode;
347 vl_api_interface_index_t sw_if_index;
350 /** \brief Create an IPSec interface
352 define ipsec_itf_create {
355 vl_api_ipsec_itf_t itf;
358 /** \brief Add IPsec interface interface response
359 @param context - sender context, to match reply w/ request
360 @param retval - return status
361 @param sw_if_index - sw_if_index of new interface (for successful add)
363 define ipsec_itf_create_reply
367 vl_api_interface_index_t sw_if_index;
370 autoreply define ipsec_itf_delete
374 vl_api_interface_index_t sw_if_index;
377 define ipsec_itf_dump
381 vl_api_interface_index_t sw_if_index;
384 define ipsec_itf_details
387 vl_api_ipsec_itf_t itf;
390 /** \brief Dump IPsec security association
391 @param client_index - opaque cookie to identify the sender
392 @param context - sender context, to match reply w/ request
393 @param sa_id - optional ID of an SA to dump, if ~0 dump all SAs in SAD
402 define ipsec_sa_v2_dump
408 define ipsec_sa_v3_dump
415 /** \brief IPsec security association database response
416 @param context - sender context which was passed in the request
417 @param entry - The SA details
418 @param sw_if_index - sw_if_index of tunnel interface, policy-based SAs = ~0
419 @param salt - 4 byte salt
420 @param seq - current sequence number for outbound
421 @param seq_hi - high 32 bits of ESN for outbound
422 @param last_seq - highest sequence number received inbound
423 @param last_seq_hi - high 32 bits of highest ESN received inbound
424 @param replay_window - bit map of seq nums received relative to last_seq if using anti-replay
425 @param stat_index - index for the SA in the stats segment @ /net/ipsec/sa
427 define ipsec_sa_details {
430 vl_api_ipsec_sad_entry_t entry;
432 vl_api_interface_index_t sw_if_index;
435 u64 last_seq_inbound;
440 define ipsec_sa_v2_details {
442 vl_api_ipsec_sad_entry_v2_t entry;
444 vl_api_interface_index_t sw_if_index;
447 u64 last_seq_inbound;
452 define ipsec_sa_v3_details {
454 vl_api_ipsec_sad_entry_v3_t entry;
456 vl_api_interface_index_t sw_if_index;
458 u64 last_seq_inbound;
464 /** \brief Dump IPsec backends
465 @param client_index - opaque cookie to identify the sender
466 @param context - sender context, to match reply w/ request
468 define ipsec_backend_dump {
473 /** \brief IPsec backend details
474 @param name - name of the backend
475 @param protocol - IPsec protocol (value from ipsec_protocol_t)
476 @param index - backend index
477 @param active - set to 1 if the backend is active, otherwise 0
479 define ipsec_backend_details {
482 vl_api_ipsec_proto_t protocol;
487 /** \brief Select IPsec backend
488 @param client_index - opaque cookie to identify the sender
489 @param context - sender context, to match reply w/ request
490 @param protocol - IPsec protocol (value from ipsec_protocol_t)
491 @param index - backend index
493 autoreply define ipsec_select_backend {
496 vl_api_ipsec_proto_t protocol;
501 /** \brief IPsec Set Async mode
502 @param client_index - opaque cookie to identify the sender
503 @param context - sender context, to match reply w/ request
504 @param async_enable - ipsec async mode on or off
506 autoreply define ipsec_set_async_mode {
514 * eval: (c-set-style "gnu")