]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_encap_types.h
bgpd: Fixes and updates for VPNv6
[mirror_frr.git] / bgpd / bgp_encap_types.h
CommitLineData
f4c89855
LB
1/*
2 * Copyright 2015, LabN Consulting, L.L.C.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 */
19
20#ifndef _QUAGGA_BGP_ENCAP_TYPES_H
21#define _QUAGGA_BGP_ENCAP_TYPES_H
22
23/* from http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#tunnel-types */
24typedef enum {
25 BGP_ENCAP_TYPE_RESERVED=0,
26 BGP_ENCAP_TYPE_L2TPV3_OVER_IP=1,
27 BGP_ENCAP_TYPE_GRE=2,
28 BGP_ENCAP_TYPE_TRANSMIT_TUNNEL_ENDPOINT=3,
29 BGP_ENCAP_TYPE_IPSEC_IN_TUNNEL_MODE=4,
30 BGP_ENCAP_TYPE_IP_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE=5,
31 BGP_ENCAP_TYPE_MPLS_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE=6,
32 BGP_ENCAP_TYPE_IP_IN_IP=7,
33 BGP_ENCAP_TYPE_VXLAN=8,
34 BGP_ENCAP_TYPE_NVGRE=9,
35 BGP_ENCAP_TYPE_MPLS=10,
36 BGP_ENCAP_TYPE_MPLS_IN_GRE=11,
37 BGP_ENCAP_TYPE_VXLAN_GPE=12,
38 BGP_ENCAP_TYPE_MPLS_IN_UDP=13,
39 BGP_ENCAP_TYPE_PBB
40} bgp_encap_types;
41
42typedef enum {
43 BGP_ENCAP_SUBTLV_TYPE_ENCAPSULATION=1,
44 BGP_ENCAP_SUBTLV_TYPE_PROTO_TYPE=2,
45 BGP_ENCAP_SUBTLV_TYPE_IPSEC_TA=3,
46 BGP_ENCAP_SUBTLV_TYPE_COLOR=4,
47} bgp_encap_subtlv_types;
48
49/*
50 * Tunnel Encapsulation Attribute subtlvs
51 */
52struct bgp_tea_subtlv_encap_l2tpv3_over_ip {
53 uint32_t sessionid;
54 uint8_t cookie_length;
55 uint8_t cookie[8];
56};
57
58struct bgp_tea_subtlv_encap_gre_key {
59 uint32_t gre_key;
60};
61
62struct bgp_tea_subtlv_encap_pbb {
63 uint32_t flag_isid:1;
64 uint32_t flag_vid:1;
65 uint32_t isid:24;
66 uint16_t vid:12;
67 uint8_t macaddr[6];
68};
69
70struct bgp_tea_subtlv_proto_type {
71 uint16_t proto; /* ether-type */
72};
73
74struct bgp_tea_subtlv_color {
75 uint32_t color;
76};
77
78/*
79 * This is the length of the value part of the ipsec tunnel authenticator
80 * subtlv. Currently we only support the length for authenticator type 1.
81 */
82#define BGP_ENCAP_SUBTLV_IPSEC_TA_SIZE 20
83
84struct bgp_tea_subtlv_ipsec_ta {
85 uint16_t authenticator_type; /* only type 1 is supported so far */
86 uint8_t authenticator_length; /* octets in value field */
87 uint8_t value[BGP_ENCAP_SUBTLV_IPSEC_TA_SIZE];
88};
89
90/*
91 * Subtlv valid flags
92 * TBD change names to add "VALID"
93 */
94#define BGP_TEA_SUBTLV_ENCAP 0x00000001
95#define BGP_TEA_SUBTLV_PROTO_TYPE 0x00000002
96#define BGP_TEA_SUBTLV_COLOR 0x00000004
97#define BGP_TEA_SUBTLV_IPSEC_TA 0x00000008
98
99
100/*
101 * Tunnel Type-specific APIs
102 */
103struct bgp_encap_type_reserved {
104};
105
106struct bgp_encap_type_l2tpv3_over_ip {
107 uint32_t valid_subtlvs;
108 struct bgp_tea_subtlv_encap_l2tpv3_over_ip st_encap;
109 struct bgp_tea_subtlv_proto_type st_proto; /* optional */
110 struct bgp_tea_subtlv_color st_color; /* optional */
111};
112
113struct bgp_encap_type_gre {
114 uint32_t valid_subtlvs;
115 struct bgp_tea_subtlv_encap_gre_key st_encap; /* optional */
116 struct bgp_tea_subtlv_proto_type st_proto; /* optional */
117 struct bgp_tea_subtlv_color st_color; /* optional */
118};
119
120struct bgp_encap_type_ip_in_ip {
121 uint32_t valid_subtlvs;
122 struct bgp_tea_subtlv_proto_type st_proto; /* optional */
123 struct bgp_tea_subtlv_color st_color; /* optional */
124};
125
126struct bgp_encap_type_transmit_tunnel_endpoint {
127 /* No subtlvs defined in spec? */
128};
129
130struct bgp_encap_type_ipsec_in_tunnel_mode {
131 uint32_t valid_subtlvs;
132 struct bgp_tea_subtlv_ipsec_ta st_ipsec_ta; /* optional */
133};
134
135struct bgp_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode {
136 uint32_t valid_subtlvs;
137 struct bgp_tea_subtlv_ipsec_ta st_ipsec_ta; /* optional */
138};
139
140struct bgp_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode {
141 uint32_t valid_subtlvs;
142 struct bgp_tea_subtlv_ipsec_ta st_ipsec_ta; /* optional */
143};
144
145struct bgp_encap_type_vxlan {
146 /* No subtlvs defined in spec? */
147};
148
149struct bgp_encap_type_nvgre {
150 /* No subtlvs defined in spec? */
151};
152
153struct bgp_encap_type_mpls {
154 /* No subtlvs defined in spec? */
155};
156
157struct bgp_encap_type_mpls_in_gre {
158 /* No subtlvs defined in spec? */
159};
160
161struct bgp_encap_type_vxlan_gpe {
162 /* No subtlvs defined in spec? */
163};
164
165struct bgp_encap_type_mpls_in_udp {
166 /* No subtlvs defined in spec? */
167};
168
169struct bgp_encap_type_pbb {
170 uint32_t valid_subtlvs;
171 struct bgp_tea_subtlv_encap_pbb st_encap;
172};
173
174#endif /* _QUAGGA_BGP_ENCAP_TYPES_H */