srv6-mobile:

Type: feature

Add new functions in SRv6 Mobile Plug-in

GTP4.DT and GTP6.DT

Signed-off-by: Tetsuya Murakami <tetsuya.mrk@gmail.com>
Change-Id: I573a0c27bd463dd56a4d11b940941b8a8c826e08
Signed-off-by: Tetsuya Murakami <tetsuya.mrk@gmail.com>
This commit is contained in:
Tetsuya Murakami
2020-01-09 14:22:04 -08:00
committed by Ole Trøan
parent ba4a5bf884
commit 57584d99dd
16 changed files with 2148 additions and 360 deletions

View File

@ -15,9 +15,11 @@ add_vpp_plugin(srv6mobile
SOURCES
gtp4_e.c
gtp4_d.c
gtp4_dt.c
gtp6_e.c
gtp6_d.c
gtp6_d_di.c
gtp6_dt.c
node.c
INSTALL_HEADERS

View File

@ -1,178 +0,0 @@
SRv6 Mobile User Plane Plugin for VPP
========================
## Introduction
This plugin module can provide the stateless mobile user plane protocols translation between GTP-U and SRv6.
The functions of the translation take advantage of SRv6 network programmability.
[SRv6 Mobile User Plane](https://tools.ietf.org/html/draft-ietf-dmm-srv6-mobile-uplane) defines the user plane protocol using SRv6
including following stateless translation functions:
- **T.M.GTP4.D:**
GTP-U over UDP/IPv4 -> SRv6
- **End.M.GTP4.E:**
SRv6 -> GTP-U over UDP/IPv4
- **End.M.GTP6.D:**
GTP-U over UDP/IPv6 -> SRv6
- **End.M.GTP6.E:**
SRv6 -> GTP-U over UDP/IPv6
These functions benefit user plane(overlay) to be able to utilize data plane(underlay) networks properly. And also it benefits
data plane to be able to handle user plane in routing paradigm.
## Getting started
To play with SRv6 Mobile User Plane on VPP, you need to install following packages:
docker
python3
pip3
Python packages (use pip):
docker
scapy
jinja2
### Quick-start
1. Build up the docker container image as following:
```
$ git clone https://github.com/filvarga/srv6-mobile.git
$ cd ./srv6-mobile/extras/ietf105
$ ./runner.py infra build
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ietf105-image latest 577e786b7ec6 2 days ago 5.57GB
ubuntu 18.04 4c108a37151f 4 weeks ago 64.2MB
```
The runner script [runner.py](test/runner.py) has features to automate configurations and procedures for the test.
2. Instantiate test Scenario
Let's try following command to instantiate a topology:
```
$ ./runner.py infra start
```
This command instantiates 4 VPP containers with following topology:
![Topology Diagram](test/topo-init.png)
You can check the instantiated docker instances with "docker ps".
```
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
44cb98994500 ietf105-image "/bin/sh -c 'vpp -c …" About a minute ago Up About a minute hck-vpp-4
6d65fff8aee9 ietf105-image "/bin/sh -c 'vpp -c …" About a minute ago Up About a minute hck-vpp-3
ad123b516b24 ietf105-image "/bin/sh -c 'vpp -c …" About a minute ago Up About a minute hck-vpp-2
5efed405b96a ietf105-image "/bin/sh -c 'vpp -c …" About a minute ago Up About a minute hck-vpp-1
```
You can login to and configure each instantiated container.
```
$ ./runner.py cmd vppctl 0
Verified image: None
connecting to: hck-vpp-1
_______ _ _ _____ ___
__/ __/ _ \ (_)__ | | / / _ \/ _ \
_/ _// // / / / _ \ | |/ / ___/ ___/
/_/ /____(_)_/\___/ |___/_/ /_/
vpp#
```
## Test Scenarios
### SRv6 Drop-in between GTP-U tunnel
This test scenario introduces SRv6 path between GTP-U tunnel transparently. A GTP-U packet sent out from one end to another is translated to SRv6 and then back to GTP-U. All GTP-U tunnel identifiers are preserved in IPv6 header and SRH.
#### GTP-U over UDP/IPv4 case
This case uses SRv6 end functions, T.M.GTP4.D and End.M.GTP4.E.
![Topology Diagram](test/topo-test_gtp4d.png)
VPP1 is configured with "T.M.GTP4.D", and VPP4 is configured with "End.M.GTP4.E". Others are configured with "End". The packet generator sends a GTP-U packet over UDP/IPv4 toward the packet capture. VPP1 translates it to SRv6 toward D4::TEID with SR policy <D2::, D3::> in SRH. VPP4 translates the SRv6 packet to the original GTP-U packet and send out to the packet capture.
To start this case with IPv4 payload over GTP-U, you can run:
```
$ ./runner.py test tmap
```
If you want to use IPv6 payload instead of IPv4, you can run:
```
$ ./runner.py test tmap_ipv6
```
#### GTP-U over UDP/IPv6 case
This case uses SRv6 end functions, End.M.GTP6.D.Di and End.M.GTP6.E.
![Topology Diagram](test/topo-test_gtp6d.png)
VPP1 is configured with "End.M.GTP6.D.Di", and VPP4 is configured with "End.M.GTP4.E". Others are configured with "End". The packet generator sends a GTP-U packet over UDP/IPv6 toward D:: of the packet capture. VPP1 translates it to SRv6 toward D:: with SR policy <D2::, D3::, D4::TEID> in SRH. VPP4 translates the SRv6 packet to the original GTP-U packet and send out to the packet capture.
To start this case with IPv4 payload over GTP-U, you can run:
```
$ ./runner.py test gtp6_drop_in
```
If you want to use IPv6 payload instead of IPv4, you can run:
```
$ ./runner.py test gtp6_drop_in_ipv6
```
### GTP-U to SRv6
This test scenario demonstrates GTP-U to SRv6 translation. A GTP-U packet sent out from one end to another is translated to SRv6.
#### GTP-U over UDP/IPv6 case
##### IPv4 payload
This case uses SRv6 end functions, End.M.GTP6.D and End.DT4.
![Topology Diagram](test/topo-test_gtp6.png)
VPP1 is configured with "End.M.GTP6.D", and VPP4 is configured with "End.DT4". Others are configured with "End". The packet generator sends a GTP-U packet over UDP/IPv6 toward D::2. VPP1 translates it to SRv6 toward the IPv6 destination consists of D4:: and TEID of GTP-U with SR policy <D2::, D3::> in SRH. VPP4 decapsulates the SRv6 packet and lookup the table for the inner IPv4 packet and send out to the packet capture.
To start this case, you can run:
```
$ ./runner.py test gtp6
```
##### IPv6 payload
This case uses SRv6 end functions, End.M.GTP6.D and End.DT6.
![Topology Diagram](test/topo-test_gtp6ip6.png)
The configurations are same with IPv4 payload case, except D4:: is configured as "End.DT6" in VPP4. VPP4 decapsulates the SRv6 packet and lookup the table for the inner IPv6 packet and send out to the packet capture.
If you want to use IPv6 payload instead of IPv4, you can run:
```
$ ./runner.py test gtp6_ipv6
```
## More information
TBD

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,105 @@
# What's `runner.py` doing?
## Common configurations
### VPP1
```
create host-interface name eth1
set int ip addr host-eth1 A1::1/120
set int state host-eth1 up
ip route add ::/0 via host-eth1 A1::2
```
### VPP2
```
create host-interface name eth1
set int ip addr host-eth1 A1::2/120
create host-interface name eth2
set int ip addr host-eth2 A2::1/120
set int state host-eth1 up
set int state host-eth2 up
ip route add ::/0 via host-eth2 A2::2
```
### VPP3
```
create host-interface name eth1
set int ip addr host-eth1 A2::2/120
create host-interface name eth2
set int ip addr host-eth2 A3::1/120
set int state host-eth1 up
set int state host-eth2 up
ip route add ::/0 via host-eth1 A2::1
```
### VPP4
```
create host-interface name eth1
set int ip addr host-eth1 A3::2/120
set int state host-eth1 up
ip route add ::/0 via host-eth1 A3::1
```
## Drop-in for GTP-U over IPv4
Drop-in mode is handy to test both GTP-U-to-SRv6 and SRv6-to-GTP-U functions at same time. Let's see what's happened when you run `test gtp4`:
$ ./runner.py test gtp4
Setting up a virtual interface of packet generator:
#### VPP1
```
create packet-generator interface pg0
set int mac address pg0 aa:bb:cc:dd:ee:01
set int ip addr pg0 172.16.0.1/30
set ip arp pg0 172.16.0.2/30 aa:bb:cc:dd:ee:02
```
#### VPP4
```
create packet-generator interface pg0
set int mac address pg0 aa:bb:cc:dd:ee:11
set int ip addr pg0 1.0.0.2/30
set ip arp pg0 1.0.0.1 aa:bb:cc:dd:ee:22
```
SRv6 and IP routing settings:
#### VPP1
```
sr policy add bsid D4:: next D2:: next D3::
sr policy add bsid D5:: behavior t.m.gtp4.d D4::/32 v6src_prefix C1::/64 nhtype ipv4
sr steer l3 172.20.0.1/32 via bsid D5::
```
#### VPP2
```
sr localsid address D2:: behavior end
ip route add D3::/128 via host-eth2 A2::2
```
#### VPP3
```
sr localsid address D3:: behavior end
ip route add D4::/32 via host-eth2 A3::2
```
#### VPP4
```
sr localsid prefix D4::/32 behavior end.m.gtp4.e v4src_position 64
ip route add 172.20.0.1/32 via pg0 1.0.0.1
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -0,0 +1,200 @@
/*
* srv6_t_m_gtp4_dt.c
*
* Copyright (c) 2019 Arrcus Inc and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <vnet/vnet.h>
#include <vnet/adj/adj.h>
#include <vnet/fib/fib_table.h>
#include <vnet/plugin/plugin.h>
#include <vpp/app/version.h>
#include <srv6-mobile/mobile.h>
srv6_t_main_v4_dt_t srv6_t_main_v4_dt;
static void
clb_dpo_lock_srv6_t_m_gtp4_dt (dpo_id_t * dpo)
{
}
static void
clb_dpo_unlock_srv6_t_m_gtp4_dt (dpo_id_t * dpo)
{
}
static u8 *
clb_dpo_format_srv6_t_m_gtp4_dt (u8 * s, va_list * args)
{
index_t index = va_arg (*args, index_t);
CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
return (format (s, "SR: dynamic_proxy_index:[%u]", index));
}
const static dpo_vft_t dpo_vft = {
.dv_lock = clb_dpo_lock_srv6_t_m_gtp4_dt,
.dv_unlock = clb_dpo_unlock_srv6_t_m_gtp4_dt,
.dv_format = clb_dpo_format_srv6_t_m_gtp4_dt,
};
const static char *const srv6_t_m_gtp4_dt_nodes[] = {
"srv6-t-m-gtp4-dt",
NULL,
};
const static char *const srv6_t_m_gtp4_dt_v6_nodes[] = {
"error-drop",
NULL,
};
const static char *const *const dpo_nodes[DPO_PROTO_NUM] = {
[DPO_PROTO_IP6] = srv6_t_m_gtp4_dt_v6_nodes,
[DPO_PROTO_IP4] = srv6_t_m_gtp4_dt_nodes,
};
static u8 fn_name[] = "SRv6-T.M.GTP4.DT-plugin";
static u8 keyword_str[] = "t.m.gtp4.dt";
static u8 def_str[] = "Transit function with DT for IPv4/GTP tunnel";
static u8 param_str[] = "fib-index <index> [local-fib-table <index>]";
static u8 *
clb_format_srv6_t_m_gtp4_dt (u8 * s, va_list * args)
{
srv6_t_gtp4_dt_param_t *ls_mem = va_arg (*args, void *);
s = format (s, "SRv6 Transit gtp4.dt\n\t");
if (ls_mem->type == SRV6_GTP4_DT4)
s = format (s, " Type GTP4.DT4 fib-table %u\n", ls_mem->fib4_index);
else if (ls_mem->type == SRV6_GTP4_DT6)
s = format (s, " Type GTP4.DT6, fib-table %u, local-fib-table %u\n",
ls_mem->fib6_index, ls_mem->local_fib_index);
else if (ls_mem->type == SRV6_GTP4_DT46)
s = format (s, " Type GTP4.DT46, fib-table %u, local-fib-table %u\n",
ls_mem->fib6_index, ls_mem->local_fib_index);
else
s = format (s, "\n");
return s;
}
static uword
clb_unformat_srv6_t_m_gtp4_dt (unformat_input_t * input, va_list * args)
{
void **plugin_mem_p = va_arg (*args, void **);
srv6_t_gtp4_dt_param_t *ls_mem;
u32 fib_index = 0, local_fib_index = 0;
u32 type;
if (unformat (input, "t.m.gtp4.dt4 fib-table %u", &fib_index))
{
type = SRV6_GTP4_DT4;
}
else if (unformat (input, "t.m.gtp4.dt6 fib-table %u local-fib-table %u",
&fib_index, &local_fib_index))
{
type = SRV6_GTP4_DT6;
}
else if (unformat (input, "t.m.gtp4.dt46 fib-table %u local-fib-table %u",
&fib_index, &local_fib_index))
{
type = SRV6_GTP4_DT46;
}
else
{
return 0;
}
ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
clib_memset (ls_mem, 0, sizeof *ls_mem);
*plugin_mem_p = ls_mem;
ls_mem->fib4_index = fib_table_find (FIB_PROTOCOL_IP4, fib_index);
ls_mem->fib6_index = fib_table_find (FIB_PROTOCOL_IP6, fib_index);
ls_mem->local_fib_index =
fib_table_find (FIB_PROTOCOL_IP6, local_fib_index);
ls_mem->type = type;
return 1;
}
static int
clb_creation_srv6_t_m_gtp4_dt (ip6_sr_policy_t * sr_policy)
{
return 0;
}
static int
clb_removal_srv6_t_m_gtp4_dt (ip6_sr_policy_t * sr_policy)
{
srv6_t_gtp4_dt_param_t *ls_mem;
ls_mem = (srv6_t_gtp4_dt_param_t *) sr_policy->plugin_mem;
clib_mem_free (ls_mem);
return 0;
}
static clib_error_t *
srv6_t_m_gtp4_dt_init (vlib_main_t * vm)
{
srv6_t_main_v4_dt_t *sm = &srv6_t_main_v4_dt;
dpo_type_t dpo_type;
vlib_node_t *node;
int rc;
sm->vlib_main = vm;
sm->vnet_main = vnet_get_main ();
node = vlib_get_node_by_name (vm, (u8 *) "srv6-t-m-gtp4-dt");
sm->t_m_gtp4_dt_node_index = node->index;
node = vlib_get_node_by_name (vm, (u8 *) "error-drop");
sm->error_node_index = node->index;
dpo_type = dpo_register_new_type (&dpo_vft, dpo_nodes);
rc = sr_policy_register_function (vm, fn_name, keyword_str, def_str, param_str, 128, //prefix len
&dpo_type,
clb_format_srv6_t_m_gtp4_dt,
clb_unformat_srv6_t_m_gtp4_dt,
clb_creation_srv6_t_m_gtp4_dt,
clb_removal_srv6_t_m_gtp4_dt);
if (rc < 0)
clib_error_return (0, "SRv6 Transit GTP4.DT Policy function"
"couldn't be registered");
return 0;
}
/* *INDENT-OFF* */
VNET_FEATURE_INIT (srv6_t_m_gtp4_dt, static) =
{
.arc_name = "ip4-unicast",
.node_name = "srv6-t-m-gtp4-dt",
.runs_before = 0,
};
VLIB_INIT_FUNCTION (srv6_t_m_gtp4_dt_init);
/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/

View File

@ -0,0 +1,194 @@
/*
* srv6_end_m_gtp6_dt.c
*
* Copyright (c) 2019 Arrcus Inc and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <vnet/vnet.h>
#include <vnet/adj/adj.h>
#include <vnet/fib/fib_table.h>
#include <vnet/plugin/plugin.h>
#include <vpp/app/version.h>
#include <srv6-mobile/mobile.h>
srv6_end_main_v6_dt_t srv6_end_main_v6_dt;
static void
clb_dpo_lock_srv6_end_m_gtp6_dt (dpo_id_t * dpo)
{
}
static void
clb_dpo_unlock_srv6_end_m_gtp6_dt (dpo_id_t * dpo)
{
}
static u8 *
clb_dpo_format_srv6_end_m_gtp6_dt (u8 * s, va_list * args)
{
index_t index = va_arg (*args, index_t);
CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
return (format (s, "SR: dynamic_proxy_index:[%u]", index));
}
const static dpo_vft_t dpo_vft = {
.dv_lock = clb_dpo_lock_srv6_end_m_gtp6_dt,
.dv_unlock = clb_dpo_unlock_srv6_end_m_gtp6_dt,
.dv_format = clb_dpo_format_srv6_end_m_gtp6_dt,
};
const static char *const srv6_end_m_gtp6_dt_nodes[] = {
"srv6-end-m-gtp6-dt",
NULL,
};
const static char *const *const dpo_nodes[DPO_PROTO_NUM] = {
[DPO_PROTO_IP6] = srv6_end_m_gtp6_dt_nodes,
};
static u8 fn_name[] = "SRv6-End.M.GTP6.DT-plugin";
static u8 keyword_str[] = "end.m.gtp6.dt";
static u8 def_str[] = "Endpoint function with DT for IPv6/GTP tunnel";
static u8 param_str[] = "fib-index <index> [local-fib-table <index>]";
static u8 *
clb_format_srv6_end_m_gtp6_dt (u8 * s, va_list * args)
{
srv6_end_gtp6_dt_param_t *ls_mem = va_arg (*args, void *);
s = format (s, "SRv6 End gtp6.dt\n\t");
if (ls_mem->type == SRV6_GTP6_DT4)
s = format (s, " Type GTP6.DT4 fib-table %u\n", ls_mem->fib4_index);
else if (ls_mem->type == SRV6_GTP6_DT6)
s = format (s, " Type GTP6.DT6, fib-table %u, local-fib-table %u\n",
ls_mem->fib6_index, ls_mem->local_fib_index);
else if (ls_mem->type == SRV6_GTP6_DT46)
s = format (s, " Type GTP6.DT46, fib-table %u, local-fib-table %u\n",
ls_mem->fib6_index, ls_mem->local_fib_index);
else
s = format (s, "\n");
return s;
}
static uword
clb_unformat_srv6_end_m_gtp6_dt (unformat_input_t * input, va_list * args)
{
void **plugin_mem_p = va_arg (*args, void **);
srv6_end_gtp6_dt_param_t *ls_mem;
u32 fib_index = 0, local_fib_index = 0;
u32 type;
if (unformat (input, "end.m.gtp6.dt4 fib-table %u", &fib_index))
{
type = SRV6_GTP6_DT4;
}
else if (unformat (input, "end.m.gtp6.dt6 fib-table %u local-fib-table %u",
&fib_index, &local_fib_index))
{
type = SRV6_GTP6_DT6;
}
else if (unformat (input, "end.m.gtp6.dt46 fib-table %u local-fib-table %u",
&fib_index, &local_fib_index))
{
type = SRV6_GTP6_DT46;
}
else
{
return 0;
}
ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
clib_memset (ls_mem, 0, sizeof *ls_mem);
*plugin_mem_p = ls_mem;
ls_mem->fib4_index = fib_table_find (FIB_PROTOCOL_IP4, fib_index);
ls_mem->fib6_index = fib_table_find (FIB_PROTOCOL_IP6, fib_index);
ls_mem->local_fib_index =
fib_table_find (FIB_PROTOCOL_IP6, local_fib_index);
ls_mem->type = type;
return 1;
}
static int
clb_creation_srv6_end_m_gtp6_dt (ip6_sr_localsid_t * localsid)
{
return 0;
}
static int
clb_removal_srv6_end_m_gtp6_dt (ip6_sr_localsid_t * localsid)
{
srv6_end_gtp6_dt_param_t *ls_mem;
ls_mem = localsid->plugin_mem;
clib_mem_free (ls_mem);
return 0;
}
static clib_error_t *
srv6_end_m_gtp6_dt_init (vlib_main_t * vm)
{
srv6_end_main_v6_dt_t *sm = &srv6_end_main_v6_dt;
dpo_type_t dpo_type;
vlib_node_t *node;
int rc;
sm->vlib_main = vm;
sm->vnet_main = vnet_get_main ();
node = vlib_get_node_by_name (vm, (u8 *) "srv6-end-m-gtp6-dt");
sm->end_m_gtp6_dt_node_index = node->index;
node = vlib_get_node_by_name (vm, (u8 *) "error-drop");
sm->error_node_index = node->index;
dpo_type = dpo_register_new_type (&dpo_vft, dpo_nodes);
rc = sr_localsid_register_function (vm, fn_name, keyword_str, def_str, param_str, 128, //prefix len
&dpo_type,
clb_format_srv6_end_m_gtp6_dt,
clb_unformat_srv6_end_m_gtp6_dt,
clb_creation_srv6_end_m_gtp6_dt,
clb_removal_srv6_end_m_gtp6_dt);
if (rc < 0)
clib_error_return (0, "SRv6 Endpoint GTP6.DT LocalSID function"
"couldn't be registered");
return 0;
}
/* *INDENT-OFF* */
VNET_FEATURE_INIT (srv6_end_m_gtp6_dt, static) =
{
.arc_name = "ip6-unicast",
.node_name = "srv6-end-m-gtp6-dt",
.runs_before = 0,
};
VLIB_INIT_FUNCTION (srv6_end_m_gtp6_dt_init);
/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/

View File

@ -42,6 +42,11 @@
#define SRV6_GTP6_DT6 2
#define SRV6_GTP6_DT46 3
#define SRV6_GTP4_UNKNOW 0
#define SRV6_GTP4_DT4 1
#define SRV6_GTP4_DT6 2
#define SRV6_GTP4_DT46 3
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define BITALIGN2(A,B) A; B
#define BITALIGN3(A,B,C) A; B; C
@ -59,6 +64,19 @@
#define SRH_TAG_ERROR_INDICATION 0x0002
#define SRH_TAG_END_MARKER 0x0001
#define GTPU_RECOVERY_IE_TYPE 0x0e
#define GTPU_IE_MAX_SIZ 256
#define SRH_TLV_USER_PLANE_CONTAINER 0x0a /* tentative */
/* *INDENT-OFF* */
typedef struct
{
u8 type;
u8 restart_counter;
} __attribute__ ((packed)) gtpu_recovery_ie;
/* *INDENT-ON* */
/* *INDENT-OFF* */
typedef struct
{
@ -145,6 +163,17 @@ typedef struct
#define GTPU_PT_GTP (1<<4)
/* *INDENT-OFF* */
typedef struct
{
u8 type;
u8 length;
u8 value[0];
} __attribute__ ((packed)) user_plane_sub_tlv_t;
/* *INDENT-ON* */
#define USER_PLANE_SUB_TLV_IE 0x01
typedef struct srv6_end_gtp6_param_s
{
u8 nhtype;
@ -153,6 +182,24 @@ typedef struct srv6_end_gtp6_param_s
u32 sr_prefixlen;
} srv6_end_gtp6_param_t;
typedef struct srv6_end_gtp6_dt_param_s
{
u8 type;
u32 fib4_index;
u32 fib6_index;
u32 local_fib_index;
} srv6_end_gtp6_dt_param_t;
typedef struct srv6_t_gtp4_dt_param_s
{
u8 type;
u32 fib4_index;
u32 fib6_index;
u32 local_fib_index;
} srv6_t_gtp4_dt_param_t;
typedef struct srv6_end_gtp4_param_s
{
u8 nhtype;
@ -238,6 +285,30 @@ typedef struct srv6_end_main_v6_decap_di_s
extern srv6_end_main_v6_decap_di_t srv6_end_main_v6_decap_di;
extern vlib_node_registration_t srv6_end_m_gtp6_d_di;
typedef struct srv6_end_main_v6_dt_s
{
vlib_main_t *vlib_main;
vnet_main_t *vnet_main;
u32 end_m_gtp6_dt_node_index;
u32 error_node_index;
} srv6_end_main_v6_dt_t;
extern srv6_end_main_v6_dt_t srv6_end_main_v6_dt;
extern vlib_node_registration_t srv6_end_m_gtp6_dt;
typedef struct srv6_t_main_v4_dt_s
{
vlib_main_t *vlib_main;
vnet_main_t *vnet_main;
u32 t_m_gtp4_dt_node_index;
u32 error_node_index;
} srv6_t_main_v4_dt_t;
extern srv6_t_main_v4_dt_t srv6_t_main_v4_dt;
extern vlib_node_registration_t srv6_t_m_gtp4_dt;
#endif /* __included_srv6_end_h__ */
/*

View File

@ -0,0 +1,139 @@
SRv6 Mobile User Plane Plugin for VPP
========================
# Introduction
This plugin module can provide the stateless mobile user plane protocols translation between GTP-U and SRv6. The functions of the translation take advantage of SRv6 network programmability.
[SRv6 Mobile User Plane](https://tools.ietf.org/html/draft-ietf-dmm-srv6-mobile-uplane) defines the user plane protocol using SRv6
including following stateless translation functions:
- **T.M.GTP4.D:**
GTP-U over UDP/IPv4 -> SRv6
- **End.M.GTP4.E:**
SRv6 -> GTP-U over UDP/IPv4
- **End.M.GTP6.D:**
GTP-U over UDP/IPv6 -> SRv6
- **End.M.GTP6.E:**
SRv6 -> GTP-U over UDP/IPv6
These functions benefit user plane(overlay) to be able to utilize data plane(underlay) networks properly. And also it benefits data plane to be able to handle user plane in routing paradigm.
Noted that the prefix of function names follow naming convention of SRv6 network programming. "T" means transit function, "End" means end function, "M" means Mobility specific function. The suffix "D" and "E" mean that "decapsulation" and "encapsulation" respectively.
# Implementation
All SRv6 mobile functions are implemented as VPP plugin modules. The plugin modules leverage the sr_policy and sr_localsid mechanisms.
# Configurations
## GTP-U to SRv6
The GTP-U tunnel and flow identifiers of a receiving packet are mapped to a Segment Identifier(SID) of sending SRv6 packets.
### IPv4 infrastructure case
In case that **IPv4** networks are the infrastructure of GTP-U, T.M.GTP4.D function translates the receiving GTP-U packets to SRv6 packets.
A T.M.GTP4.D function is associated with the following mandatory parameters:
- SID: A SRv6 SID to represents the function
- DST-PREFIX: Prefix of remote SRv6 segment. The destination address or last SID of out packets consists of the prefix followed by dst IPv4 address, QFI and TEID of the receiving packets.
- SRC-PREFIX: Prefix for src address of sending packets. The src IPv6 address consists of the prefix followed by the src IPv4 address of the receiving packets.
The following command instantiates a new T.M.GTP4.D function.
```
sr policy add bsid SID behavior t.m.gtp4.d DST-PREFIX v6src_prefix SRC-PREFIX [nhtype {ipv4|ipv6|non-ip}]
```
For example, the below command configures the SID 2001:db8::1 with `t.m.gtp4.d` behavior for translating receiving GTP-U over IPv4 packets to SRv6 packets with next-header type is IPv4.
```
sr policy add bsid 2001:db8::1 behavior t.m.gtp4.d D1::/32 v6src_prefix A1::/64 nhtype ipv4
```
It should be interesting how a SRv6 BSID works to decapsulate the receiving GTP-U packets over IPv4 header. To utilize ```t.m.gtp4.d``` function, you need to configure some SR steering policy like:
```
sr steer l3 172.20.0.1/32 via bsid 2001:db8::1
```
The above steering policy with the BSID of `t.m.gtp4.d` would work properly for the GTP-U packets destined to 172.20.0.1.
If you have a SID(s) list of SR policy which the configured gtp4.d function to be applied, the SR Policy can be configured as following:
```
sr policy add bsid D1:: next A1:: next B1:: next C1::
```
### IPv6 infrastructure case
In case that GTP-U is deployed over **IPv6** infrastructure, you don't need to configure T.M.GTP4.D function and associated SR steering policy. Instead of that, you just need to configure a localsid of End.M.GTP6.D segment.
An End.M.GTP6.D segment is associated with the following mandatory parameters:
- SID-PREFIX: SRv6 SID prefix to represent the function. In this function, it should be the dst address of receiving GTP-U packets.
- DST-PREFIX: Prefix of remote SRv6 Segment. The destination address or last SID of output packets consists of the prefix followed by QFI and TEID of the receiving packets.
The following command instantiates a new End.M.GTP6.D function.
```
sr localsid prefix SID-PREFIX behavior end.m.gtp6.d DST-PREFIX [nhtype {ipv4|ipv6|non-ip}]
```
For example, the below command configures the SID prefix 2001:db8::/64 with `end.m.gtp6.d` behavior for translating receiving GTP-U over IPv6 packets which have IPv6 destination addresses within 2001:db8::/64 to SRv6 packets. The dst IPv6 address of the outgoing packets consists of D4::/64 followed by QFI and TEID.
```
sr localsid prefix 2001:db8::/64 behavior end.m.gtp6.d D4::/64
```
In another case, the translated packets from GTP-U over IPv6 to SRv6 will be re-translated back to GTP-U, which is so called 'Drop-In' mode.
In Drop-In mode, an additional IPv6 specific end segment is required, named End.M.GTP6.D.Di. It is because that unlike `end.m.gtp6.d`, it needs to preserve original IPv6 dst address as the last SID in the SRH.
Regardless of that difference exists, the required configuration parameters are same as `end.m.gtp6.d`.
The following command instantiates a new End.M.GTP6.D.Di function.
```
sr localsid prefix 2001:db8::/64 behavior end.m.gtp6.d.di D4::/64
```
## SRv6 to GTP-U
The SRv6 Mobile functions on SRv6 to GTP-U direction are End.M.GTP4.E and End.M.GTP6.D.
In this direction with GTP-U over IPv4 infrastructure, an End.M.GTP4.E segment is associated with the following mandatory parameters:
- SID-PREFIX: SRv6 SID prefix to represent the function.
- V4SRC-ADDR-POSITION: Integer number indicates bit position where IPv4 src address embedded.
The following command instantiates a new End.M.GTP4.E function.
```
sr localsid prefix SID-PREFIX behavior end.m.gtp4.e v4src_position V4SRC-ADDR-POSITION
```
For example, the below command configures the SID prefix 2001:db8::/32 with `end.m.gtp4.e` behavior for translating the receiving SRv6 packets to GTP-U packets encapsulated with UDP/IPv4 header. All the GTP-U tunnel and flow identifiers are extracted from the active SID in the receiving packets. The src IPv4 address of sending GTP-U packets is extracted from the configured bit position in the src IPv6 address.
```
sr localsid prefix 2001:db8::/32 behavior end.m.gtp4.e v4src_position 64
```
In IPv6 infrastructure case, an End.M.GTP6.E segment is associated with the following mandatory parameters:
- SID-PREFIX: SRv6 SID prefix to represent the function.
The following command instantiates a new End.M.GTP6.E function.
```
sr localsid prefix SID-PREFIX behavior end.m.gtp6.e
```
For example, the below command configures the SID prefix 2001:db8::/64 with `end.m.gtp6.e` behavior for translating the receiving SRv6 packets to GTP-U packets encapsulated with UDP/IPv6 header. While the last SID indicates GTP-U dst IPv6 address, 32-bits GTP-U TEID and 6-bits QFI are extracted from the active SID in the receiving packets.
```
sr localsid prefix 2001:db8::/64 behavior end.m.gtp6.e
```

File diff suppressed because it is too large Load Diff

View File

@ -149,6 +149,13 @@ typedef struct
ip6_address_t segments[0];
} __attribute__ ((packed)) ip6_sr_header_t;
typedef struct
{
u8 type;
u8 length;
u8 value[0];
} __attribute__ ((packed)) ip6_sr_tlv_t;
/*
* fd.io coding-style-patch-verification: ON
*