FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
mobile.h
Go to the documentation of this file.
1 /*
2  * srv6_end.h
3  *
4  * Copyright (c) 2019 Arrcus Inc and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __included_srv6_end_h__
19 #define __included_srv6_end_h__
20 
21 #include <vnet/vnet.h>
22 #include <vnet/ip/ip.h>
23 #include <vnet/srv6/sr.h>
24 #include <vnet/srv6/sr_packet.h>
25 
26 #include <vppinfra/error.h>
27 #include <vppinfra/elog.h>
28 
29 #define SRV6_GTP_UDP_DST_PORT 2152
30 
31 #define SRV6_NHTYPE_NONE 0
32 #define SRV6_NHTYPE_IPV4 1
33 #define SRV6_NHTYPE_IPV6 2
34 #define SRV6_NHTYPE_NON_IP 3
35 
36 #ifndef IP_PROTOCOL_IP6_ETHERNET
37 #define IP_PROTOCOL_IP6_ETHERNET 143
38 #endif
39 
40 #define SRV6_GTP6_UNKNOW 0
41 #define SRV6_GTP6_DT4 1
42 #define SRV6_GTP6_DT6 2
43 #define SRV6_GTP6_DT46 3
44 
45 #define SRV6_GTP4_UNKNOW 0
46 #define SRV6_GTP4_DT4 1
47 #define SRV6_GTP4_DT6 2
48 #define SRV6_GTP4_DT46 3
49 
50 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
51 #define BITALIGN2(A,B) A; B
52 #define BITALIGN3(A,B,C) A; B; C
53 #else
54 #define BITALIGN2(A,B) B; A
55 #define BITALIGN3(A,B,C) C; B; A
56 #endif
57 
58 #define GTPU_EXTHDR_FLAG 0x04
59 #define GTPU_SEQ_FLAG 0x02
60 #define GTPU_EXTHDR_PDU_SESSION 0x85
61 
62 #define SRH_TAG_ECHO_REPLY 0x0008
63 #define SRH_TAG_ECHO_REQUEST 0x0004
64 #define SRH_TAG_ERROR_INDICATION 0x0002
65 #define SRH_TAG_END_MARKER 0x0001
66 
67 #define GTPU_RECOVERY_IE_TYPE 0x0e
68 
69 #define GTPU_IE_MAX_SIZ 256
70 #define SRH_TLV_USER_PLANE_CONTAINER 0x0a /* tentative */
71 
72 /* *INDENT-OFF* */
73 typedef struct
74 {
77 } __attribute__ ((packed)) gtpu_recovery_ie;
78 /* *INDENT-ON* */
79 
80 /* *INDENT-OFF* */
81 typedef struct
82 {
86 } __attribute__ ((packed)) gtpu_exthdr_t;
87 /* *INDENT-ON* */
88 
89 /* *INDENT-OFF* */
90 typedef struct
91 {
94  u16 length; /* length in octets of the payload */
96  gtpu_exthdr_t ext[0];
97 } __attribute__ ((packed)) gtpu_header_t;
98 /* *INDENT-ON* */
99 
100 #define GTPU_TYPE_ECHO_REQUEST 1
101 #define GTPU_TYPE_ECHO_REPLY 2
102 #define GTPU_TYPE_ERROR_INDICATION 26
103 #define GTPU_TYPE_END_MARKER 254
104 #define GTPU_TYPE_GTPU 255
105 
106 /* *INDENT-OFF* */
107 typedef struct
108 {
109  BITALIGN2 (u8 ppi:3,
110  u8 spare:5);
111 
113 } __attribute__ ((packed)) gtpu_paging_policy_t;
114 /* *INDENT-ON* */
115 
116 /* *INDENT-OFF* */
117 typedef struct
118 {
120  BITALIGN2(u8 type:4,
121  u8 spare:4);
122  union {
123  struct gtpu_qfi_bits {BITALIGN3(u8 p:1,
124  u8 r:1,
125  u8 qfi:6);
126  } bits;
127 
129  } u;
130 
133 } __attribute__ ((packed)) gtpu_pdu_session_t;
134 /* *INDENT-ON* */
135 
136 #define GTPU_PDU_SESSION_P_BIT_MASK 0x80
137 #define GTPU_PDU_SESSION_R_BIT_MASK 0x40
138 #define GTPU_PDU_SESSION_QFI_MASK 0x3f
139 
140 #define SRV6_PDU_SESSION_U_BIT_MASK 0x01
141 #define SRV6_PDU_SESSION_R_BIT_MASK 0x02
142 #define SRV6_PDU_SESSION_QFI_MASK 0xfC
143 
144 /* *INDENT-OFF* */
145 typedef struct
146 {
147  ip4_header_t ip4; /* 20 bytes */
148  udp_header_t udp; /* 8 bytes */
149  gtpu_header_t gtpu; /* 8 bytes */
150 } __attribute__ ((packed)) ip4_gtpu_header_t;
151 /* *INDENT-ON* */
152 
153 /* *INDENT-OFF* */
154 typedef struct
155 {
156  ip6_header_t ip6; /* 40 bytes */
157  udp_header_t udp; /* 8 bytes */
158  gtpu_header_t gtpu; /* 8 bytes */
159 } __attribute__ ((packed)) ip6_gtpu_header_t;
160 /* *INDENT-ON* */
161 
162 #define GTPU_V1_VER (1<<5)
163 
164 #define GTPU_PT_GTP (1<<4)
165 
166 /* *INDENT-OFF* */
167 typedef struct
168 {
171  u8 value[0];
172 } __attribute__ ((packed)) user_plane_sub_tlv_t;
173 /* *INDENT-ON* */
174 
175 #define USER_PLANE_SUB_TLV_IE 0x01
176 
177 typedef struct srv6_end_gtp6_param_s
178 {
180 
181  ip6_address_t sr_prefix;
184 
186 {
188 
193 
195 {
197 
202 
203 typedef struct srv6_end_gtp4_param_s
204 {
206 
207  ip6_address_t sr_prefix;
209 
210  ip6_address_t v6src_prefix;
212 
215 
216 typedef struct srv6_end_main_v4_s
217 {
220 
223 
224  u32 dst_p_len; // dst prefix len
225  u32 src_p_len; // src prefix len
226 
228 
230 
232 {
235 
238 
241 
245 
246 typedef struct srv6_end_main_v6_s
247 {
250 
253 
256 
259 
261 {
264 
267 
270 
273 
275 {
278 
281 
284 
287 
288 typedef struct srv6_end_main_v6_dt_s
289 {
292 
296 
299 
300 typedef struct srv6_t_main_v4_dt_s
301 {
304 
308 
311 
312 #endif /* __included_srv6_end_h__ */
313 
314 /*
315  * fd.io coding-style-patch-verification: ON
316  *
317  * Local Variables:
318  * eval: (c-set-style "gnu")
319  * End:
320  */
srv6_end_main_v6_dt
srv6_end_main_v6_dt_t srv6_end_main_v6_dt
Definition: gtp6_dt.c:25
srv6_end_main_v4_s::vnet_main
vnet_main_t * vnet_main
Definition: mobile.h:219
srv6_t_gtp4_dt_param_s::local_fib_index
u32 local_fib_index
Definition: mobile.h:200
srv6_end_main_v6_dt_t
struct srv6_end_main_v6_dt_s srv6_end_main_v6_dt_t
srv6_end_gtp6_dt_param_s::type
u8 type
Definition: mobile.h:187
gtpu_header_t::ver_flags
u8 ver_flags
Definition: mobile.h:92
gtpu_exthdr_t::nextexthdr
u8 nextexthdr
Definition: mobile.h:85
srv6_end_gtp4_param_s::v6src_prefixlen
u32 v6src_prefixlen
Definition: mobile.h:211
srv6_end_main_v6_dt_s::end_m_gtp6_dt_node_index
u32 end_m_gtp6_dt_node_index
Definition: mobile.h:293
srv6_end_gtp6_dt_param_t
struct srv6_end_gtp6_dt_param_s srv6_end_gtp6_dt_param_t
srv6_t_gtp4_dt_param_s::fib4_index
u32 fib4_index
Definition: mobile.h:198
ip4_gtpu_header_t
Definition: mobile.h:145
srv6_end_gtp6_dt_param_s::fib4_index
u32 fib4_index
Definition: mobile.h:189
elog.h
srv6_end_main_v6_decap_di_s::end_m_gtp6_d_di_node_index
u32 end_m_gtp6_d_di_node_index
Definition: mobile.h:279
srv6_t_main_v4_decap_t
struct srv6_t_main_v4_decap_s srv6_t_main_v4_decap_t
srv6_t_gtp4_dt_param_s::type
u8 type
Definition: mobile.h:196
srv6_end_m_gtp6_e
vlib_node_registration_t srv6_end_m_gtp6_e
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_e)
Definition: node.c:2963
ip4_gtpu_header_t::gtpu
gtpu_header_t gtpu
Definition: mobile.h:149
srv6_end_main_v6_dt_s::vnet_main
vnet_main_t * vnet_main
Definition: mobile.h:291
srv6_t_main_v4_decap_s::t_m_gtp4_d_node_index
u32 t_m_gtp4_d_node_index
Definition: mobile.h:236
srv6_t_gtp4_dt_param_t
struct srv6_t_gtp4_dt_param_s srv6_t_gtp4_dt_param_t
srv6_end_main_v6_decap_t
struct srv6_end_main_v6_decap_s srv6_end_main_v6_decap_t
padding
u32 padding
Definition: vhost_user.h:124
gtpu_pdu_session_t::exthdrlen
u8 exthdrlen
Definition: mobile.h:119
srv6_end_main_v4_s
Definition: mobile.h:216
srv6_end_main_v4_s::vlib_main
vlib_main_t * vlib_main
Definition: mobile.h:218
u16
unsigned short u16
Definition: types.h:57
srv6_end_gtp4_param_s::sr_prefixlen
u32 sr_prefixlen
Definition: mobile.h:208
gtpu_exthdr_t::npdu_num
u8 npdu_num
Definition: mobile.h:84
srv6_end_main_v6_s
Definition: mobile.h:246
srv6_end_main_v6_decap_di_s
Definition: mobile.h:274
srv6_t_main_v4_dt_t
struct srv6_t_main_v4_dt_s srv6_t_main_v4_dt_t
user_plane_sub_tlv_t::length
u8 length
Definition: mobile.h:170
srv6_t_main_v4_dt_s::error_node_index
u32 error_node_index
Definition: mobile.h:306
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1089
srv6_end_gtp4_param_s::v6src_prefix
ip6_address_t v6src_prefix
Definition: mobile.h:210
srv6_end_main_v4
srv6_end_main_v4_t srv6_end_main_v4
Definition: gtp4_e.c:24
udp_header_t
Definition: udp_packet.h:45
ip4_header_t
Definition: ip4_packet.h:87
srv6_end_main_v6_s::vnet_main
vnet_main_t * vnet_main
Definition: mobile.h:249
gtpu_paging_policy_t
Definition: mobile.h:107
sr_packet.h
gtpu_recovery_ie::type
u8 type
Definition: mobile.h:75
srv6_end_main_v6_decap_di
srv6_end_main_v6_decap_di_t srv6_end_main_v6_decap_di
Definition: gtp6_d_di.c:24
srv6_end_main_v6
srv6_end_main_v6_t srv6_end_main_v6
Definition: gtp6_e.c:24
gtpu_exthdr_t::seq
u16 seq
Definition: mobile.h:83
BITALIGN3
#define BITALIGN3(A, B, C)
Definition: mobile.h:55
sr.h
Segment Routing data structures definitions.
gtpu_header_t::teid
u32 teid
Definition: mobile.h:95
srv6_end_m_gtp6_d_di
vlib_node_registration_t srv6_end_m_gtp6_d_di
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_d_di)
Definition: node.c:2987
srv6_t_m_gtp4_dt
vlib_node_registration_t srv6_t_m_gtp4_dt
(constructor) VLIB_REGISTER_NODE (srv6_t_m_gtp4_dt)
Definition: node.c:3013
error.h
srv6_t_gtp4_dt_param_s
Definition: mobile.h:194
srv6_t_main_v4_decap_s::cache_hdr
ip6_header_t cache_hdr
Definition: mobile.h:239
srv6_t_main_v4_decap_s::vnet_main
vnet_main_t * vnet_main
Definition: mobile.h:234
srv6_end_m_gtp4_e
vlib_node_registration_t srv6_end_m_gtp4_e
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp4_e)
Definition: node.c:1213
BITALIGN2
#define BITALIGN2(A, B)
Definition: mobile.h:54
srv6_end_gtp6_dt_param_s::local_fib_index
u32 local_fib_index
Definition: mobile.h:191
srv6_end_main_v6_decap_s::error_node_index
u32 error_node_index
Definition: mobile.h:266
srv6_t_main_v4_decap_s
Definition: mobile.h:231
gtpu_header_t
Definition: mobile.h:90
gtpu_pdu_session_t::val
u8 val
Definition: mobile.h:128
gtpu_header_t::length
u16 length
Definition: mobile.h:94
srv6_end_main_v6_decap_di_s::vnet_main
vnet_main_t * vnet_main
Definition: mobile.h:277
srv6_end_main_v6_decap_s::vnet_main
vnet_main_t * vnet_main
Definition: mobile.h:263
srv6_end_main_v4_s::cache_hdr
ip4_gtpu_header_t cache_hdr
Definition: mobile.h:227
srv6_end_main_v6_s::cache_hdr
ip6_gtpu_header_t cache_hdr
Definition: mobile.h:254
srv6_end_main_v6_decap_di_s::cache_hdr
ip6srv_combo_header_t cache_hdr
Definition: mobile.h:282
ip6_gtpu_header_t::udp
udp_header_t udp
Definition: mobile.h:157
gtpu_pdu_session_t::nextexthdr
u8 nextexthdr
Definition: mobile.h:132
gtpu_exthdr_t
Definition: mobile.h:81
ip4_gtpu_header_t::udp
udp_header_t udp
Definition: mobile.h:148
srv6_end_main_v6_t
struct srv6_end_main_v6_s srv6_end_main_v6_t
srv6_end_main_v4_s::dst_p_len
u32 dst_p_len
Definition: mobile.h:224
srv6_end_gtp6_dt_param_s::fib6_index
u32 fib6_index
Definition: mobile.h:190
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
ip6_gtpu_header_t::ip6
ip6_header_t ip6
Definition: mobile.h:156
srv6_end_main_v6_s::vlib_main
vlib_main_t * vlib_main
Definition: mobile.h:248
srv6_end_main_v4_s::end_m_gtp4_e_node_index
u32 end_m_gtp4_e_node_index
Definition: mobile.h:221
srv6_t_main_v4_decap_s::error_node_index
u32 error_node_index
Definition: mobile.h:237
srv6_end_gtp4_param_s::sr_prefix
ip6_address_t sr_prefix
Definition: mobile.h:207
srv6_end_gtp6_param_s::nhtype
u8 nhtype
Definition: mobile.h:179
vnet_main_t
Definition: vnet.h:76
srv6_end_main_v6_decap_di_s::error_node_index
u32 error_node_index
Definition: mobile.h:280
srv6_end_main_v4_s::src_p_len
u32 src_p_len
Definition: mobile.h:225
user_plane_sub_tlv_t::type
u8 type
Definition: mobile.h:169
srv6_end_gtp6_param_s::sr_prefixlen
u32 sr_prefixlen
Definition: mobile.h:182
srv6_end_main_v6_decap_s::vlib_main
vlib_main_t * vlib_main
Definition: mobile.h:262
ip6srv_combo_header_t
Definition: sr.h:60
srv6_end_gtp4_param_s::nhtype
u8 nhtype
Definition: mobile.h:205
srv6_end_gtp6_param_t
struct srv6_end_gtp6_param_s srv6_end_gtp6_param_t
ip.h
u32
unsigned int u32
Definition: types.h:88
gtpu_recovery_ie::restart_counter
u8 restart_counter
Definition: mobile.h:76
gtpu_header_t::type
u8 type
Definition: mobile.h:93
srv6_t_main_v4_dt_s::t_m_gtp4_dt_node_index
u32 t_m_gtp4_dt_node_index
Definition: mobile.h:305
user_plane_sub_tlv_t
Definition: mobile.h:167
gtpu_recovery_ie
Definition: mobile.h:73
ip6_gtpu_header_t::gtpu
gtpu_header_t gtpu
Definition: mobile.h:158
srv6_end_main_v4_t
struct srv6_end_main_v4_s srv6_end_main_v4_t
srv6_t_main_v4_dt_s::vlib_main
vlib_main_t * vlib_main
Definition: mobile.h:302
srv6_end_m_gtp6_dt
vlib_node_registration_t srv6_end_m_gtp6_dt
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_dt)
Definition: node.c:2999
srv6_end_main_v6_dt_s
Definition: mobile.h:288
srv6_end_main_v6_s::end_m_gtp6_e_node_index
u32 end_m_gtp6_e_node_index
Definition: mobile.h:251
srv6_end_gtp6_param_s::sr_prefix
ip6_address_t sr_prefix
Definition: mobile.h:181
value
u8 value
Definition: qos.api:54
srv6_end_m_gtp6_d
vlib_node_registration_t srv6_end_m_gtp6_d
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_d)
Definition: node.c:2975
ip6_header_t
Definition: ip6_packet.h:294
srv6_t_main_v4_decap
srv6_t_main_v4_decap_t srv6_t_main_v4_decap
Definition: gtp4_d.c:24
vlib_main_t
Definition: main.h:102
ip6_gtpu_header_t
Definition: mobile.h:154
srv6_t_main_v4_dt_s::vnet_main
vnet_main_t * vnet_main
Definition: mobile.h:303
srv6_t_gtp4_dt_param_s::fib6_index
u32 fib6_index
Definition: mobile.h:199
srv6_end_main_v4_s::error_node_index
u32 error_node_index
Definition: mobile.h:222
srv6_end_gtp4_param_s
Definition: mobile.h:203
u8
unsigned char u8
Definition: types.h:56
srv6_end_main_v6_decap_s
Definition: mobile.h:260
srv6_t_main_v4_decap_s::vlib_main
vlib_main_t * vlib_main
Definition: mobile.h:233
srv6_t_main_v4_dt_s
Definition: mobile.h:300
srv6_t_main_v4_dt
srv6_t_main_v4_dt_t srv6_t_main_v4_dt
Definition: gtp4_dt.c:25
srv6_end_main_v6_decap_di_t
struct srv6_end_main_v6_decap_di_s srv6_end_main_v6_decap_di_t
srv6_end_main_v6_s::error_node_index
u32 error_node_index
Definition: mobile.h:252
srv6_end_main_v6_decap
srv6_end_main_v6_decap_t srv6_end_main_v6_decap
Definition: gtp6_d.c:24
srv6_end_main_v6_decap_s::end_m_gtp6_d_node_index
u32 end_m_gtp6_d_node_index
Definition: mobile.h:265
srv6_end_gtp4_param_t
struct srv6_end_gtp4_param_s srv6_end_gtp4_param_t
vnet.h
srv6_end_main_v6_dt_s::error_node_index
u32 error_node_index
Definition: mobile.h:294
srv6_end_main_v6_decap_s::cache_hdr
ip6_header_t cache_hdr
Definition: mobile.h:268
gtpu_pdu_session_t
Definition: mobile.h:117
srv6_end_gtp6_dt_param_s
Definition: mobile.h:185
srv6_end_main_v6_decap_di_s::vlib_main
vlib_main_t * vlib_main
Definition: mobile.h:276
ip4_gtpu_header_t::ip4
ip4_header_t ip4
Definition: mobile.h:147
srv6_end_main_v6_dt_s::vlib_main
vlib_main_t * vlib_main
Definition: mobile.h:290
type
vl_api_fib_path_type_t type
Definition: fib_types.api:123
srv6_end_gtp6_param_s
Definition: mobile.h:177
srv6_end_gtp4_param_s::v4src_position
u32 v4src_position
Definition: mobile.h:213