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 = "3.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";
24 /** \brief IPsec: Add/delete Security Policy Database
25 @param client_index - opaque cookie to identify the sender
26 @param context - sender context, to match reply w/ request
27 @param is_add - add SPD if non-zero, else delete
28 @param spd_id - SPD instance id (control plane allocated)
31 autoreply define ipsec_spd_add_del
39 /** \brief IPsec: Add/delete SPD from interface
41 @param client_index - opaque cookie to identify the sender
42 @param context - sender context, to match reply w/ request
43 @param is_add - add security mode if non-zero, else delete
44 @param sw_if_index - index of the interface
45 @param spd_id - SPD instance id to use for lookups
49 autoreply define ipsec_interface_add_del_spd
55 vl_api_interface_index_t sw_if_index;
62 /* bypass - no IPsec processing */
63 IPSEC_API_SPD_ACTION_BYPASS = 0,
64 /* discard - discard packet with ICMP processing */
65 IPSEC_API_SPD_ACTION_DISCARD,
66 /* resolve - send request to control plane for SA resolving */
67 IPSEC_API_SPD_ACTION_RESOLVE,
68 /* protect - apply IPsec policy using following parameters */
69 IPSEC_API_SPD_ACTION_PROTECT,
72 /** \brief IPsec: Security Policy Database entry
74 See RFC 4301, 4.4.1.1 on how to match packet to selectors
76 @param spd_id - SPD instance id (control plane allocated)
77 @param priority - priority of SPD entry (non-unique value). Used to order SPD matching - higher priorities match before lower
78 @param is_outbound - entry applies to outbound traffic if non-zero, otherwise applies to inbound traffic
79 @param remote_address_start - start of remote address range to match
80 @param remote_address_stop - end of remote address range to match
81 @param local_address_start - start of local address range to match
82 @param local_address_stop - end of local address range to match
83 @param protocol - protocol type to match [0 means any] otherwise IANA value
84 @param remote_port_start - start of remote port range to match ...
85 @param remote_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
86 @param local_port_start - start of local port range to match ...
87 @param local_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
88 @param policy - action to perform on match
89 @param sa_id - SAD instance id (control plane allocated)
91 typedef ipsec_spd_entry
98 vl_api_ipsec_spd_action_t policy;
99 /* Which protocol?? */
103 vl_api_address_t remote_address_start;
104 vl_api_address_t remote_address_stop;
105 vl_api_address_t local_address_start;
106 vl_api_address_t local_address_stop;
108 u16 remote_port_start;
109 u16 remote_port_stop;
110 u16 local_port_start;
114 /** \brief IPsec: Add/delete Security Policy Database entry
116 @param client_index - opaque cookie to identify the sender
117 @param context - sender context, to match reply w/ request
118 @param is_add - add SPD if non-zero, else delete
119 @param entry - Description of the entry to add/dell
121 define ipsec_spd_entry_add_del
126 vl_api_ipsec_spd_entry_t entry;
129 /** \brief IPsec: Reply Add/delete Security Policy Database entry
131 @param context - sender context, to match reply w/ request
132 @param retval - success/fail rutrun code
133 @param stat_index - An index for the policy in the stats segment @ /net/ipec/policy
135 define ipsec_spd_entry_add_del_reply
142 /** \brief Dump IPsec all SPD IDs
143 @param client_index - opaque cookie to identify the sender
144 @param context - sender context, to match reply w/ request
146 define ipsec_spds_dump {
151 /** \brief Dump IPsec all SPD IDs response
152 @param client_index - opaque cookie to identify the sender
153 @param spd_id - SPD instance id (control plane allocated)
154 @param npolicies - number of policies in SPD
156 define ipsec_spds_details {
162 /** \brief Dump ipsec policy database data
163 @param client_index - opaque cookie to identify the sender
164 @param context - sender context, to match reply w/ request
165 @param spd_id - SPD instance id
166 @param sa_id - SA id, optional, set to ~0 to see all policies in SPD
168 define ipsec_spd_dump {
175 /** \brief IPsec policy database response
176 @param context - sender context which was passed in the request
177 €param entry - The SPD entry.
178 @param bytes - byte count of packets matching this policy
179 @param packets - count of packets matching this policy
181 define ipsec_spd_details {
183 vl_api_ipsec_spd_entry_t entry;
186 /** \brief IPsec: Add/delete Security Association Database entry
187 @param client_index - opaque cookie to identify the sender
188 @param context - sender context, to match reply w/ request
189 @param entry - Entry to add or delete
191 define ipsec_sad_entry_add_del
196 vl_api_ipsec_sad_entry_t entry;
198 define ipsec_sad_entry_add_del_reply
205 /** \brief Add or Update Protection for a tunnel with IPSEC
207 Tunnel protection directly associates an SA with all packets
208 ingress and egress on the tunnel. This could also be achieved by
209 assigning an SPD to the tunnel, but that would incur an unnessccary
212 For tunnels the ESP acts on the post-encapsulated packet. So if this
217 where O-IP is the overlay IP addrees that was routed into the tunnel,
218 the resulting encapsulated packet will be:
219 +---------+------+------+
220 | Payload | O-IP | T-IP |
221 +---------+------+------+
222 where T-IP is the tunnel's src.dst IP addresses.
223 If the SAs used for protection are in transport mode then the ESP is
224 inserted before T-IP, i.e.:
225 +---------+------+-----+------+
226 | Payload | O-IP | ESP | T-IP |
227 +---------+------+-----+------+
228 If the SAs used for protection are in tunnel mode then another
229 encapsulation occurs, i.e.:
230 +---------+------+------+-----+------+
231 | Payload | O-IP | T-IP | ESP | C-IP |
232 +---------+------+------+-----+------+
233 where C-IP are the crypto endpoint IP addresses defined as the tunnel
235 The mode for the inbound and outbound SA must be the same.
237 @param client_index - opaque cookie to identify the sender
238 @param context - sender context, to match reply w/ request
239 @param sw_id_index - Tunnel interface to protect
240 @param nh - The peer/next-hop on the tunnel to which the traffic
241 should be protected. For a P2P interface set this to the
243 @param sa_in - The ID [set] of inbound SAs
244 @param sa_out - The ID of outbound SA
246 typedef ipsec_tunnel_protect
248 vl_api_interface_index_t sw_if_index;
255 autoreply define ipsec_tunnel_protect_update
260 vl_api_ipsec_tunnel_protect_t tunnel;
263 autoreply define ipsec_tunnel_protect_del
268 vl_api_interface_index_t sw_if_index;
273 * @brief Dump all tunnel protections
275 define ipsec_tunnel_protect_dump
279 vl_api_interface_index_t sw_if_index;
282 define ipsec_tunnel_protect_details
285 vl_api_ipsec_tunnel_protect_t tun;
288 /** \brief IPsec: Get SPD interfaces
289 @param client_index - opaque cookie to identify the sender
290 @param context - sender context, to match reply w/ request
291 @param spd_index - SPD index
292 @param spd_index_valid - if 1 spd_index is used to filter
293 spd_index's, if 0 no filtering is done
295 define ipsec_spd_interface_dump {
302 /** \brief IPsec: SPD interface response
303 @param context - sender context which was passed in the request
304 @param spd_index - SPD index
305 @param sw_if_index - index of the interface
307 define ipsec_spd_interface_details {
310 vl_api_interface_index_t sw_if_index;
313 /** \brief Add or delete IPsec tunnel interface
316 use the tunnel protect APIs instead
318 @param client_index - opaque cookie to identify the sender
319 @param context - sender context, to match reply w/ request
320 @param is_add - add IPsec tunnel interface if nonzero, else delete
321 @param is_ip6 - tunnel v6 or v4
322 @param esn - enable extended sequence numbers if nonzero, else disable
323 @param anti_replay - enable anti replay check if nonzero, else disable
324 @param local_ip - local IP address
325 @param remote_ip - IP address of remote IPsec peer
326 @param local_spi - SPI of outbound IPsec SA
327 @param remote_spi - SPI of inbound IPsec SA
328 @param crypto_alg - encryption algorithm ID
329 @param local_crypto_key_len - length of local crypto key in bytes
330 @param local_crypto_key - crypto key for outbound IPsec SA
331 @param remote_crypto_key_len - length of remote crypto key in bytes
332 @param remote_crypto_key - crypto key for inbound IPsec SA
333 @param integ_alg - integrity algorithm ID
334 @param local_integ_key_len - length of local integrity key in bytes
335 @param local_integ_key - integrity key for outbound IPsec SA
336 @param remote_integ_key_len - length of remote integrity key in bytes
337 @param remote_integ_key - integrity key for inbound IPsec SA
338 @param renumber - intf display name uses a specified instance if != 0
339 @param show_instance - instance to display for intf if renumber is set
340 @param udp_encap - enable UDP encapsulation for NAT traversal
341 @param tx_table_id - the FIB id used after packet encap
342 @param salt - for use with counter mode ciphers
344 define ipsec_tunnel_if_add_del {
350 vl_api_address_t local_ip;
351 vl_api_address_t remote_ip;
355 u8 local_crypto_key_len;
356 u8 local_crypto_key[128];
357 u8 remote_crypto_key_len;
358 u8 remote_crypto_key[128];
360 u8 local_integ_key_len;
361 u8 local_integ_key[128];
362 u8 remote_integ_key_len;
363 u8 remote_integ_key[128];
371 /** \brief Add/delete IPsec tunnel interface response
372 @param context - sender context, to match reply w/ request
373 @param retval - return status
374 @param sw_if_index - sw_if_index of new interface (for successful add)
376 define ipsec_tunnel_if_add_del_reply {
379 vl_api_interface_index_t sw_if_index;
382 /** \brief Dump IPsec security association
383 @param client_index - opaque cookie to identify the sender
384 @param context - sender context, to match reply w/ request
385 @param sa_id - optional ID of an SA to dump, if ~0 dump all SAs in SAD
387 define ipsec_sa_dump {
393 /** \brief IPsec security association database response
394 @param context - sender context which was passed in the request
395 @param sa_id - SA ID, policy-based SAs >=0, tunnel interface SAs = 0
396 @param sw_if_index - sw_if_index of tunnel interface, policy-based SAs = ~0
397 @param spi - security parameter index
398 @param protocol - IPsec protocol (value from ipsec_protocol_t)
399 @param crypto_alg - crypto algorithm (value from ipsec_crypto_alg_t)
400 @param crypto_key_len - length of crypto_key in bytes
401 @param crypto_key - crypto keying material
402 @param integ_alg - integrity algorithm (value from ipsec_integ_alg_t)
403 @param integ_key_len - length of integ_key in bytes
404 @param integ_key - integrity keying material
405 @param use_esn - using extended sequence numbers when non-zero
406 @param use_anti_replay - using anti-replay window when non-zero
407 @param is_tunnel - IPsec tunnel mode when non-zero, else transport mode
408 @param is_tunnel_ipv6 - If using tunnel mode, endpoints are IPv6
409 @param tunnel_src_addr - Tunnel source address if using tunnel mode
410 @param tunnel_dst_addr - Tunnel destination address is using tunnel mode
411 @param salt - 4 byte salt
412 @param seq - current sequence number for outbound
413 @param seq_hi - high 32 bits of ESN for outbound
414 @param last_seq - highest sequence number received inbound
415 @param last_seq_hi - high 32 bits of highest ESN received inbound
416 @param replay_window - bit map of seq nums received relative to last_seq if using anti-replay
417 @param total_data_size - total bytes sent or received
418 @param udp_encap - 1 if UDP encap enabled, 0 otherwise
420 define ipsec_sa_details {
422 vl_api_ipsec_sad_entry_t entry;
424 vl_api_interface_index_t sw_if_index;
427 u64 last_seq_inbound;
433 /** \brief Set new SA on IPsec interface
437 @param client_index - opaque cookie to identify the sender
438 @param context - sender context, to match reply w/ request
439 @param sw_if_index - index of tunnel interface
440 @param sa_id - ID of SA to use
441 @param is_outbound - 1 if outbound (local) SA, 0 if inbound (remote)
443 autoreply define ipsec_tunnel_if_set_sa {
446 vl_api_interface_index_t sw_if_index;
451 /** \brief Dump IPsec backends
452 @param client_index - opaque cookie to identify the sender
453 @param context - sender context, to match reply w/ request
455 define ipsec_backend_dump {
460 /** \brief IPsec backend details
461 @param name - name of the backend
462 @param protocol - IPsec protocol (value from ipsec_protocol_t)
463 @param index - backend index
464 @param active - set to 1 if the backend is active, otherwise 0
466 define ipsec_backend_details {
469 vl_api_ipsec_proto_t protocol;
474 /** \brief Select IPsec backend
475 @param client_index - opaque cookie to identify the sender
476 @param context - sender context, to match reply w/ request
477 @param protocol - IPsec protocol (value from ipsec_protocol_t)
478 @param index - backend index
480 autoreply define ipsec_select_backend {
483 vl_api_ipsec_proto_t protocol;
489 * eval: (c-set-style "gnu")