Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | #ifndef included_vnet_gre_packet_h |
| 2 | #define included_vnet_gre_packet_h |
| 3 | |
| 4 | /* |
| 5 | * GRE packet format |
| 6 | * |
| 7 | * Copyright (c) 2012 Cisco and/or its affiliates. |
| 8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | * you may not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at: |
| 11 | * |
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | * |
| 14 | * Unless required by applicable law or agreed to in writing, software |
| 15 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | * See the License for the specific language governing permissions and |
| 18 | * limitations under the License. |
| 19 | */ |
| 20 | |
| 21 | #define foreach_gre_protocol \ |
| 22 | _ (0x0800, ip4) \ |
| 23 | _ (0x86DD, ip6) \ |
David Hotham | a8cd309 | 2016-09-19 09:55:07 -0700 | [diff] [blame] | 24 | _ (0x6558, teb) \ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 25 | _ (0x0806, arp) \ |
| 26 | _ (0x8847, mpls_unicast) \ |
| 27 | _ (0x894F, nsh) |
| 28 | |
| 29 | typedef enum { |
| 30 | #define _(n,f) GRE_PROTOCOL_##f = n, |
| 31 | foreach_gre_protocol |
| 32 | #undef _ |
| 33 | } gre_protocol_t; |
| 34 | |
| 35 | typedef struct { |
| 36 | /* flags and version */ |
| 37 | u16 flags_and_version; |
| 38 | /* unimplemented at the moment */ |
| 39 | #define GRE_FLAGS_CHECKSUM (1 << 15) |
| 40 | |
| 41 | /* deprecated, according to rfc2784 */ |
| 42 | #define GRE_FLAGS_ROUTING (1 << 14) |
| 43 | #define GRE_FLAGS_KEY (1 << 13) |
| 44 | #define GRE_FLAGS_SEQUENCE (1 << 12) |
| 45 | #define GRE_FLAGS_STRICT_SOURCE_ROUTE (1 << 11) |
| 46 | |
| 47 | /* version 1 is PPTP which we don't support */ |
| 48 | #define GRE_SUPPORTED_VERSION 0 |
| 49 | #define GRE_VERSION_MASK 0x7 |
| 50 | |
| 51 | /* 0x800 for ip4, etc. */ |
| 52 | u16 protocol; |
| 53 | } gre_header_t; |
| 54 | |
| 55 | #endif /* included_vnet_gre_packet_h */ |