Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 2 | * Copyright (c) 2016 Cisco and/or its affiliates. |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 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 | */ |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 15 | /** |
| 16 | * @file |
| 17 | * @brief LISP-GPE packet header structure |
| 18 | * |
| 19 | */ |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 20 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 21 | #ifndef included_lisp_gpe_packet_h |
| 22 | #define included_lisp_gpe_packet_h |
| 23 | |
| 24 | /* |
| 25 | * From draft-lewis-lisp-gpe-02.txt |
| 26 | * |
| 27 | * 0 1 2 3 |
| 28 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 29 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 30 | * |N|L|E|V|I|P|R|O|Ver| Reserved | Next Protocol | |
| 31 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 32 | * | Instance ID/Locator-Status-Bits | |
| 33 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 34 | * |
| 35 | * N: The N-bit is the nonce-present bit. When this bit is set to 1, |
| 36 | * the low-order 24 bits of the first 32 bits of the LISP header |
| 37 | * contain a Nonce. See Section 6.3.1 for details. Both N- and |
| 38 | * V-bits MUST NOT be set in the same packet. If they are, a |
| 39 | * decapsulating ETR MUST treat the 'Nonce/Map-Version' field as |
| 40 | * having a Nonce value present. |
| 41 | * |
| 42 | * L: The L-bit is the 'Locator-Status-Bits' field enabled bit. When |
| 43 | * this bit is set to 1, the Locator-Status-Bits in the second |
| 44 | * 32 bits of the LISP header are in use. |
| 45 | * |
| 46 | * E: The E-bit is the echo-nonce-request bit. This bit MUST be ignored |
| 47 | * and has no meaning when the N-bit is set to 0. When the N-bit is |
| 48 | * set to 1 and this bit is set to 1, an ITR is requesting that the |
| 49 | * nonce value in the 'Nonce' field be echoed back in LISP- |
| 50 | * encapsulated packets when the ITR is also an ETR. See |
| 51 | * Section 6.3.1 for details. |
| 52 | * |
| 53 | * V: The V-bit is the Map-Version present bit. When this bit is set to |
| 54 | * 1, the N-bit MUST be 0. Refer to Section 6.6.3 for more details. |
| 55 | * |
| 56 | * I: The I-bit is the Instance ID bit. See Section 5.5 for more |
| 57 | * details. When this bit is set to 1, the 'Locator-Status-Bits' |
| 58 | * field is reduced to 8 bits and the high-order 24 bits are used as |
| 59 | * an Instance ID. If the L-bit is set to 0, then the low-order |
| 60 | * 8 bits are transmitted as zero and ignored on receipt. |
| 61 | * |
| 62 | * P Bit: Flag bit 5 is defined as the Next Protocol bit. The P bit |
| 63 | * MUST be set to 1 to indicate the presence of the 8 bit next |
| 64 | * protocol field. |
| 65 | * |
| 66 | * P = 0 indicates that the payload MUST conform to LISP as defined |
| 67 | * in [RFC6830]. |
| 68 | * |
| 69 | * Flag bit 5 was chosen as the P bit because this flag bit is |
| 70 | * currently unallocated in LISP [RFC6830]. |
| 71 | * |
| 72 | * O: Flag bit 7 is defined as the O bit. When the O bit is set to 1, the |
| 73 | * packet is an OAM packet and OAM processing MUST occur. The OAM |
| 74 | * protocol details are out of scope for this document. As with the |
| 75 | * P-bit, bit 7 is currently a reserved flag in [RFC6830]. |
| 76 | * |
| 77 | * Next Protocol Field: The lower 8 bits of the first word are used to |
| 78 | * carry a next protocol. This next protocol field contains the |
| 79 | * protocol of the encapsulated payload packet. |
| 80 | * |
| 81 | * LISP [RFC6830] uses the lower 16 bits of the first word for either |
| 82 | * a nonce, an echo-nonce ([RFC6830]) or to support map-versioning |
| 83 | * ([RFC6834]). These are all optional capabilities that are |
| 84 | * indicated by setting the N, E, and the V bit respectively. |
| 85 | * |
| 86 | * To maintain the desired data plane compatibility, when the P bit |
| 87 | * is set, the N, E, and V bits MUST be set to zero. |
| 88 | * |
| 89 | * A new protocol registry will be requested from IANA for the Next |
| 90 | * Protocol field. This draft defines the following Next Protocol |
| 91 | * values: |
| 92 | * |
| 93 | * 0x1 : IPv4 |
| 94 | * 0x2 : IPv6 |
| 95 | * 0x3 : Ethernet |
| 96 | * 0x4: Network Service Header |
| 97 | */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 98 | |
Florin Coras | ff0bf13 | 2016-09-05 19:30:35 +0200 | [diff] [blame] | 99 | /** LISP-GPE header */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 100 | typedef struct |
| 101 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 102 | u8 flags; |
| 103 | u8 ver_res; |
| 104 | u8 res; |
| 105 | u8 next_protocol; |
| 106 | u32 iid; |
| 107 | } lisp_gpe_header_t; |
| 108 | |
| 109 | #define foreach_lisp_gpe_flag_bit \ |
| 110 | _(N, 0x80) \ |
| 111 | _(L, 0x40) \ |
| 112 | _(E, 0x20) \ |
| 113 | _(V, 0x10) \ |
| 114 | _(I, 0x08) \ |
| 115 | _(P, 0x04) \ |
| 116 | _(O, 0x01) |
| 117 | |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 118 | typedef enum |
| 119 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 120 | #define _(n,v) LISP_GPE_FLAGS_##n = v, |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 121 | foreach_lisp_gpe_flag_bit |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 122 | #undef _ |
| 123 | } vnet_lisp_gpe_flag_bit_t; |
| 124 | |
| 125 | #define LISP_GPE_VERSION 0x0 |
| 126 | |
| 127 | #define LISP_GPE_NEXT_PROTOCOL_IP4 0x1 |
| 128 | #define LISP_GPE_NEXT_PROTOCOL_IP6 0x2 |
| 129 | #define LISP_GPE_NEXT_PROTOCOL_ETHERNET 0x3 |
| 130 | #define LISP_GPE_NEXT_PROTOCOL_NSH 0x4 |
| 131 | |
Florin Coras | e127a7e | 2016-02-18 22:20:01 +0100 | [diff] [blame] | 132 | typedef enum |
| 133 | { |
| 134 | LISP_GPE_NEXT_PROTO_IP4 = 1, |
| 135 | LISP_GPE_NEXT_PROTO_IP6, |
| 136 | LISP_GPE_NEXT_PROTO_ETHERNET, |
| 137 | LISP_GPE_NEXT_PROTO_NSH, |
| 138 | LISP_GPE_NEXT_PROTOS |
| 139 | } lisp_gpe_next_protocol_e; |
| 140 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 141 | #endif /* included_lisp_gpe_packet_h */ |
Florin Coras | 220beac | 2016-08-16 23:04:00 +0200 | [diff] [blame] | 142 | |
| 143 | /* |
| 144 | * fd.io coding-style-patch-verification: ON |
| 145 | * |
| 146 | * Local Variables: |
| 147 | * eval: (c-set-style "gnu") |
| 148 | * End: |
| 149 | */ |