From 68ac244283b60cbaf6356ab732f1d31583bb3e7a Mon Sep 17 00:00:00 2001 From: Takeru Hayasaka Date: Fri, 28 Oct 2022 04:26:05 +0900 Subject: srv6-mobile: Implement SRv6 mobile API funcs This merge request adds the feature to manipulate localsids and policies for SRv6 mobile via API. Type: feature Signed-off-by: Takeru Hayasaka Change-Id: Ibb46bf71ae1d9d4591ce2c8ccf66f520887dad70 --- src/plugins/srv6-mobile/gtp6_e.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/plugins/srv6-mobile/gtp6_e.c') diff --git a/src/plugins/srv6-mobile/gtp6_e.c b/src/plugins/srv6-mobile/gtp6_e.c index feaaaf95419..49b1bd1a6d9 100644 --- a/src/plugins/srv6-mobile/gtp6_e.c +++ b/src/plugins/srv6-mobile/gtp6_e.c @@ -76,16 +76,10 @@ clb_format_srv6_end_m_gtp6_e (u8 * s, va_list * args) return s; } -static uword -clb_unformat_srv6_end_m_gtp6_e (unformat_input_t * input, va_list * args) +void +alloc_param_srv6_end_m_gtp6_e (void **plugin_mem_p, const u32 fib_table) { - void **plugin_mem_p = va_arg (*args, void **); srv6_end_gtp6_e_param_t *ls_mem; - u32 fib_table; - - if (!unformat (input, "end.m.gtp6.e fib-table %d", &fib_table)) - return 0; - ls_mem = clib_mem_alloc (sizeof *ls_mem); clib_memset (ls_mem, 0, sizeof *ls_mem); *plugin_mem_p = ls_mem; @@ -93,6 +87,18 @@ clb_unformat_srv6_end_m_gtp6_e (unformat_input_t * input, va_list * args) 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); +} + +static uword +clb_unformat_srv6_end_m_gtp6_e (unformat_input_t *input, va_list *args) +{ + void **plugin_mem_p = va_arg (*args, void **); + u32 fib_table; + + if (!unformat (input, "end.m.gtp6.e fib-table %d", &fib_table)) + return 0; + + alloc_param_srv6_end_m_gtp6_e (plugin_mem_p, fib_table); return 1; } -- cgit 1.2.3-korg