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.0";
19 import "vnet/ip/ip_types.api";
21 /** \brief IPsec: Add/delete Security Policy Database
22 @param client_index - opaque cookie to identify the sender
23 @param context - sender context, to match reply w/ request
24 @param is_add - add SPD if non-zero, else delete
25 @param spd_id - SPD instance id (control plane allocated)
28 autoreply define ipsec_spd_add_del
36 /** \brief IPsec: Add/delete SPD from interface
38 @param client_index - opaque cookie to identify the sender
39 @param context - sender context, to match reply w/ request
40 @param is_add - add security mode if non-zero, else delete
41 @param sw_if_index - index of the interface
42 @param spd_id - SPD instance id to use for lookups
46 autoreply define ipsec_interface_add_del_spd
59 /* bypass - no IPsec processing */
60 IPSEC_API_SPD_ACTION_BYPASS = 0,
61 /* discard - discard packet with ICMP processing */
62 IPSEC_API_SPD_ACTION_DISCARD,
63 /* resolve - send request to control plane for SA resolving */
64 IPSEC_API_SPD_ACTION_RESOLVE,
65 /* protect - apply IPsec policy using following parameters */
66 IPSEC_API_SPD_ACTION_PROTECT,
69 /** \brief IPsec: Security Policy Database entry
71 See RFC 4301, 4.4.1.1 on how to match packet to selectors
73 @param spd_id - SPD instance id (control plane allocated)
74 @param priority - priority of SPD entry (non-unique value). Used to order SPD matching - higher priorities match before lower
75 @param is_outbound - entry applies to outbound traffic if non-zero, otherwise applies to inbound traffic
76 @param remote_address_start - start of remote address range to match
77 @param remote_address_stop - end of remote address range to match
78 @param local_address_start - start of local address range to match
79 @param local_address_stop - end of local address range to match
80 @param protocol - protocol type to match [0 means any] otherwise IANA value
81 @param remote_port_start - start of remote port range to match ...
82 @param remote_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
83 @param local_port_start - start of local port range to match ...
84 @param local_port_stop - end of remote port range to match [0 to 65535 means ANY, 65535 to 0 means OPAQUE]
85 @param policy - action to perform on match
86 @param sa_id - SAD instance id (control plane allocated)
88 typedef ipsec_spd_entry
95 vl_api_ipsec_spd_action_t policy;
99 vl_api_address_t remote_address_start;
100 vl_api_address_t remote_address_stop;
101 vl_api_address_t local_address_start;
102 vl_api_address_t local_address_stop;
104 u16 remote_port_start;
105 u16 remote_port_stop;
106 u16 local_port_start;
110 /** \brief IPsec: Add/delete Security Policy Database entry
112 @param client_index - opaque cookie to identify the sender
113 @param context - sender context, to match reply w/ request
114 @param is_add - add SPD if non-zero, else delete
115 @param entry - Description of the entry to add/dell
117 define ipsec_spd_entry_add_del
122 vl_api_ipsec_spd_entry_t entry;
125 /** \brief IPsec: Reply Add/delete Security Policy Database entry
127 @param context - sender context, to match reply w/ request
128 @param retval - success/fail rutrun code
129 @param stat_index - An index for the policy in the stats segment @ /net/ipec/policy
131 define ipsec_spd_entry_add_del_reply
138 /** \brief Dump IPsec all SPD IDs
139 @param client_index - opaque cookie to identify the sender
140 @param context - sender context, to match reply w/ request
142 define ipsec_spds_dump {
147 /** \brief Dump IPsec all SPD IDs response
148 @param client_index - opaque cookie to identify the sender
149 @param spd_id - SPD instance id (control plane allocated)
150 @param npolicies - number of policies in SPD
152 define ipsec_spds_details {
158 /** \brief Dump ipsec policy database data
159 @param client_index - opaque cookie to identify the sender
160 @param context - sender context, to match reply w/ request
161 @param spd_id - SPD instance id
162 @param sa_id - SA id, optional, set to ~0 to see all policies in SPD
164 define ipsec_spd_dump {
171 /** \brief IPsec policy database response
172 @param context - sender context which was passed in the request
173 €param entry - The SPD entry.
174 @param bytes - byte count of packets matching this policy
175 @param packets - count of packets matching this policy
177 define ipsec_spd_details {
179 vl_api_ipsec_spd_entry_t entry;
183 * @brief Support cryptographic algorithms
185 enum ipsec_crypto_alg
187 IPSEC_API_CRYPTO_ALG_NONE = 0,
188 IPSEC_API_CRYPTO_ALG_AES_CBC_128,
189 IPSEC_API_CRYPTO_ALG_AES_CBC_192,
190 IPSEC_API_CRYPTO_ALG_AES_CBC_256,
191 IPSEC_API_CRYPTO_ALG_AES_CTR_128,
192 IPSEC_API_CRYPTO_ALG_AES_CTR_192,
193 IPSEC_API_CRYPTO_ALG_AES_CTR_256,
194 IPSEC_API_CRYPTO_ALG_AES_GCM_128,
195 IPSEC_API_CRYPTO_ALG_AES_GCM_192,
196 IPSEC_API_CRYPTO_ALG_AES_GCM_256,
197 IPSEC_API_CRYPTO_ALG_DES_CBC,
198 IPSEC_API_CRYPTO_ALG_3DES_CBC,
202 * @brief Supported Integrity Algorithms
206 IPSEC_API_INTEG_ALG_NONE = 0,
208 IPSEC_API_INTEG_ALG_MD5_96,
210 IPSEC_API_INTEG_ALG_SHA1_96,
211 /* draft-ietf-ipsec-ciph-sha-256-00 */
212 IPSEC_API_INTEG_ALG_SHA_256_96,
214 IPSEC_API_INTEG_ALG_SHA_256_128,
216 IPSEC_API_INTEG_ALG_SHA_384_192,
218 IPSEC_API_INTEG_ALG_SHA_512_256,
223 IPSEC_API_SAD_FLAG_NONE = 0,
224 /* Enable extended sequence numbers */
225 IPSEC_API_SAD_FLAG_USE_EXTENDED_SEQ_NUM = 0x01,
226 /* Enable Anti-replay */
227 IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY = 0x02,
228 /* IPsec tunnel mode if non-zero, else transport mode */
229 IPSEC_API_SAD_FLAG_IS_TUNNEL = 0x04,
230 /* IPsec tunnel mode is IPv6 if non-zero,
231 * else IPv4 tunnel only valid if is_tunnel is non-zero */
232 IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 = 0x08,
233 /* enable UDP encapsulation for NAT traversal */
234 IPSEC_API_SAD_FLAG_UDP_ENCAP = 0x10,
236 /* come-on Ole please fix this */
237 IPSEC_API_SAD_COMBO_12 = 12,
238 IPSEC_API_SAD_COMBO_20 = 20,
249 /* the length of the key */
251 /* The data for the key */
255 /** \brief IPsec: Security Association Database entry
256 @param client_index - opaque cookie to identify the sender
257 @param context - sender context, to match reply w/ request
258 @param is_add - add SAD entry if non-zero, else delete
259 @param sad_id - sad id
260 @param spi - security parameter index
261 @param protocol - 0 = AH, 1 = ESP
262 @param crypto_algorithm - a supported crypto algorithm
263 @param crypto_key - crypto keying material
264 @param integrity_algorithm - one of the supported algorithms
265 @param integrity_key - integrity keying material
266 @param tunnel_src_address - IPsec tunnel source address IPv6 if is_tunnel_ipv6 is non-zero, else IPv4. Only valid if is_tunnel is non-zero
267 @param tunnel_dst_address - IPsec tunnel destination address IPv6 if is_tunnel_ipv6 is non-zero, else IPv4. Only valid if is_tunnel is non-zero
268 @param tx_table_id - the FIB id used for encapsulated packets
270 typedef ipsec_sad_entry
276 vl_api_ipsec_proto_t protocol;
278 vl_api_ipsec_crypto_alg_t crypto_algorithm;
279 vl_api_key_t crypto_key;
281 vl_api_ipsec_integ_alg_t integrity_algorithm;
282 vl_api_key_t integrity_key;
284 vl_api_ipsec_sad_flags_t flags;
286 vl_api_address_t tunnel_src;
287 vl_api_address_t tunnel_dst;
291 /** \brief IPsec: Add/delete Security Association Database entry
292 @param client_index - opaque cookie to identify the sender
293 @param context - sender context, to match reply w/ request
294 @param entry - Entry to add or delete
296 define ipsec_sad_entry_add_del
301 vl_api_ipsec_sad_entry_t entry;
303 define ipsec_sad_entry_add_del_reply
310 /** \brief IPsec: Update Security Association keys
311 @param client_index - opaque cookie to identify the sender
312 @param context - sender context, to match reply w/ request
316 @param crypto_key - crypto keying material
317 @param integrity_key - integrity keying material
320 autoreply define ipsec_sa_set_key
327 vl_api_key_t crypto_key;
328 vl_api_key_t integrity_key;
331 /** \brief IKEv2: Add/delete profile
332 @param client_index - opaque cookie to identify the sender
333 @param context - sender context, to match reply w/ request
335 @param name - IKEv2 profile name
336 @param is_add - Add IKEv2 profile if non-zero, else delete
338 autoreply define ikev2_profile_add_del
347 /** \brief IKEv2: Set IKEv2 profile authentication method
348 @param client_index - opaque cookie to identify the sender
349 @param context - sender context, to match reply w/ request
351 @param name - IKEv2 profile name
352 @param auth_method - IKEv2 authentication method (shared-key-mic/rsa-sig)
353 @param is_hex - Authentication data in hex format if non-zero, else string
354 @param data_len - Authentication data length
355 @param data - Authentication data (for rsa-sig cert file path)
357 autoreply define ikev2_profile_set_auth
369 /** \brief IKEv2: Set IKEv2 profile local/remote identification
370 @param client_index - opaque cookie to identify the sender
371 @param context - sender context, to match reply w/ request
373 @param name - IKEv2 profile name
374 @param is_local - Identification is local if non-zero, else remote
375 @param id_type - Identification type
376 @param data_len - Identification data length
377 @param data - Identification data
379 autoreply define ikev2_profile_set_id
391 /** \brief IKEv2: Set IKEv2 profile traffic selector parameters
392 @param client_index - opaque cookie to identify the sender
393 @param context - sender context, to match reply w/ request
395 @param name - IKEv2 profile name
396 @param is_local - Traffic selector is local if non-zero, else remote
397 @param proto - Traffic selector IP protocol (if zero not relevant)
398 @param start_port - The smallest port number allowed by traffic selector
399 @param end_port - The largest port number allowed by traffic selector
400 @param start_addr - The smallest address included in traffic selector
401 @param end_addr - The largest address included in traffic selector
403 autoreply define ikev2_profile_set_ts
417 /** \brief IKEv2: Set IKEv2 local RSA private key
418 @param client_index - opaque cookie to identify the sender
419 @param context - sender context, to match reply w/ request
421 @param key_file - Key file absolute path
423 autoreply define ikev2_set_local_key
431 /** \brief IKEv2: Set IKEv2 responder interface and IP address
432 @param client_index - opaque cookie to identify the sender
433 @param context - sender context, to match reply w/ request
435 @param name - IKEv2 profile name
436 @param sw_if_index - interface index
437 @param address - interface address
439 autoreply define ikev2_set_responder
449 /** \brief IKEv2: Set IKEv2 IKE transforms in SA_INIT proposal (RFC 7296)
450 @param client_index - opaque cookie to identify the sender
451 @param context - sender context, to match reply w/ request
453 @param name - IKEv2 profile name
454 @param crypto_alg - encryption algorithm
455 @param crypto_key_size - encryption key size
456 @param integ_alg - integrity algorithm
457 @param dh_group - Diffie-Hellman group
460 autoreply define ikev2_set_ike_transforms
472 /** \brief IKEv2: Set IKEv2 ESP transforms in SA_INIT proposal (RFC 7296)
473 @param client_index - opaque cookie to identify the sender
474 @param context - sender context, to match reply w/ request
476 @param name - IKEv2 profile name
477 @param crypto_alg - encryption algorithm
478 @param crypto_key_size - encryption key size
479 @param integ_alg - integrity algorithm
480 @param dh_group - Diffie-Hellman group
483 autoreply define ikev2_set_esp_transforms
495 /** \brief IKEv2: Set Child SA lifetime, limited by time and/or data
496 @param client_index - opaque cookie to identify the sender
497 @param context - sender context, to match reply w/ request
499 @param name - IKEv2 profile name
500 @param lifetime - SA maximum life time in seconds (0 to disable)
501 @param lifetime_jitter - Jitter added to prevent simultaneous rekeying
502 @param handover - Hand over time
503 @param lifetime_maxdata - SA maximum life time in bytes (0 to disable)
506 autoreply define ikev2_set_sa_lifetime
515 u64 lifetime_maxdata;
518 /** \brief IKEv2: Initiate the SA_INIT exchange
519 @param client_index - opaque cookie to identify the sender
520 @param context - sender context, to match reply w/ request
522 @param name - IKEv2 profile name
525 autoreply define ikev2_initiate_sa_init
533 /** \brief IKEv2: Initiate the delete IKE SA exchange
534 @param client_index - opaque cookie to identify the sender
535 @param context - sender context, to match reply w/ request
537 @param ispi - IKE SA initiator SPI
540 autoreply define ikev2_initiate_del_ike_sa
548 /** \brief IKEv2: Initiate the delete Child SA exchange
549 @param client_index - opaque cookie to identify the sender
550 @param context - sender context, to match reply w/ request
552 @param ispi - Child SA initiator SPI
555 autoreply define ikev2_initiate_del_child_sa
563 /** \brief IKEv2: Initiate the rekey Child SA exchange
564 @param client_index - opaque cookie to identify the sender
565 @param context - sender context, to match reply w/ request
567 @param ispi - Child SA initiator SPI
570 autoreply define ikev2_initiate_rekey_child_sa
578 /** \brief IPsec: Get SPD interfaces
579 @param client_index - opaque cookie to identify the sender
580 @param context - sender context, to match reply w/ request
581 @param spd_index - SPD index
582 @param spd_index_valid - if 1 spd_index is used to filter
583 spd_index's, if 0 no filtering is done
585 define ipsec_spd_interface_dump {
592 /** \brief IPsec: SPD interface response
593 @param context - sender context which was passed in the request
594 @param spd_index - SPD index
595 @param sw_if_index - index of the interface
597 define ipsec_spd_interface_details {
603 /** \brief Add or delete IPsec tunnel interface
604 @param client_index - opaque cookie to identify the sender
605 @param context - sender context, to match reply w/ request
606 @param is_add - add IPsec tunnel interface if nonzero, else delete
607 @param esn - enable extended sequence numbers if nonzero, else disable
608 @param anti_replay - enable anti replay check if nonzero, else disable
609 @param local_ip - local IP address
610 @param remote_ip - IP address of remote IPsec peer
611 @param local_spi - SPI of outbound IPsec SA
612 @param remote_spi - SPI of inbound IPsec SA
613 @param crypto_alg - encryption algorithm ID
614 @param local_crypto_key_len - length of local crypto key in bytes
615 @param local_crypto_key - crypto key for outbound IPsec SA
616 @param remote_crypto_key_len - length of remote crypto key in bytes
617 @param remote_crypto_key - crypto key for inbound IPsec SA
618 @param integ_alg - integrity algorithm ID
619 @param local_integ_key_len - length of local integrity key in bytes
620 @param local_integ_key - integrity key for outbound IPsec SA
621 @param remote_integ_key_len - length of remote integrity key in bytes
622 @param remote_integ_key - integrity key for inbound IPsec SA
623 @param renumber - intf display name uses a specified instance if != 0
624 @param show_instance - instance to display for intf if renumber is set
625 @param udp_encap - enable UDP encapsulation for NAT traversal
626 @param tx_table_id - the FIB id used after packet encap
628 define ipsec_tunnel_if_add_del {
639 u8 local_crypto_key_len;
640 u8 local_crypto_key[128];
641 u8 remote_crypto_key_len;
642 u8 remote_crypto_key[128];
644 u8 local_integ_key_len;
645 u8 local_integ_key[128];
646 u8 remote_integ_key_len;
647 u8 remote_integ_key[128];
654 /** \brief Add/delete IPsec tunnel interface response
655 @param context - sender context, to match reply w/ request
656 @param retval - return status
657 @param sw_if_index - sw_if_index of new interface (for successful add)
659 define ipsec_tunnel_if_add_del_reply {
665 /** \brief Dump IPsec security association
666 @param client_index - opaque cookie to identify the sender
667 @param context - sender context, to match reply w/ request
668 @param sa_id - optional ID of an SA to dump, if ~0 dump all SAs in SAD
670 define ipsec_sa_dump {
676 /** \brief IPsec security association database response
677 @param context - sender context which was passed in the request
678 @param sa_id - SA ID, policy-based SAs >=0, tunnel interface SAs = 0
679 @param sw_if_index - sw_if_index of tunnel interface, policy-based SAs = ~0
680 @param spi - security parameter index
681 @param protocol - IPsec protocol (value from ipsec_protocol_t)
682 @param crypto_alg - crypto algorithm (value from ipsec_crypto_alg_t)
683 @param crypto_key_len - length of crypto_key in bytes
684 @param crypto_key - crypto keying material
685 @param integ_alg - integrity algorithm (value from ipsec_integ_alg_t)
686 @param integ_key_len - length of integ_key in bytes
687 @param integ_key - integrity keying material
688 @param use_esn - using extended sequence numbers when non-zero
689 @param use_anti_replay - using anti-replay window when non-zero
690 @param is_tunnel - IPsec tunnel mode when non-zero, else transport mode
691 @param is_tunnel_ipv6 - If using tunnel mode, endpoints are IPv6
692 @param tunnel_src_addr - Tunnel source address if using tunnel mode
693 @param tunnel_dst_addr - Tunnel destination address is using tunnel mode
694 @param salt - 4 byte salt
695 @param seq - current sequence number for outbound
696 @param seq_hi - high 32 bits of ESN for outbound
697 @param last_seq - highest sequence number received inbound
698 @param last_seq_hi - high 32 bits of highest ESN received inbound
699 @param replay_window - bit map of seq nums received relative to last_seq if using anti-replay
700 @param total_data_size - total bytes sent or received
701 @param udp_encap - 1 if UDP encap enabled, 0 otherwise
703 define ipsec_sa_details {
705 vl_api_ipsec_sad_entry_t entry;
710 u64 last_seq_inbound;
716 /** \brief Set key on IPsec interface
717 @param client_index - opaque cookie to identify the sender
718 @param context - sender context, to match reply w/ request
719 @param sw_if_index - index of tunnel interface
720 @param key_type - type of key being set
721 @param alg - algorithm used with key
722 @param key_len - length key in bytes
725 autoreply define ipsec_tunnel_if_set_key {
735 /** \brief Set new SA on IPsec interface
736 @param client_index - opaque cookie to identify the sender
737 @param context - sender context, to match reply w/ request
738 @param sw_if_index - index of tunnel interface
739 @param sa_id - ID of SA to use
740 @param is_outbound - 1 if outbound (local) SA, 0 if inbound (remote)
742 autoreply define ipsec_tunnel_if_set_sa {
750 /** \brief Dump IPsec backends
751 @param client_index - opaque cookie to identify the sender
752 @param context - sender context, to match reply w/ request
754 define ipsec_backend_dump {
759 /** \brief IPsec backend details
760 @param name - name of the backend
761 @param protocol - IPsec protocol (value from ipsec_protocol_t)
762 @param index - backend index
763 @param active - set to 1 if the backend is active, otherwise 0
765 define ipsec_backend_details {
768 vl_api_ipsec_proto_t protocol;
773 /** \brief Select IPsec backend
774 @param client_index - opaque cookie to identify the sender
775 @param context - sender context, to match reply w/ request
776 @param protocol - IPsec protocol (value from ipsec_protocol_t)
777 @param index - backend index
779 autoreply define ipsec_select_backend {
782 vl_api_ipsec_proto_t protocol;
788 * eval: (c-set-style "gnu")