summaryrefslogtreecommitdiffstats
path: root/src/plugins/srv6-mobile/gtp4_e.c
diff options
context:
space:
mode:
authorTetsuya Murakami <tetsuya.mrk@gmail.com>2021-12-10 08:11:07 -0800
committerOle Tr�an <otroan@employees.org>2022-01-05 10:52:22 +0000
commitbe872a8ddae5812eb5690841fbc066967d0d9bb3 (patch)
treed753cdc9ab994a5744f45be0ef1fec82831838e6 /src/plugins/srv6-mobile/gtp4_e.c
parentdfc853c0ac2f8f15765a51268a53b023d4cf6c65 (diff)
srv6-mobile: Update GTP4/6.D function
GTP4/6.D behavior is updated as shown below. 1. When receiving GTP-U message or IPv6 linklocal destination in inner IP, GTP packet is tnralated to SRv6. 2. When receiving T-PDU packet, OuterIP/UDP/GTP headers are stripped off and Inner IP is encapsulated into SRv6 based on L3VPN SRv6 manner. Type: feature Signed-off-by: Tetsuya Murakami <tetsuya.mrk@gmail.com> Change-Id: I6092c98ea80236d54017f84c5b35cca0b645f034 Signed-off-by: Tetsuya Murakami <tetsuya.mrk@gmail.com>
Diffstat (limited to 'src/plugins/srv6-mobile/gtp4_e.c')
-rw-r--r--src/plugins/srv6-mobile/gtp4_e.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/src/plugins/srv6-mobile/gtp4_e.c b/src/plugins/srv6-mobile/gtp4_e.c
index 211e95d11de..580619f761f 100644
--- a/src/plugins/srv6-mobile/gtp4_e.c
+++ b/src/plugins/srv6-mobile/gtp4_e.c
@@ -66,11 +66,16 @@ static u8 param_str[] = "";
static u8 *
clb_format_srv6_end_m_gtp4_e (u8 * s, va_list * args)
{
- srv6_end_gtp4_param_t *ls_mem = va_arg (*args, void *);
+ srv6_end_gtp4_e_param_t *ls_mem = va_arg (*args, void *);
- s = format (s, "SRv6 End gtp4.e\n\t");
+ s = format (s, "SRv6 End gtp4.e\n");
- s = format (s, "IPv4 address position: %d\n", ls_mem->v4src_position);
+ s = format (s, "\tIPv4 address position: %d\n", ls_mem->v4src_position);
+
+ s = format (s, "\tIPv4 source address: %U\n", format_ip4_address,
+ &ls_mem->v4src_addr);
+
+ s = format (s, "\tFib Table %d\n", ls_mem->fib_table);
return s;
}
@@ -79,10 +84,33 @@ static uword
clb_unformat_srv6_end_m_gtp4_e (unformat_input_t * input, va_list * args)
{
void **plugin_mem_p = va_arg (*args, void **);
- srv6_end_gtp4_param_t *ls_mem;
- u32 v4src_position;
-
- if (!unformat (input, "end.m.gtp4.e v4src_position %d", &v4src_position))
+ srv6_end_gtp4_e_param_t *ls_mem;
+ ip4_address_t v4src_addr;
+ u32 v4src_position = 0;
+ u32 fib_table;
+ bool config = false;
+
+ memset (&v4src_addr, 0, sizeof (ip4_address_t));
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "end.m.gtp4.e v4src_position %d fib-table %d",
+ &v4src_position, &fib_table))
+ {
+ config = true;
+ }
+ else if (unformat (input, "end.m.gtp4.e v4src_addr %U fib-table %d",
+ unformat_ip4_address, &v4src_addr, &fib_table))
+ {
+ config = true;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ if (!config)
return 0;
ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
@@ -90,6 +118,11 @@ clb_unformat_srv6_end_m_gtp4_e (unformat_input_t * input, va_list * args)
*plugin_mem_p = ls_mem;
ls_mem->v4src_position = v4src_position;
+ memcpy (&ls_mem->v4src_addr, &v4src_addr, sizeof (ip4_address_t));
+
+ ls_mem->fib_table = fib_table;
+ ls_mem->fib4_index = ip4_fib_index_from_table_id (fib_table);
+ ls_mem->fib6_index = ip6_fib_index_from_table_id (fib_table);
return 1;
}
@@ -103,7 +136,7 @@ clb_creation_srv6_end_m_gtp4_e (ip6_sr_localsid_t * localsid)
static int
clb_removal_srv6_end_m_gtp4_e (ip6_sr_localsid_t * localsid)
{
- srv6_end_gtp4_param_t *ls_mem;
+ srv6_end_gtp4_e_param_t *ls_mem;
ls_mem = localsid->plugin_mem;