X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fsrv6-mobile%2Fgtp6_d.c;h=1f5b9ac0d0f93c41daa33eacb508f2966ea1d976;hb=68ac24428;hp=79549276c2cfcdd9bc38e260421d870816b1c451;hpb=69f800fbfd559c8db21d064ceeca5f81fb1f0021;p=vpp.git diff --git a/src/plugins/srv6-mobile/gtp6_d.c b/src/plugins/srv6-mobile/gtp6_d.c index 79549276c2c..1f5b9ac0d0f 100644 --- a/src/plugins/srv6-mobile/gtp6_d.c +++ b/src/plugins/srv6-mobile/gtp6_d.c @@ -94,11 +94,29 @@ clb_format_srv6_end_m_gtp6_d (u8 * s, va_list * args) return s; } +void +alloc_param_srv6_end_m_gtp6_d (void **plugin_mem_p, const void *sr_prefix, + const u32 sr_prefixlen, const u8 nhtype, + const bool drop_in, const u32 fib_table) +{ + srv6_end_gtp6_d_param_t *ls_mem; + ls_mem = clib_mem_alloc (sizeof *ls_mem); + clib_memset (ls_mem, 0, sizeof *ls_mem); + *plugin_mem_p = ls_mem; + + ls_mem->sr_prefixlen = sr_prefixlen; + memcpy (&ls_mem->sr_prefix, sr_prefix, sizeof (ip6_address_t)); + ls_mem->nhtype = nhtype; + ls_mem->drop_in = drop_in; + 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_d (unformat_input_t * input, va_list * args) { void **plugin_mem_p = va_arg (*args, void **); - srv6_end_gtp6_d_param_t *ls_mem; ip6_address_t sr_prefix; u32 sr_prefixlen; u8 nhtype = SRV6_NHTYPE_NONE; @@ -150,20 +168,8 @@ clb_unformat_srv6_end_m_gtp6_d (unformat_input_t * input, va_list * args) return 0; } - ls_mem = clib_mem_alloc (sizeof *ls_mem); - clib_memset (ls_mem, 0, sizeof *ls_mem); - *plugin_mem_p = ls_mem; - - ls_mem->sr_prefix = sr_prefix; - ls_mem->sr_prefixlen = sr_prefixlen; - - ls_mem->nhtype = nhtype; - - ls_mem->drop_in = drop_in; - - 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); + alloc_param_srv6_end_m_gtp6_d (plugin_mem_p, &sr_prefix, sr_prefixlen, + nhtype, drop_in, fib_table); return 1; }