struct snat_main_s;
/* ICMP session match function */
-typedef u32 (snat_icmp_match_function_t) (struct snat_main_s * sm,
- vlib_node_runtime_t * node,
- u32 thread_index,
- vlib_buffer_t * b0,
- ip4_header_t * ip0,
- ip4_address_t * addr,
- u16 * port,
- u32 * fib_index,
- nat_protocol_t * proto,
- void *d, void *e,
- u8 * dont_translate);
+typedef u32 (snat_icmp_match_function_t) (
+ struct snat_main_s *sm, vlib_node_runtime_t *node, u32 thread_index,
+ vlib_buffer_t *b0, ip4_header_t *ip0, ip4_address_t *addr, u16 *port,
+ u32 *fib_index, nat_protocol_t *proto, snat_session_t **s_out,
+ u8 *dont_translate);
/* Return worker thread index for given packet */
typedef u32 (snat_get_worker_in2out_function_t) (ip4_header_t * ip,
nat_elog_X1(SNAT_LOG_INFO, "[info] " nat_elog_fmt_str, nat_elog_fmt_arg, nat_elog_val1)
/* ICMP session match functions */
-u32 icmp_match_in2out_fast (snat_main_t * sm, vlib_node_runtime_t * node,
- u32 thread_index, vlib_buffer_t * b0,
- ip4_header_t * ip0, ip4_address_t * addr,
- u16 * port, u32 * fib_index,
- nat_protocol_t * proto, void *d, void *e,
- u8 * dont_translate);
-u32 icmp_match_in2out_slow (snat_main_t * sm, vlib_node_runtime_t * node,
- u32 thread_index, vlib_buffer_t * b0,
- ip4_header_t * ip0, ip4_address_t * addr,
- u16 * port, u32 * fib_index,
- nat_protocol_t * proto, void *d, void *e,
- u8 * dont_translate);
-u32 icmp_match_out2in_fast (snat_main_t * sm, vlib_node_runtime_t * node,
- u32 thread_index, vlib_buffer_t * b0,
- ip4_header_t * ip0, ip4_address_t * addr,
- u16 * port, u32 * fib_index,
- nat_protocol_t * proto, void *d, void *e,
- u8 * dont_translate);
-u32 icmp_match_out2in_slow (snat_main_t * sm, vlib_node_runtime_t * node,
- u32 thread_index, vlib_buffer_t * b0,
- ip4_header_t * ip0, ip4_address_t * addr,
- u16 * port, u32 * fib_index,
- nat_protocol_t * proto, void *d, void *e,
- u8 * dont_translate);
-
-u32 icmp_in2out (snat_main_t * sm, vlib_buffer_t * b0, ip4_header_t * ip0,
- icmp46_header_t * icmp0, u32 sw_if_index0, u32 rx_fib_index0,
- vlib_node_runtime_t * node, u32 next0, u32 thread_index,
- void *d, void *e);
-
-u32 icmp_out2in (snat_main_t * sm, vlib_buffer_t * b0, ip4_header_t * ip0,
- icmp46_header_t * icmp0, u32 sw_if_index0, u32 rx_fib_index0,
- vlib_node_runtime_t * node, u32 next0, u32 thread_index,
- void *d, void *e);
+u32 icmp_match_in2out_fast (snat_main_t *sm, vlib_node_runtime_t *node,
+ u32 thread_index, vlib_buffer_t *b0,
+ ip4_header_t *ip0, ip4_address_t *addr, u16 *port,
+ u32 *fib_index, nat_protocol_t *proto,
+ snat_session_t **s0, u8 *dont_translate);
+u32 icmp_match_in2out_slow (snat_main_t *sm, vlib_node_runtime_t *node,
+ u32 thread_index, vlib_buffer_t *b0,
+ ip4_header_t *ip0, ip4_address_t *addr, u16 *port,
+ u32 *fib_index, nat_protocol_t *proto,
+ snat_session_t **s0, u8 *dont_translate);
+u32 icmp_match_out2in_fast (snat_main_t *sm, vlib_node_runtime_t *node,
+ u32 thread_index, vlib_buffer_t *b0,
+ ip4_header_t *ip0, ip4_address_t *addr, u16 *port,
+ u32 *fib_index, nat_protocol_t *proto,
+ snat_session_t **s0, u8 *dont_translate);
+u32 icmp_match_out2in_slow (snat_main_t *sm, vlib_node_runtime_t *node,
+ u32 thread_index, vlib_buffer_t *b0,
+ ip4_header_t *ip0, ip4_address_t *addr, u16 *port,
+ u32 *fib_index, nat_protocol_t *proto,
+ snat_session_t **s0, u8 *dont_translate);
/* hairpinning functions */
u32 snat_icmp_hairpinning (snat_main_t *sm, vlib_buffer_t *b0,
* @param e optional parameter
*/
u32
-icmp_match_in2out_slow (snat_main_t * sm, vlib_node_runtime_t * node,
- u32 thread_index, vlib_buffer_t * b0,
- ip4_header_t * ip0, ip4_address_t * addr, u16 * port,
- u32 * fib_index, nat_protocol_t * proto, void *d,
- void *e, u8 * dont_translate)
+icmp_match_in2out_slow (snat_main_t *sm, vlib_node_runtime_t *node,
+ u32 thread_index, vlib_buffer_t *b0, ip4_header_t *ip0,
+ ip4_address_t *addr, u16 *port, u32 *fib_index,
+ nat_protocol_t *proto, snat_session_t **p_s0,
+ u8 *dont_translate)
{
snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index];
u32 sw_if_index0;
*port = s0->out2in.port;
*fib_index = s0->out2in.fib_index;
}
- if (d)
- *(snat_session_t **) (d) = s0;
+ if (p_s0)
+ *p_s0 = s0;
return next0;
}
#endif
* @param e optional parameter
*/
u32
-icmp_match_in2out_fast (snat_main_t * sm, vlib_node_runtime_t * node,
- u32 thread_index, vlib_buffer_t * b0,
- ip4_header_t * ip0, ip4_address_t * addr, u16 * port,
- u32 * fib_index, nat_protocol_t * proto, void *d,
- void *e, u8 * dont_translate)
+icmp_match_in2out_fast (snat_main_t *sm, vlib_node_runtime_t *node,
+ u32 thread_index, vlib_buffer_t *b0, ip4_header_t *ip0,
+ ip4_address_t *addr, u16 *port, u32 *fib_index,
+ nat_protocol_t *proto, snat_session_t **s0,
+ u8 *dont_translate)
{
u32 sw_if_index0;
u8 is_addr_only;
}
#endif
+u32 icmp_in2out (snat_main_t *sm, vlib_buffer_t *b0, ip4_header_t *ip0,
+ icmp46_header_t *icmp0, u32 sw_if_index0, u32 rx_fib_index0,
+ vlib_node_runtime_t *node, u32 next0, u32 thread_index,
+ snat_session_t **p_s0);
+
#ifndef CLIB_MARCH_VARIANT
u32
-icmp_in2out (snat_main_t * sm,
- vlib_buffer_t * b0,
- ip4_header_t * ip0,
- icmp46_header_t * icmp0,
- u32 sw_if_index0,
- u32 rx_fib_index0,
- vlib_node_runtime_t * node,
- u32 next0, u32 thread_index, void *d, void *e)
+icmp_in2out (snat_main_t *sm, vlib_buffer_t *b0, ip4_header_t *ip0,
+ icmp46_header_t *icmp0, u32 sw_if_index0, u32 rx_fib_index0,
+ vlib_node_runtime_t *node, u32 next0, u32 thread_index,
+ snat_session_t **p_s0)
{
vlib_main_t *vm = vlib_get_main ();
ip4_address_t addr;
next0_tmp =
sm->icmp_match_in2out_cb (sm, node, thread_index, b0, ip0, &addr, &port,
- &fib_index, &protocol, d, e, &dont_translate);
+ &fib_index, &protocol, p_s0, &dont_translate);
if (next0_tmp != ~0)
next0 = next0_tmp;
if (next0 == SNAT_IN2OUT_NEXT_DROP || dont_translate)
vlib_main_t *vm = vlib_get_main ();
next0 = icmp_in2out (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node,
- next0, thread_index, p_s0, 0);
+ next0, thread_index, p_s0);
snat_session_t *s0 = *p_s0;
if (PREDICT_TRUE (next0 != SNAT_IN2OUT_NEXT_DROP && s0))
{
if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP))
{
next0 = icmp_in2out (sm, b0, ip0, icmp0, sw_if_index0,
- rx_fib_index0, node, next0, ~0, 0, 0);
+ rx_fib_index0, node, next0, ~0, 0);
goto trace0;
}
* @param e optional parameter
*/
u32
-icmp_match_out2in_slow (snat_main_t * sm, vlib_node_runtime_t * node,
- u32 thread_index, vlib_buffer_t * b0,
- ip4_header_t * ip0, ip4_address_t * addr,
- u16 * port, u32 * fib_index,
- nat_protocol_t * proto, void *d, void *e,
- u8 * dont_translate)
+icmp_match_out2in_slow (snat_main_t *sm, vlib_node_runtime_t *node,
+ u32 thread_index, vlib_buffer_t *b0, ip4_header_t *ip0,
+ ip4_address_t *addr, u16 *port, u32 *fib_index,
+ nat_protocol_t *proto, snat_session_t **p_s0,
+ u8 *dont_translate)
{
snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index];
u32 sw_if_index0;
*port = s0->in2out.port;
*fib_index = s0->in2out.fib_index;
}
- if (d)
- *(snat_session_t **) d = s0;
+ if (p_s0)
+ *p_s0 = s0;
return next0;
}
#endif
* @param e optional parameter
*/
u32
-icmp_match_out2in_fast (snat_main_t * sm, vlib_node_runtime_t * node,
- u32 thread_index, vlib_buffer_t * b0,
- ip4_header_t * ip0, ip4_address_t * mapping_addr,
- u16 * mapping_port, u32 * mapping_fib_index,
- nat_protocol_t * proto, void *d, void *e,
- u8 * dont_translate)
+icmp_match_out2in_fast (snat_main_t *sm, vlib_node_runtime_t *node,
+ u32 thread_index, vlib_buffer_t *b0, ip4_header_t *ip0,
+ ip4_address_t *mapping_addr, u16 *mapping_port,
+ u32 *mapping_fib_index, nat_protocol_t *proto,
+ snat_session_t **p_s0, u8 *dont_translate)
{
u32 sw_if_index0;
u32 rx_fib_index0;
}
#endif
+u32 icmp_out2in (snat_main_t *sm, vlib_buffer_t *b0, ip4_header_t *ip0,
+ icmp46_header_t *icmp0, u32 sw_if_index0, u32 rx_fib_index0,
+ vlib_node_runtime_t *node, u32 next0, u32 thread_index,
+ snat_session_t **p_s0);
+
#ifndef CLIB_MARCH_VARIANT
u32
-icmp_out2in (snat_main_t * sm,
- vlib_buffer_t * b0,
- ip4_header_t * ip0,
- icmp46_header_t * icmp0,
- u32 sw_if_index0,
- u32 rx_fib_index0,
- vlib_node_runtime_t * node,
- u32 next0, u32 thread_index, void *d, void *e)
+icmp_out2in (snat_main_t *sm, vlib_buffer_t *b0, ip4_header_t *ip0,
+ icmp46_header_t *icmp0, u32 sw_if_index0, u32 rx_fib_index0,
+ vlib_node_runtime_t *node, u32 next0, u32 thread_index,
+ snat_session_t **p_s0)
{
icmp_echo_header_t *echo0, *inner_echo0 = 0;
ip4_header_t *inner_ip0 = 0;
echo0 = (icmp_echo_header_t *) (icmp0 + 1);
- next0_tmp = sm->icmp_match_out2in_cb (sm, node, thread_index, b0, ip0,
- &addr, &port, &fib_index, &proto,
- d, e, &dont_translate);
+ next0_tmp =
+ sm->icmp_match_out2in_cb (sm, node, thread_index, b0, ip0, &addr, &port,
+ &fib_index, &proto, p_s0, &dont_translate);
if (next0_tmp != ~0)
next0 = next0_tmp;
if (next0 == SNAT_OUT2IN_NEXT_DROP || dont_translate)
vlib_main_t *vm = vlib_get_main ();
next0 = icmp_out2in (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node,
- next0, thread_index, p_s0, 0);
+ next0, thread_index, p_s0);
snat_session_t *s0 = *p_s0;
if (PREDICT_TRUE (next0 != SNAT_OUT2IN_NEXT_DROP && s0))
{
if (PREDICT_FALSE (proto0 == NAT_PROTOCOL_ICMP))
{
- next0 = icmp_out2in (sm, b0, ip0, icmp0, sw_if_index0,
- rx_fib_index0, node, next0, ~0, 0, 0);
+ next0 = icmp_out2in (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0,
+ node, next0, ~0, 0);
goto trace00;
}