Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 16 | /** |
| 17 | * The IPIP module implements IP{v4,v6} over IP{v4,v6} tunnelling as |
| 18 | * described in RFC2473 and to some extent the largely historical |
| 19 | * RFC1853. The module also supports an IPv4 over IPv6 automatic |
| 20 | * tunnelling mechanism called 6RD (RFC5969). |
| 21 | * |
| 22 | * The IPIP API module supports a CRD model for adding, deleting and |
| 23 | * listing tunnels. A tunnel is represented as an interface in |
| 24 | * VPP. The "handle" representing a tunnel is the sw_if_index. As any |
| 25 | * interface, the user must configure an IPv4 and/or IPv6 address on |
| 26 | * the interface. This is the inner or payload protocol. |
| 27 | * |
| 28 | * Tunnel MTU: The tunnel MTU (the payload MTU) is configurable per |
| 29 | * protocol. If a tunnel MTU is larger than the path MTU, the outer |
| 30 | * packet will be fragmented. Fragmentation support is configurable, |
| 31 | * as it can have severe performance issues, and might be used as an |
| 32 | * attack vector (the remote side must reassemble.) |
| 33 | * |
| 34 | * Traffic class / TOS field can either be configured to a fixed |
| 35 | * value, or can be copied from the inner to the outer header. |
| 36 | * (For now we have stolen ~0 to indicate copy). |
| 37 | * |
| 38 | * Note: |
| 39 | * |
| 40 | * - The Tunnel encapsulation limit described in RFC2473 is not |
| 41 | * implemented. |
| 42 | * |
| 43 | * - ICMP proxying, as in a tunnel head-end receiving ICMP erors on |
| 44 | * the outer packet is currently not relayed to the original source |
| 45 | * of the packet. |
| 46 | * |
| 47 | * - PMTUD / MTU probing and tunnel keepalives are not yet implemented. |
| 48 | * |
| 49 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 50 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 51 | option version = "1.1.0"; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 52 | import "vnet/interface_types.api"; |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Create an IP{v4,v6} over IP{v4,v6} tunnel. |
| 56 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 57 | define ipip_add_tunnel |
| 58 | { |
| 59 | u32 client_index; |
| 60 | u32 context; |
| 61 | u8 is_ipv6; |
| 62 | u32 instance; /* If non-~0, specifies a custom dev instance */ |
| 63 | u8 src_address[16]; |
| 64 | u8 dst_address[16]; |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 65 | u32 table_id; |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 66 | u8 tc_tos; /* If ~0, the TOS/TC value is copied from |
| 67 | inner packet, otherwise set to value */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | define ipip_add_tunnel_reply |
| 71 | { |
| 72 | u32 context; |
| 73 | i32 retval; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 74 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 75 | }; |
| 76 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 77 | /** |
| 78 | * Delete an IP{v4,v6} over IP{v4,v6} tunnel. |
| 79 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 80 | autoreply define ipip_del_tunnel |
| 81 | { |
| 82 | u32 client_index; |
| 83 | u32 context; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 84 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 85 | }; |
| 86 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 87 | /** |
| 88 | * Create an IPv4 over IPv6 automatic tunnel (6RD) |
| 89 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 90 | define ipip_6rd_add_tunnel |
| 91 | { |
| 92 | u32 client_index; |
| 93 | u32 context; |
Neale Ranns | 6150211 | 2018-08-22 00:21:14 -0700 | [diff] [blame] | 94 | u32 ip6_table_id; |
| 95 | u32 ip4_table_id; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 96 | u8 ip6_prefix[16]; |
| 97 | u8 ip4_prefix[4]; |
| 98 | u8 ip4_src[4]; |
| 99 | u8 ip6_prefix_len; |
| 100 | u8 ip4_prefix_len; |
| 101 | u8 security_check; |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 102 | u8 tc_tos; /* If ~0, the TOS/TC value is copied from |
| 103 | inner packet, otherwise set to value */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | define ipip_6rd_add_tunnel_reply |
| 107 | { |
| 108 | u32 context; |
| 109 | i32 retval; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 110 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 111 | }; |
| 112 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 113 | /** |
| 114 | * Delete an IPv4 over IPv6 automatic tunnel (6RD) |
| 115 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 116 | autoreply define ipip_6rd_del_tunnel |
| 117 | { |
| 118 | u32 client_index; |
| 119 | u32 context; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 120 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 121 | }; |
| 122 | |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 123 | /** |
| 124 | * List all IPIP tunnels |
| 125 | */ |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 126 | define ipip_tunnel_dump |
| 127 | { |
| 128 | u32 client_index; |
| 129 | u32 context; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 130 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 131 | }; |
| 132 | |
| 133 | define ipip_tunnel_details |
| 134 | { |
| 135 | u32 context; |
Ole Troan | 53fffa1 | 2018-11-13 12:36:56 +0100 | [diff] [blame] | 136 | vl_api_interface_index_t sw_if_index; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 137 | u32 instance; |
| 138 | u8 is_ipv6; |
| 139 | u8 src_address[16]; |
| 140 | u8 dst_address[16]; |
| 141 | u32 fib_index; |
Ole Troan | d57f636 | 2018-05-24 13:21:43 +0200 | [diff] [blame] | 142 | u8 tc_tos; |
Ole Troan | 298c695 | 2018-03-08 12:30:43 +0100 | [diff] [blame] | 143 | }; |
| 144 | |
| 145 | /* |
| 146 | * Local Variables: |
| 147 | * eval: (c-set-style "gnu") |
| 148 | * End: |
| 149 | */ |