Neale Ranns | 9534696 | 2019-11-25 13:04:44 +0000 | [diff] [blame] | 1 | /* Hey Emacs use -*- mode: C -*- */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2018 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 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 17 | /** |
| 18 | * The IPIP module implements IP{v4,v6} over IP{v4,v6} tunnelling as |
| 19 | * described in RFC2473 and to some extent the largely historical |
| 20 | * RFC1853. The module also supports an IPv4 over IPv6 automatic |
| 21 | * tunnelling mechanism called 6RD (RFC5969). |
| 22 | * |
| 23 | * The IPIP API module supports a CRD model for adding, deleting and |
| 24 | * listing tunnels. A tunnel is represented as an interface in |
| 25 | * VPP. The "handle" representing a tunnel is the sw_if_index. As any |
| 26 | * interface, the user must configure an IPv4 and/or IPv6 address on |
| 27 | * the interface. This is the inner or payload protocol. |
| 28 | * |
| 29 | * Tunnel MTU: The tunnel MTU (the payload MTU) is configurable per |
| 30 | * protocol. If a tunnel MTU is larger than the path MTU, the outer |
| 31 | * packet will be fragmented. Fragmentation support is configurable, |
| 32 | * as it can have severe performance issues, and might be used as an |
| 33 | * attack vector (the remote side must reassemble.) |
| 34 | * |
| 35 | * Traffic class / TOS field can either be configured to a fixed |
| 36 | * value, or can be copied from the inner to the outer header. |
| 37 | * (For now we have stolen ~0 to indicate copy). |
| 38 | * |
| 39 | * Note: |
| 40 | * |
| 41 | * - The Tunnel encapsulation limit described in RFC2473 is not |
| 42 | * implemented. |
| 43 | * |
| 44 | * - ICMP proxying, as in a tunnel head-end receiving ICMP erors on |
| 45 | * the outer packet is currently not relayed to the original source |
| 46 | * of the packet. |
| 47 | * |
| 48 | * - PMTUD / MTU probing and tunnel keepalives are not yet implemented. |
| 49 | * |
| 50 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 51 | |
Neale Ranns | 59ff918 | 2019-12-29 23:55:18 +0000 | [diff] [blame] | 52 | option version = "2.0.1"; |
Neale Ranns | 9534696 | 2019-11-25 13:04:44 +0000 | [diff] [blame] | 53 | |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 54 | import "vnet/interface_types.api"; |
Neale Ranns | cbd0824 | 2019-05-26 11:34:27 -0700 | [diff] [blame] | 55 | import "vnet/ip/ip_types.api"; |
Neale Ranns | 59ff918 | 2019-12-29 23:55:18 +0000 | [diff] [blame] | 56 | import "vnet/tunnel/tunnel_types.api"; |
Neale Ranns | cbd0824 | 2019-05-26 11:34:27 -0700 | [diff] [blame] | 57 | |
| 58 | /** |
| 59 | * An IP{v4,v6} over IP{v4,v6} tunnel. |
| 60 | */ |
| 61 | typedef ipip_tunnel |
| 62 | { |
Ole Troan | 288e093 | 2019-05-29 12:30:05 +0200 | [diff] [blame] | 63 | u32 instance; /* If non-~0, specifies a custom dev instance */ |
Neale Ranns | cbd0824 | 2019-05-26 11:34:27 -0700 | [diff] [blame] | 64 | vl_api_address_t src; |
| 65 | vl_api_address_t dst; |
Ole Troan | 288e093 | 2019-05-29 12:30:05 +0200 | [diff] [blame] | 66 | vl_api_interface_index_t sw_if_index; /* ignored on create, set in |
| 67 | details/dump */ |
| 68 | u32 table_id; |
Neale Ranns | 59ff918 | 2019-12-29 23:55:18 +0000 | [diff] [blame] | 69 | vl_api_tunnel_encap_decap_flags_t flags; |
Neale Ranns | 14053c9 | 2019-12-29 23:55:18 +0000 | [diff] [blame^] | 70 | vl_api_tunnel_mode_t mode; |
Neale Ranns | 9534696 | 2019-11-25 13:04:44 +0000 | [diff] [blame] | 71 | vl_api_ip_dscp_t dscp; /* DSCP value for the tunnel encap, |
| 72 | ignored if ECNAP_COPY_DSCP flag is set */ |
Neale Ranns | cbd0824 | 2019-05-26 11:34:27 -0700 | [diff] [blame] | 73 | }; |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 74 | |
| 75 | /** |
| 76 | * Create an IP{v4,v6} over IP{v4,v6} tunnel. |
| 77 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 78 | define ipip_add_tunnel |
| 79 | { |
| 80 | u32 client_index; |
| 81 | u32 context; |
Neale Ranns | cbd0824 | 2019-05-26 11:34:27 -0700 | [diff] [blame] | 82 | vl_api_ipip_tunnel_t tunnel; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | define ipip_add_tunnel_reply |
| 86 | { |
| 87 | u32 context; |
| 88 | i32 retval; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 89 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 90 | }; |
| 91 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 92 | /** |
| 93 | * Delete an IP{v4,v6} over IP{v4,v6} tunnel. |
| 94 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 95 | autoreply define ipip_del_tunnel |
| 96 | { |
| 97 | u32 client_index; |
| 98 | u32 context; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 99 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 100 | }; |
| 101 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 102 | /** |
| 103 | * Create an IPv4 over IPv6 automatic tunnel (6RD) |
| 104 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 105 | define ipip_6rd_add_tunnel |
| 106 | { |
| 107 | u32 client_index; |
| 108 | u32 context; |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 109 | u32 ip6_table_id; |
| 110 | u32 ip4_table_id; |
Ole Troan | 288e093 | 2019-05-29 12:30:05 +0200 | [diff] [blame] | 111 | vl_api_ip6_prefix_t ip6_prefix; |
| 112 | vl_api_ip4_prefix_t ip4_prefix; |
| 113 | vl_api_ip4_address_t ip4_src; |
| 114 | bool security_check; |
| 115 | u8 tc_tos; /* If ~0, the TOS/TC value is copied from |
| 116 | inner packet, otherwise set to value */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 117 | }; |
| 118 | |
| 119 | define ipip_6rd_add_tunnel_reply |
| 120 | { |
| 121 | u32 context; |
| 122 | i32 retval; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 123 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 124 | }; |
| 125 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 126 | /** |
| 127 | * Delete an IPv4 over IPv6 automatic tunnel (6RD) |
| 128 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 129 | autoreply define ipip_6rd_del_tunnel |
| 130 | { |
| 131 | u32 client_index; |
| 132 | u32 context; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 133 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 134 | }; |
| 135 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 136 | /** |
| 137 | * List all IPIP tunnels |
| 138 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 139 | define ipip_tunnel_dump |
| 140 | { |
| 141 | u32 client_index; |
| 142 | u32 context; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 143 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 144 | }; |
| 145 | |
| 146 | define ipip_tunnel_details |
| 147 | { |
| 148 | u32 context; |
Neale Ranns | cbd0824 | 2019-05-26 11:34:27 -0700 | [diff] [blame] | 149 | vl_api_ipip_tunnel_t tunnel; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 150 | }; |