(require 'skeleton)
-(define-skeleton tunnel-c-skel
+(define-skeleton skel-tunnel-c
"Insert a tunnel cli/api implementation"
nil
'(setq encap_stack (skeleton-read "encap_stack (e.g ip4_udp_lisp): "))
/* $$$$ use a simple hash if you can ... */
key_copy = clib_mem_alloc (sizeof (*key_copy));
- memcpy (key_copy, &key, sizeof (*key_copy));
+ clib_memcpy (key_copy, &key, sizeof (*key_copy));
hash_set_mem (ngm->" encap_stack "_tunnel_by_key, key_copy,
t - ngm->tunnels);
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, * line_input = &_line_input;
+ clib_error_t *error = 0;
ip4_address_t src, dst;
u8 is_add = 1;
u8 src_set = 0;
{
encap_fib_index = fib_index_from_fib_id (tmp);
if (encap_fib_index == ~0)
- return clib_error_return (0, \"nonexistent encap fib id %d\", tmp);
+ {
+ unformat_free (line_input);
+ return clib_error_return (0, \"nonexistent encap fib id %d\", tmp);
+ }
}
else if (unformat (line_input, \"decap-vrf-id %d\", &tmp))
{
decap_fib_index = fib_index_from_fib_id (tmp);
if (decap_fib_index == ~0)
- return clib_error_return (0, \"nonexistent decap fib id %d\", tmp);
+ {
+ unformat_free (line_input);
+ return clib_error_return (0, \"nonexistent decap fib id %d\", tmp);
+ }
}
else if (unformat (line_input, \"decap-next %U\", unformat_decap_next,
&decap_next_index))
* in the " ENCAP_STACK " header
*/
else
- return clib_error_return (0, \"parse error: '%U'\",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, \"parse error: '%U'\",
+ format_unformat_error, line_input);
+ unformat_free (line_input);
+ return error;
+ }
}
unformat_free (line_input);