vrrp: fix vrrp_garp_or_na_send()'s memory leak
[vpp.git] / src / plugins / srv6-mobile / mobile_plugin_doc.rst
1 .. _srv6_mobile_plugin_doc:
2
3 SRv6 Mobile User Plane
4 ======================
5
6 Introduction
7 ------------
8
9 This plugin module can provide the stateless mobile user plane protocols
10 translation between GTP-U and SRv6. The plugin also provides FIB table
11 lookup for an IPv4/IPv6 packet encapsulated in GTP-U. These plugin
12 functions take advantage of SRv6 network programmability.
13
14 `SRv6 Mobile User
15 Plane <https://tools.ietf.org/html/draft-ietf-dmm-srv6-mobile-uplane>`__
16 defines the user plane protocol using SRv6 including following stateless
17 translation functions:
18
19 -  **T.M.GTP4.D:** GTP-U over UDP/IPv4 -> SRv6
20 -  **End.M.GTP4.E:** SRv6 -> GTP-U over UDP/IPv4
21 -  **End.M.GTP6.D:** GTP-U over UDP/IPv6 -> SRv6
22 -  **End.M.GTP6.E:** SRv6 -> GTP-U over UDP/IPv6
23
24 These functions benefit user plane(overlay) to be able to utilize data
25 plane(underlay) networks properly. And also it benefits data plane to be
26 able to handle user plane in routing paradigm.
27
28 In addition to the above functions, the plugin supports following
29 functions:
30
31 -  **T.M.GTP4.DT{4|6|46}:** FIB table lookup for IPv4/IP6 encapsulated
32    in GTP-U over UDP/IPv4
33 -  **End.M.GTP6.DT{4|6|46}:** FIB table lookup for IPv4/IP6 encapsulated
34    in GTP-U over UDP/IPv6
35
36 Noted that the prefix of function names follow naming convention of SRv6
37 network programming. “T” means transit function, “End” means end
38 function, “M” means Mobility specific function. The suffix “D” and “E”
39 mean that “decapsulation” and “encapsulation” respectively.
40
41 Implementation
42 --------------
43
44 All SRv6 mobile functions are implemented as VPP plugin modules. The
45 plugin modules leverage the sr_policy and sr_localsid mechanisms.
46
47 Configurations
48 --------------
49
50 GTP-U to SRv6
51 ~~~~~~~~~~~~~
52
53 The GTP-U tunnel and flow identifiers of a receiving packet are mapped
54 to a Segment Identifier(SID) of sending SRv6 packets.
55
56 IPv4 infrastructure case
57 ^^^^^^^^^^^^^^^^^^^^^^^^
58
59 In case that **IPv4** networks are the infrastructure of GTP-U,
60 T.M.GTP4.D function translates the receiving GTP-U packets to SRv6
61 packets.
62
63 A T.M.GTP4.D function is associated with the following mandatory
64 parameters:
65
66 -  SID: A SRv6 SID to represents the function
67 -  DST-PREFIX: Prefix of remote SRv6 segment. The destination address or
68    last SID of out packets consists of the prefix followed by dst IPv4
69    address, QFI and TEID of the receiving packets.
70 -  SRC-PREFIX: Prefix for src address of sending packets. The src IPv6
71    address consists of the prefix followed by the src IPv4 address of
72    the receiving packets.
73
74 The following command instantiates a new T.M.GTP4.D function.
75
76 ::
77
78    sr policy add bsid SID behavior t.m.gtp4.d DST-PREFIX v6src_prefix SRC-PREFIX [nhtype {ipv4|ipv6|non-ip}]
79
80 For example, the below command configures the SID 2001:db8::1 with
81 ``t.m.gtp4.d`` behavior for translating receiving GTP-U over IPv4
82 packets to SRv6 packets with next-header type is IPv4.
83
84 ::
85
86    sr policy add bsid 2001:db8::1 behavior t.m.gtp4.d D1::/32 v6src_prefix A1::/64 nhtype ipv4
87
88 It should be interesting how a SRv6 BSID works to decapsulate the
89 receiving GTP-U packets over IPv4 header. To utilize ``t.m.gtp4.d``
90 function, you need to configure some SR steering policy like:
91
92 ::
93
94    sr steer l3 172.20.0.1/32 via bsid 2001:db8::1
95
96 The above steering policy with the BSID of ``t.m.gtp4.d`` would work
97 properly for the GTP-U packets destined to 172.20.0.1.
98
99 If you have a SID(s) list of SR policy which the configured gtp4.d
100 function to be applied, the SR Policy can be configured as following:
101
102 ::
103
104    sr policy add bsid D1:: next A1:: next B1:: next C1::
105
106 IPv6 infrastructure case
107 ^^^^^^^^^^^^^^^^^^^^^^^^
108
109 In case that GTP-U is deployed over **IPv6** infrastructure, you don’t
110 need to configure T.M.GTP4.D function and associated SR steering policy.
111 Instead of that, you just need to configure a localsid of End.M.GTP6.D
112 segment.
113
114 An End.M.GTP6.D segment is associated with the following mandatory
115 parameters:
116
117 -  SID-PREFIX: SRv6 SID prefix to represent the function. In this
118    function, it should be the dst address of receiving GTP-U packets.
119 -  DST-PREFIX: Prefix of remote SRv6 Segment. The destination address or
120    last SID of output packets consists of the prefix followed by QFI and
121    TEID of the receiving packets.
122
123 The following command instantiates a new End.M.GTP6.D function.
124
125 ::
126
127    sr localsid prefix SID-PREFIX behavior end.m.gtp6.d DST-PREFIX [nhtype {ipv4|ipv6|non-ip}]
128
129 For example, the below command configures the SID prefix 2001:db8::/64
130 with ``end.m.gtp6.d`` behavior for translating receiving GTP-U over IPv6
131 packets which have IPv6 destination addresses within 2001:db8::/64 to
132 SRv6 packets. The dst IPv6 address of the outgoing packets consists of
133 D4::/64 followed by QFI and TEID.
134
135 ::
136
137    sr localsid prefix 2001:db8::/64 behavior end.m.gtp6.d D4::/64
138
139 In another case, the translated packets from GTP-U over IPv6 to SRv6
140 will be re-translated back to GTP-U, which is so called ‘Drop-In’ mode.
141
142 In Drop-In mode, an additional IPv6 specific end segment is required,
143 named End.M.GTP6.D.Di. It is because that unlike ``end.m.gtp6.d``, it
144 needs to preserve original IPv6 dst address as the last SID in the SRH.
145
146 Regardless of that difference exists, the required configuration
147 parameters are same as ``end.m.gtp6.d``.
148
149 The following command instantiates a new End.M.GTP6.D.Di function.
150
151 ::
152
153    sr localsid prefix 2001:db8::/64 behavior end.m.gtp6.d.di D4::/64
154
155 SRv6 to GTP-U
156 ~~~~~~~~~~~~~
157
158 The SRv6 Mobile functions on SRv6 to GTP-U direction are End.M.GTP4.E
159 and End.M.GTP6.D.
160
161 In this direction with GTP-U over IPv4 infrastructure, an End.M.GTP4.E
162 segment is associated with the following mandatory parameters:
163
164 -  SID-PREFIX: SRv6 SID prefix to represent the function.
165 -  V4SRC-ADDR-POSITION: Integer number indicates bit position where IPv4
166    src address embedded.
167
168 The following command instantiates a new End.M.GTP4.E function.
169
170 ::
171
172    sr localsid prefix SID-PREFIX behavior end.m.gtp4.e v4src_position V4SRC-ADDR-POSITION
173
174 For example, the below command configures the SID prefix 2001:db8::/32
175 with ``end.m.gtp4.e`` behavior for translating the receiving SRv6
176 packets to GTP-U packets encapsulated with UDP/IPv4 header. All the
177 GTP-U tunnel and flow identifiers are extracted from the active SID in
178 the receiving packets. The src IPv4 address of sending GTP-U packets is
179 extracted from the configured bit position in the src IPv6 address.
180
181 ::
182
183    sr localsid prefix 2001:db8::/32 behavior end.m.gtp4.e v4src_position 64
184
185 In IPv6 infrastructure case, an End.M.GTP6.E segment is associated with
186 the following mandatory parameters:
187
188 -  SID-PREFIX: SRv6 SID prefix to represent the function.
189
190 The following command instantiates a new End.M.GTP6.E function.
191
192 ::
193
194    sr localsid prefix SID-PREFIX behavior end.m.gtp6.e
195
196 For example, the below command configures the SID prefix 2001:db8::/64
197 with ``end.m.gtp6.e`` behavior for translating the receiving SRv6
198 packets to GTP-U packets encapsulated with UDP/IPv6 header. While the
199 last SID indicates GTP-U dst IPv6 address, 32-bits GTP-U TEID and 6-bits
200 QFI are extracted from the active SID in the receiving packets.
201
202 ::
203
204    sr localsid prefix 2001:db8::/64 behavior end.m.gtp6.e
205
206 FIB Table Lookup for Inner IPv4/IPv6 packet
207 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208
209 SRv6 Mobile functions of ``t.m.gtp4.dt*`` and ``end.m.gtp6.dt*`` support
210 decapsulating outer IP/UDP/GTP-U headers and forwarding inner IP packet
211 based on specific fib table.
212
213 In case of the both outer and inner IP address families are IPv4,
214 ``t.m.gtp4.dt4`` function supports GTP-U decapsulation and fib lookup
215 for inner IPv4 with an associated steering policy and the following
216 parameters:
217
218 -  SID: A SRv6 SID to represents the function
219 -  FIB: fib-table number for inner IPv4 packet lookup and forwarding
220
221 The following command instantiates a new T.M.GTP4.DT4 function.
222
223 ::
224
225    sr policy add bsid SID behavior t.m.gtp4.dt4 fib-table FIB
226
227 For example, the below commands configure D5:: as the SID instantiates
228 ``t.m.gtp4.dt4`` function. A steering policy for packets destine to
229 172.20.0.1 binds to the SID.
230
231 ::
232
233    sr steer l3 172.20.0.1/32 via bsid D5::
234    sr policy add bsid D5:: behavior t.m.gtp4.dt4 fib-table 0
235
236 In addition, inner IPv6, or mix of IPv4 and IPv6 inner packet cases
237 require the function to be configured with local-fib table.
238
239 -  LOCAL-FIB: fib-table number for lookup and forward GTP-U packet based
240    on outer IP destination address
241
242 This is inner IPv6 case specific. The reason is that GTP-U encapsulates
243 link local IPv6 packet for NDP (Neighbor Discovery Protocol). Outer
244 GTP-U header should be kept until the packets reach to the node
245 responsible for NDP handling. It is typically UPF(User Plane Function)
246 node.
247
248 The following command instantiate a new T.M.GTP4.DT6 function.
249
250 ::
251
252    sr policy add bsid D5:: behavior t.m.gtp4.dt6 fib-table 0 local-fib-table LOCAL-FIB
253
254 Following example configures fib 0 for inner packet and fib 1 for outer
255 GTP-U packet forwarding:
256
257 ::
258
259    sr policy add bsid D5:: behavior t.m.gtp4.dt6 fib-table 0 local-fib-table 1
260
261 If you need to support both IPv4 and IPv6 inner packet lookup with just
262 one SID, you can configure ``t.m.gtp4.dt46`` function:
263
264 ::
265
266    sr policy add bsid D5:: behavior t.m.gtp4.dt46 fib-table 0 local-fib-table 1
267
268 In case of GTP-U over IPv6 case, ``end.m.gtp6.dt4``, ``end.m.gtp6.dt6``
269 and ``end.m.gtp6.dt46`` functions support inner IPv4, IPv6 and IPv4/IPv6
270 lookup and forwarding respectively. Specifying fib table for inner IP
271 packet forwarding is required as same as GTP-U over IPv4 case, and
272 local-fib table for inner IPv6 and IPv4/IPv6 cases as well.
273
274 ::
275
276    sr localsid prefix D::/64 behavior end.m.gtp6.dt46 fib-table 0 local-fib-table 0
277
278 To run some demo setup please refer to: :ref:`srv6_mobile_runner_doc`