u32 session_index;
u32 counter_index;
u32 nincr = 0;
- u32 cpu_index = os_get_cpu_number ();
+ u32 thread_index = vm->thread_index;
/* *INDENT-OFF* */
pool_foreach (session, lm->sessions,
session_index_to_counter_index (session_index,
SESSION_COUNTER_USER_TO_NETWORK);
vlib_increment_combined_counter (&lm->counter_main,
- cpu_index,
+ thread_index,
counter_index,
1/*pkt*/, 1111 /*bytes*/);
vlib_increment_combined_counter (&lm->counter_main,
- cpu_index,
+ thread_index,
counter_index+1,
1/*pkt*/, 2222 /*bytes*/);
nincr++;
return 0;
}
-static uword
-dummy_interface_tx (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
-{
- clib_warning ("you shouldn't be here, leaking buffers...");
- return frame->n_vectors;
-}
-
/* *INDENT-OFF* */
VNET_DEVICE_CLASS (l2tpv3_device_class,static) = {
.name = "L2TPv3",
.format_device_name = format_l2tpv3_name,
.name_renumber = l2tpv3_name_renumber,
- .tx_function = dummy_interface_tx,
};
/* *INDENT-ON* */
return VNET_API_ERROR_INVALID_VALUE;
pool_get (lm->sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
clib_memcpy (&s->our_address, our_address, sizeof (s->our_address));
clib_memcpy (&s->client_address, client_address,
sizeof (s->client_address));
if (sw_if_index)
*sw_if_index = hi->sw_if_index;
+ if (!lm->proto_registered)
+ {
+ ip6_register_protocol (IP_PROTOCOL_L2TP, l2t_decap_local_node.index);
+ lm->proto_registered = true;
+ }
+
return 0;
}
u32 sw_if_index;
u32 encap_fib_id = ~0;
u32 encap_fib_index = ~0;
+ clib_error_t *error = NULL;
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
else if (unformat (line_input, "l2-sublayer-present"))
l2_sublayer_present = 1;
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);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (encap_fib_id != ~0)
{
uword *p;
ip6_main_t *im = &ip6_main;
if (!(p = hash_get (im->fib_index_by_table_id, encap_fib_id)))
- return clib_error_return (0, "No fib with id %d", encap_fib_id);
+ {
+ error = clib_error_return (0, "No fib with id %d", encap_fib_id);
+ goto done;
+ }
encap_fib_index = p[0];
}
else
}
if (our_address_set == 0)
- return clib_error_return (0, "our address not specified");
+ {
+ error = clib_error_return (0, "our address not specified");
+ goto done;
+ }
if (client_address_set == 0)
- return clib_error_return (0, "client address not specified");
+ {
+ error = clib_error_return (0, "client address not specified");
+ goto done;
+ }
rv = create_l2tpv3_ipv6_tunnel (lm, &client_address, &our_address,
local_session_id, remote_session_id,
vnet_get_main (), sw_if_index);
break;
case VNET_API_ERROR_INVALID_VALUE:
- return clib_error_return (0, "session already exists...");
+ error = clib_error_return (0, "session already exists...");
+ goto done;
case VNET_API_ERROR_NO_SUCH_ENTRY:
- return clib_error_return (0, "session does not exist...");
+ error = clib_error_return (0, "session does not exist...");
+ goto done;
default:
- return clib_error_return (0, "l2tp_session_add_del returned %d", rv);
+ error = clib_error_return (0, "l2tp_session_add_del returned %d", rv);
+ goto done;
}
- return 0;
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
return 0;
}
-/* Enable/disable L2TPv3 intercept on IP6 fowarding path */
+/* Enable/disable L2TPv3 intercept on IP6 forwarding path */
static clib_error_t *
set_ip6_l2tpv3 (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
pi = ip_get_protocol_info (im, IP_PROTOCOL_L2TP);
pi->unformat_pg_edit = unformat_pg_l2tp_header;
+ lm->proto_registered = false;
+
/* insure these nodes are included in build */
l2tp_encap_init (vm);
- l2tp_decap_init ();
return 0;
}
VLIB_INIT_FUNCTION (l2tp_init);
+clib_error_t *
+l2tp_worker_init (vlib_main_t * vm)
+{
+ l2tp_encap_init (vm);
+
+ return 0;
+}
+
+VLIB_WORKER_INIT_FUNCTION (l2tp_worker_init);
+
/*
* fd.io coding-style-patch-verification: ON
*