2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vlib/vlib.h>
17 #include <vnet/vnet.h>
18 #include <vnet/pg/pg.h>
19 #include <vnet/handoff.h>
21 #include <vnet/ip/ip.h>
22 #include <vnet/ethernet/ethernet.h>
23 #include <vnet/fib/ip4_fib.h>
24 #include <snat/snat.h>
26 #include <vppinfra/hash.h>
27 #include <vppinfra/error.h>
28 #include <vppinfra/elog.h>
35 } snat_in2out_trace_t;
38 u32 next_worker_index;
40 } snat_in2out_worker_handoff_trace_t;
42 /* packet trace format function */
43 static u8 * format_snat_in2out_trace (u8 * s, va_list * args)
45 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
46 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
47 snat_in2out_trace_t * t = va_arg (*args, snat_in2out_trace_t *);
50 tag = t->is_slow_path ? "SNAT_IN2OUT_SLOW_PATH" : "SNAT_IN2OUT_FAST_PATH";
52 s = format (s, "%s: sw_if_index %d, next index %d, session %d", tag,
53 t->sw_if_index, t->next_index, t->session_index);
58 static u8 * format_snat_in2out_fast_trace (u8 * s, va_list * args)
60 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
61 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
62 snat_in2out_trace_t * t = va_arg (*args, snat_in2out_trace_t *);
64 s = format (s, "SANT_IN2OUT_FAST: sw_if_index %d, next index %d",
65 t->sw_if_index, t->next_index);
70 static u8 * format_snat_in2out_worker_handoff_trace (u8 * s, va_list * args)
72 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
73 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
74 snat_in2out_worker_handoff_trace_t * t =
75 va_arg (*args, snat_in2out_worker_handoff_trace_t *);
78 m = t->do_handoff ? "next worker" : "same worker";
79 s = format (s, "SNAT_IN2OUT_WORKER_HANDOFF: %s %d", m, t->next_worker_index);
84 vlib_node_registration_t snat_in2out_node;
85 vlib_node_registration_t snat_in2out_slowpath_node;
86 vlib_node_registration_t snat_in2out_fast_node;
87 vlib_node_registration_t snat_in2out_worker_handoff_node;
89 #define foreach_snat_in2out_error \
90 _(UNSUPPORTED_PROTOCOL, "Unsupported protocol") \
91 _(IN2OUT_PACKETS, "Good in2out packets processed") \
92 _(OUT_OF_PORTS, "Out of ports") \
93 _(BAD_OUTSIDE_FIB, "Outside VRF ID not found") \
94 _(BAD_ICMP_TYPE, "icmp type not echo-request") \
95 _(NO_TRANSLATION, "No translation")
98 #define _(sym,str) SNAT_IN2OUT_ERROR_##sym,
99 foreach_snat_in2out_error
102 } snat_in2out_error_t;
104 static char * snat_in2out_error_strings[] = {
105 #define _(sym,string) string,
106 foreach_snat_in2out_error
111 SNAT_IN2OUT_NEXT_LOOKUP,
112 SNAT_IN2OUT_NEXT_DROP,
113 SNAT_IN2OUT_NEXT_SLOW_PATH,
115 } snat_in2out_next_t;
117 static u32 slow_path (snat_main_t *sm, vlib_buffer_t *b0,
120 snat_session_key_t * key0,
121 snat_session_t ** sessionp,
122 vlib_node_runtime_t * node,
127 snat_user_key_t user_key;
129 clib_bihash_kv_8_8_t kv0, value0;
130 u32 oldest_per_user_translation_list_index;
131 dlist_elt_t * oldest_per_user_translation_list_elt;
132 dlist_elt_t * per_user_translation_list_elt;
133 dlist_elt_t * per_user_list_head_elt;
135 snat_session_key_t key1;
136 u32 address_index = ~0;
137 u32 outside_fib_index;
139 snat_static_mapping_key_t worker_by_out_key;
141 p = hash_get (sm->ip4_main->fib_index_by_table_id, sm->outside_vrf_id);
144 b0->error = node->errors[SNAT_IN2OUT_ERROR_BAD_OUTSIDE_FIB];
145 return SNAT_IN2OUT_NEXT_DROP;
147 outside_fib_index = p[0];
149 user_key.addr = ip0->src_address;
150 user_key.fib_index = rx_fib_index0;
151 kv0.key = user_key.as_u64;
153 /* Ever heard of the "user" = src ip4 address before? */
154 if (clib_bihash_search_8_8 (&sm->user_hash, &kv0, &value0))
156 /* no, make a new one */
157 pool_get (sm->per_thread_data[cpu_index].users, u);
158 memset (u, 0, sizeof (*u));
159 u->addr = ip0->src_address;
161 pool_get (sm->per_thread_data[cpu_index].list_pool, per_user_list_head_elt);
163 u->sessions_per_user_list_head_index = per_user_list_head_elt -
164 sm->per_thread_data[cpu_index].list_pool;
166 clib_dlist_init (sm->per_thread_data[cpu_index].list_pool,
167 u->sessions_per_user_list_head_index);
169 kv0.value = u - sm->per_thread_data[cpu_index].users;
172 clib_bihash_add_del_8_8 (&sm->user_hash, &kv0, 1 /* is_add */);
176 u = pool_elt_at_index (sm->per_thread_data[cpu_index].users,
180 /* Over quota? Recycle the least recently used dynamic translation */
181 if (u->nsessions >= sm->max_translations_per_user)
183 /* Remove the oldest dynamic translation */
185 oldest_per_user_translation_list_index =
186 clib_dlist_remove_head (sm->per_thread_data[cpu_index].list_pool,
187 u->sessions_per_user_list_head_index);
189 ASSERT (oldest_per_user_translation_list_index != ~0);
191 /* add it back to the end of the LRU list */
192 clib_dlist_addtail (sm->per_thread_data[cpu_index].list_pool,
193 u->sessions_per_user_list_head_index,
194 oldest_per_user_translation_list_index);
195 /* Get the list element */
196 oldest_per_user_translation_list_elt =
197 pool_elt_at_index (sm->per_thread_data[cpu_index].list_pool,
198 oldest_per_user_translation_list_index);
200 /* Get the session index from the list element */
201 session_index = oldest_per_user_translation_list_elt->value;
203 /* Get the session */
204 s = pool_elt_at_index (sm->per_thread_data[cpu_index].sessions,
206 } while (!snat_is_session_static (s));
208 /* Remove in2out, out2in keys */
209 kv0.key = s->in2out.as_u64;
210 if (clib_bihash_add_del_8_8 (&sm->in2out, &kv0, 0 /* is_add */))
211 clib_warning ("in2out key delete failed");
212 kv0.key = s->out2in.as_u64;
213 if (clib_bihash_add_del_8_8 (&sm->out2in, &kv0, 0 /* is_add */))
214 clib_warning ("out2in key delete failed");
216 snat_free_outside_address_and_port
217 (sm, &s->out2in, s->outside_address_index);
218 s->outside_address_index = ~0;
220 if (snat_alloc_outside_address_and_port (sm, &key1, &address_index))
224 b0->error = node->errors[SNAT_IN2OUT_ERROR_OUT_OF_PORTS];
225 return SNAT_IN2OUT_NEXT_DROP;
227 s->outside_address_index = address_index;
231 u8 static_mapping = 1;
233 /* First try to match static mapping by local address and port */
234 if (snat_static_mapping_match (sm, *key0, &key1, 0))
237 /* Try to create dynamic translation */
238 if (snat_alloc_outside_address_and_port (sm, &key1, &address_index))
240 b0->error = node->errors[SNAT_IN2OUT_ERROR_OUT_OF_PORTS];
241 return SNAT_IN2OUT_NEXT_DROP;
245 /* Create a new session */
246 pool_get (sm->per_thread_data[cpu_index].sessions, s);
247 memset (s, 0, sizeof (*s));
249 s->outside_address_index = address_index;
253 u->nstaticsessions++;
254 s->flags |= SNAT_SESSION_FLAG_STATIC_MAPPING;
261 /* Create list elts */
262 pool_get (sm->per_thread_data[cpu_index].list_pool,
263 per_user_translation_list_elt);
264 clib_dlist_init (sm->per_thread_data[cpu_index].list_pool,
265 per_user_translation_list_elt -
266 sm->per_thread_data[cpu_index].list_pool);
268 per_user_translation_list_elt->value =
269 s - sm->per_thread_data[cpu_index].sessions;
270 s->per_user_index = per_user_translation_list_elt -
271 sm->per_thread_data[cpu_index].list_pool;
272 s->per_user_list_head_index = u->sessions_per_user_list_head_index;
274 clib_dlist_addtail (sm->per_thread_data[cpu_index].list_pool,
275 s->per_user_list_head_index,
276 per_user_translation_list_elt -
277 sm->per_thread_data[cpu_index].list_pool);
282 s->out2in.protocol = key0->protocol;
283 s->out2in.fib_index = outside_fib_index;
286 /* Add to translation hashes */
287 kv0.key = s->in2out.as_u64;
288 kv0.value = s - sm->per_thread_data[cpu_index].sessions;
289 if (clib_bihash_add_del_8_8 (&sm->in2out, &kv0, 1 /* is_add */))
290 clib_warning ("in2out key add failed");
292 kv0.key = s->out2in.as_u64;
293 kv0.value = s - sm->per_thread_data[cpu_index].sessions;
295 if (clib_bihash_add_del_8_8 (&sm->out2in, &kv0, 1 /* is_add */))
296 clib_warning ("out2in key add failed");
298 /* Add to translated packets worker lookup */
299 worker_by_out_key.addr = s->out2in.addr;
300 worker_by_out_key.port = s->out2in.port;
301 worker_by_out_key.fib_index = s->out2in.fib_index;
302 kv0.key = worker_by_out_key.as_u64;
303 kv0.value = cpu_index;
304 clib_bihash_add_del_8_8 (&sm->worker_by_out, &kv0, 1);
308 static inline u32 icmp_in2out_slow_path (snat_main_t *sm,
311 icmp46_header_t * icmp0,
314 vlib_node_runtime_t * node,
319 snat_session_key_t key0;
320 icmp_echo_header_t *echo0;
321 clib_bihash_kv_8_8_t kv0, value0;
323 u32 new_addr0, old_addr0;
324 u16 old_id0, new_id0;
326 snat_runtime_t * rt = (snat_runtime_t *)node->runtime_data;
328 if (PREDICT_FALSE(icmp0->type != ICMP4_echo_request))
330 b0->error = node->errors[SNAT_IN2OUT_ERROR_BAD_ICMP_TYPE];
331 return SNAT_IN2OUT_NEXT_DROP;
334 echo0 = (icmp_echo_header_t *)(icmp0+1);
336 key0.addr = ip0->src_address;
337 key0.port = echo0->identifier;
338 key0.protocol = SNAT_PROTOCOL_ICMP;
339 key0.fib_index = rx_fib_index0;
341 kv0.key = key0.as_u64;
343 if (clib_bihash_search_8_8 (&sm->in2out, &kv0, &value0))
345 ip4_address_t * first_int_addr;
347 if (PREDICT_FALSE(rt->cached_sw_if_index != sw_if_index0))
350 ip4_interface_first_address (sm->ip4_main, sw_if_index0,
351 0 /* just want the address */);
352 rt->cached_sw_if_index = sw_if_index0;
353 rt->cached_ip4_address = first_int_addr->as_u32;
356 /* Don't NAT packet aimed at the intfc address */
357 if (PREDICT_FALSE(ip0->dst_address.as_u32 ==
358 rt->cached_ip4_address))
361 next0 = slow_path (sm, b0, ip0, rx_fib_index0, &key0,
362 &s0, node, next0, cpu_index);
364 if (PREDICT_FALSE (next0 == SNAT_IN2OUT_NEXT_DROP))
368 s0 = pool_elt_at_index (sm->per_thread_data[cpu_index].sessions,
371 old_addr0 = ip0->src_address.as_u32;
372 ip0->src_address = s0->out2in.addr;
373 new_addr0 = ip0->src_address.as_u32;
374 vnet_buffer(b0)->sw_if_index[VLIB_TX] = s0->out2in.fib_index;
376 sum0 = ip0->checksum;
377 sum0 = ip_csum_update (sum0, old_addr0, new_addr0,
379 src_address /* changed member */);
380 ip0->checksum = ip_csum_fold (sum0);
382 old_id0 = echo0->identifier;
383 new_id0 = s0->out2in.port;
384 echo0->identifier = new_id0;
386 sum0 = icmp0->checksum;
387 sum0 = ip_csum_update (sum0, old_id0, new_id0, icmp_echo_header_t,
389 icmp0->checksum = ip_csum_fold (sum0);
392 s0->last_heard = now;
394 s0->total_bytes += vlib_buffer_length_in_chain (sm->vlib_main, b0);
395 /* Per-user LRU list maintenance for dynamic translations */
396 if (!snat_is_session_static (s0))
398 clib_dlist_remove (sm->per_thread_data[cpu_index].list_pool,
400 clib_dlist_addtail (sm->per_thread_data[cpu_index].list_pool,
401 s0->per_user_list_head_index,
409 snat_in2out_node_fn_inline (vlib_main_t * vm,
410 vlib_node_runtime_t * node,
411 vlib_frame_t * frame, int is_slow_path)
413 u32 n_left_from, * from, * to_next;
414 snat_in2out_next_t next_index;
415 u32 pkts_processed = 0;
416 snat_main_t * sm = &snat_main;
417 snat_runtime_t * rt = (snat_runtime_t *)node->runtime_data;
418 f64 now = vlib_time_now (vm);
419 u32 stats_node_index;
420 u32 cpu_index = os_get_cpu_number ();
422 stats_node_index = is_slow_path ? snat_in2out_slowpath_node.index :
423 snat_in2out_node.index;
425 from = vlib_frame_vector_args (frame);
426 n_left_from = frame->n_vectors;
427 next_index = node->cached_next_index;
429 while (n_left_from > 0)
433 vlib_get_next_frame (vm, node, next_index,
434 to_next, n_left_to_next);
436 while (n_left_from >= 4 && n_left_to_next >= 2)
439 vlib_buffer_t * b0, * b1;
441 u32 sw_if_index0, sw_if_index1;
442 ip4_header_t * ip0, * ip1;
443 ip_csum_t sum0, sum1;
444 u32 new_addr0, old_addr0, new_addr1, old_addr1;
445 u16 old_port0, new_port0, old_port1, new_port1;
446 udp_header_t * udp0, * udp1;
447 tcp_header_t * tcp0, * tcp1;
448 icmp46_header_t * icmp0, * icmp1;
449 snat_session_key_t key0, key1;
450 u32 rx_fib_index0, rx_fib_index1;
452 snat_session_t * s0 = 0, * s1 = 0;
453 clib_bihash_kv_8_8_t kv0, value0, kv1, value1;
455 /* Prefetch next iteration. */
457 vlib_buffer_t * p2, * p3;
459 p2 = vlib_get_buffer (vm, from[2]);
460 p3 = vlib_get_buffer (vm, from[3]);
462 vlib_prefetch_buffer_header (p2, LOAD);
463 vlib_prefetch_buffer_header (p3, LOAD);
465 CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
466 CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
469 /* speculatively enqueue b0 and b1 to the current next frame */
470 to_next[0] = bi0 = from[0];
471 to_next[1] = bi1 = from[1];
477 b0 = vlib_get_buffer (vm, bi0);
478 b1 = vlib_get_buffer (vm, bi1);
480 ip0 = vlib_buffer_get_current (b0);
481 udp0 = ip4_next_header (ip0);
482 tcp0 = (tcp_header_t *) udp0;
483 icmp0 = (icmp46_header_t *) udp0;
485 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
486 rx_fib_index0 = vec_elt (sm->ip4_main->fib_index_by_sw_if_index,
489 next0 = next1 = SNAT_IN2OUT_NEXT_LOOKUP;
492 proto0 = (ip0->protocol == IP_PROTOCOL_UDP)
493 ? SNAT_PROTOCOL_UDP : proto0;
494 proto0 = (ip0->protocol == IP_PROTOCOL_TCP)
495 ? SNAT_PROTOCOL_TCP : proto0;
496 proto0 = (ip0->protocol == IP_PROTOCOL_ICMP)
497 ? SNAT_PROTOCOL_ICMP : proto0;
499 /* Next configured feature, probably ip4-lookup */
502 if (PREDICT_FALSE (proto0 == ~0))
505 if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP))
507 next0 = icmp_in2out_slow_path
508 (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0,
509 node, next0, now, cpu_index);
515 if (PREDICT_FALSE (proto0 == ~0 || proto0 == SNAT_PROTOCOL_ICMP))
517 next0 = SNAT_IN2OUT_NEXT_SLOW_PATH;
522 key0.addr = ip0->src_address;
523 key0.port = udp0->src_port;
524 key0.protocol = proto0;
525 key0.fib_index = rx_fib_index0;
527 kv0.key = key0.as_u64;
529 if (PREDICT_FALSE (clib_bihash_search_8_8 (&sm->in2out, &kv0, &value0) != 0))
533 ip4_address_t * first_int_addr;
535 if (PREDICT_FALSE(rt->cached_sw_if_index != sw_if_index0))
538 ip4_interface_first_address (sm->ip4_main, sw_if_index0,
539 0 /* just want the address */);
540 rt->cached_sw_if_index = sw_if_index0;
541 rt->cached_ip4_address = first_int_addr->as_u32;
544 /* Don't NAT packet aimed at the intfc address */
545 if (PREDICT_FALSE(ip0->dst_address.as_u32 ==
546 rt->cached_ip4_address))
549 next0 = slow_path (sm, b0, ip0, rx_fib_index0, &key0,
550 &s0, node, next0, cpu_index);
551 if (PREDICT_FALSE (next0 == SNAT_IN2OUT_NEXT_DROP))
556 next0 = SNAT_IN2OUT_NEXT_SLOW_PATH;
561 s0 = pool_elt_at_index (sm->per_thread_data[cpu_index].sessions,
564 old_addr0 = ip0->src_address.as_u32;
565 ip0->src_address = s0->out2in.addr;
566 new_addr0 = ip0->src_address.as_u32;
567 vnet_buffer(b0)->sw_if_index[VLIB_TX] = s0->out2in.fib_index;
569 sum0 = ip0->checksum;
570 sum0 = ip_csum_update (sum0, old_addr0, new_addr0,
572 src_address /* changed member */);
573 ip0->checksum = ip_csum_fold (sum0);
575 if (PREDICT_TRUE(proto0 == SNAT_PROTOCOL_TCP))
577 old_port0 = tcp0->ports.src;
578 tcp0->ports.src = s0->out2in.port;
579 new_port0 = tcp0->ports.src;
581 sum0 = tcp0->checksum;
582 sum0 = ip_csum_update (sum0, old_addr0, new_addr0,
584 dst_address /* changed member */);
585 sum0 = ip_csum_update (sum0, old_port0, new_port0,
586 ip4_header_t /* cheat */,
587 length /* changed member */);
588 tcp0->checksum = ip_csum_fold(sum0);
592 old_port0 = udp0->src_port;
593 udp0->src_port = s0->out2in.port;
598 s0->last_heard = now;
600 s0->total_bytes += vlib_buffer_length_in_chain (vm, b0);
601 /* Per-user LRU list maintenance for dynamic translation */
602 if (!snat_is_session_static (s0))
604 clib_dlist_remove (sm->per_thread_data[cpu_index].list_pool,
606 clib_dlist_addtail (sm->per_thread_data[cpu_index].list_pool,
607 s0->per_user_list_head_index,
612 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
613 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
615 snat_in2out_trace_t *t =
616 vlib_add_trace (vm, node, b0, sizeof (*t));
617 t->is_slow_path = is_slow_path;
618 t->sw_if_index = sw_if_index0;
619 t->next_index = next0;
620 t->session_index = ~0;
622 t->session_index = s0 - sm->per_thread_data[cpu_index].sessions;
625 pkts_processed += next0 != SNAT_IN2OUT_NEXT_DROP;
627 ip1 = vlib_buffer_get_current (b1);
628 udp1 = ip4_next_header (ip1);
629 tcp1 = (tcp_header_t *) udp1;
630 icmp1 = (icmp46_header_t *) udp1;
632 sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
633 rx_fib_index1 = vec_elt (sm->ip4_main->fib_index_by_sw_if_index,
637 proto1 = (ip1->protocol == IP_PROTOCOL_UDP)
638 ? SNAT_PROTOCOL_UDP : proto1;
639 proto1 = (ip1->protocol == IP_PROTOCOL_TCP)
640 ? SNAT_PROTOCOL_TCP : proto1;
641 proto1 = (ip1->protocol == IP_PROTOCOL_ICMP)
642 ? SNAT_PROTOCOL_ICMP : proto1;
644 /* Next configured feature, probably ip4-lookup */
647 if (PREDICT_FALSE (proto1 == ~0))
650 if (PREDICT_FALSE (proto1 == SNAT_PROTOCOL_ICMP))
652 next1 = icmp_in2out_slow_path
653 (sm, b1, ip1, icmp1, sw_if_index1, rx_fib_index1, node,
654 next1, now, cpu_index);
660 if (PREDICT_FALSE (proto1 == ~0 || proto1 == SNAT_PROTOCOL_ICMP))
662 next1 = SNAT_IN2OUT_NEXT_SLOW_PATH;
667 key1.addr = ip1->src_address;
668 key1.port = udp1->src_port;
669 key1.protocol = proto1;
670 key1.fib_index = rx_fib_index1;
672 kv1.key = key1.as_u64;
674 if (PREDICT_FALSE(clib_bihash_search_8_8 (&sm->in2out, &kv1, &value1) != 0))
678 ip4_address_t * first_int_addr;
680 if (PREDICT_FALSE(rt->cached_sw_if_index != sw_if_index1))
683 ip4_interface_first_address (sm->ip4_main, sw_if_index1,
684 0 /* just want the address */);
685 rt->cached_sw_if_index = sw_if_index1;
686 rt->cached_ip4_address = first_int_addr->as_u32;
689 /* Don't NAT packet aimed at the intfc address */
690 if (PREDICT_FALSE(ip1->dst_address.as_u32 ==
691 rt->cached_ip4_address))
694 next1 = slow_path (sm, b1, ip1, rx_fib_index1, &key1,
695 &s1, node, next1, cpu_index);
696 if (PREDICT_FALSE (next1 == SNAT_IN2OUT_NEXT_DROP))
701 next1 = SNAT_IN2OUT_NEXT_SLOW_PATH;
706 s1 = pool_elt_at_index (sm->per_thread_data[cpu_index].sessions,
709 old_addr1 = ip1->src_address.as_u32;
710 ip1->src_address = s1->out2in.addr;
711 new_addr1 = ip1->src_address.as_u32;
712 vnet_buffer(b1)->sw_if_index[VLIB_TX] = s1->out2in.fib_index;
714 sum1 = ip1->checksum;
715 sum1 = ip_csum_update (sum1, old_addr1, new_addr1,
717 src_address /* changed member */);
718 ip1->checksum = ip_csum_fold (sum1);
720 if (PREDICT_TRUE(proto1 == SNAT_PROTOCOL_TCP))
722 old_port1 = tcp1->ports.src;
723 tcp1->ports.src = s1->out2in.port;
724 new_port1 = tcp1->ports.src;
726 sum1 = tcp1->checksum;
727 sum1 = ip_csum_update (sum1, old_addr1, new_addr1,
729 dst_address /* changed member */);
730 sum1 = ip_csum_update (sum1, old_port1, new_port1,
731 ip4_header_t /* cheat */,
732 length /* changed member */);
733 tcp1->checksum = ip_csum_fold(sum1);
737 old_port1 = udp1->src_port;
738 udp1->src_port = s1->out2in.port;
743 s1->last_heard = now;
745 s1->total_bytes += vlib_buffer_length_in_chain (vm, b1);
746 /* Per-user LRU list maintenance for dynamic translation */
747 if (!snat_is_session_static (s1))
749 clib_dlist_remove (sm->per_thread_data[cpu_index].list_pool,
751 clib_dlist_addtail (sm->per_thread_data[cpu_index].list_pool,
752 s1->per_user_list_head_index,
757 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
758 && (b1->flags & VLIB_BUFFER_IS_TRACED)))
760 snat_in2out_trace_t *t =
761 vlib_add_trace (vm, node, b1, sizeof (*t));
762 t->sw_if_index = sw_if_index1;
763 t->next_index = next1;
764 t->session_index = ~0;
766 t->session_index = s1 - sm->per_thread_data[cpu_index].sessions;
769 pkts_processed += next1 != SNAT_IN2OUT_NEXT_DROP;
771 /* verify speculative enqueues, maybe switch current next frame */
772 vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
773 to_next, n_left_to_next,
774 bi0, bi1, next0, next1);
777 while (n_left_from > 0 && n_left_to_next > 0)
785 u32 new_addr0, old_addr0;
786 u16 old_port0, new_port0;
789 icmp46_header_t * icmp0;
790 snat_session_key_t key0;
793 snat_session_t * s0 = 0;
794 clib_bihash_kv_8_8_t kv0, value0;
796 /* speculatively enqueue b0 to the current next frame */
804 b0 = vlib_get_buffer (vm, bi0);
805 next0 = SNAT_IN2OUT_NEXT_LOOKUP;
807 ip0 = vlib_buffer_get_current (b0);
808 udp0 = ip4_next_header (ip0);
809 tcp0 = (tcp_header_t *) udp0;
810 icmp0 = (icmp46_header_t *) udp0;
812 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
813 rx_fib_index0 = vec_elt (sm->ip4_main->fib_index_by_sw_if_index,
817 proto0 = (ip0->protocol == IP_PROTOCOL_UDP)
818 ? SNAT_PROTOCOL_UDP : proto0;
819 proto0 = (ip0->protocol == IP_PROTOCOL_TCP)
820 ? SNAT_PROTOCOL_TCP : proto0;
821 proto0 = (ip0->protocol == IP_PROTOCOL_ICMP)
822 ? SNAT_PROTOCOL_ICMP : proto0;
824 /* Next configured feature, probably ip4-lookup */
827 if (PREDICT_FALSE (proto0 == ~0))
830 if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP))
832 next0 = icmp_in2out_slow_path
833 (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node,
834 next0, now, cpu_index);
840 if (PREDICT_FALSE (proto0 == ~0 || proto0 == SNAT_PROTOCOL_ICMP))
842 next0 = SNAT_IN2OUT_NEXT_SLOW_PATH;
847 key0.addr = ip0->src_address;
848 key0.port = udp0->src_port;
849 key0.protocol = proto0;
850 key0.fib_index = rx_fib_index0;
852 kv0.key = key0.as_u64;
854 if (clib_bihash_search_8_8 (&sm->in2out, &kv0, &value0))
858 ip4_address_t * first_int_addr;
860 if (PREDICT_FALSE(rt->cached_sw_if_index != sw_if_index0))
863 ip4_interface_first_address (sm->ip4_main, sw_if_index0,
864 0 /* just want the address */);
865 rt->cached_sw_if_index = sw_if_index0;
866 rt->cached_ip4_address = first_int_addr->as_u32;
869 /* Don't NAT packet aimed at the intfc address */
870 if (PREDICT_FALSE(ip0->dst_address.as_u32 ==
871 rt->cached_ip4_address))
874 next0 = slow_path (sm, b0, ip0, rx_fib_index0, &key0,
875 &s0, node, next0, cpu_index);
876 if (PREDICT_FALSE (next0 == SNAT_IN2OUT_NEXT_DROP))
881 next0 = SNAT_IN2OUT_NEXT_SLOW_PATH;
886 s0 = pool_elt_at_index (sm->per_thread_data[cpu_index].sessions,
889 old_addr0 = ip0->src_address.as_u32;
890 ip0->src_address = s0->out2in.addr;
891 new_addr0 = ip0->src_address.as_u32;
892 vnet_buffer(b0)->sw_if_index[VLIB_TX] = s0->out2in.fib_index;
894 sum0 = ip0->checksum;
895 sum0 = ip_csum_update (sum0, old_addr0, new_addr0,
897 src_address /* changed member */);
898 ip0->checksum = ip_csum_fold (sum0);
900 if (PREDICT_TRUE(proto0 == SNAT_PROTOCOL_TCP))
902 old_port0 = tcp0->ports.src;
903 tcp0->ports.src = s0->out2in.port;
904 new_port0 = tcp0->ports.src;
906 sum0 = tcp0->checksum;
907 sum0 = ip_csum_update (sum0, old_addr0, new_addr0,
909 dst_address /* changed member */);
910 sum0 = ip_csum_update (sum0, old_port0, new_port0,
911 ip4_header_t /* cheat */,
912 length /* changed member */);
913 tcp0->checksum = ip_csum_fold(sum0);
917 old_port0 = udp0->src_port;
918 udp0->src_port = s0->out2in.port;
923 s0->last_heard = now;
925 s0->total_bytes += vlib_buffer_length_in_chain (vm, b0);
926 /* Per-user LRU list maintenance for dynamic translation */
927 if (!snat_is_session_static (s0))
929 clib_dlist_remove (sm->per_thread_data[cpu_index].list_pool,
931 clib_dlist_addtail (sm->per_thread_data[cpu_index].list_pool,
932 s0->per_user_list_head_index,
937 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
938 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
940 snat_in2out_trace_t *t =
941 vlib_add_trace (vm, node, b0, sizeof (*t));
942 t->is_slow_path = is_slow_path;
943 t->sw_if_index = sw_if_index0;
944 t->next_index = next0;
945 t->session_index = ~0;
947 t->session_index = s0 - sm->per_thread_data[cpu_index].sessions;
950 pkts_processed += next0 != SNAT_IN2OUT_NEXT_DROP;
952 /* verify speculative enqueue, maybe switch current next frame */
953 vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
954 to_next, n_left_to_next,
958 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
961 vlib_node_increment_counter (vm, stats_node_index,
962 SNAT_IN2OUT_ERROR_IN2OUT_PACKETS,
964 return frame->n_vectors;
968 snat_in2out_fast_path_fn (vlib_main_t * vm,
969 vlib_node_runtime_t * node,
970 vlib_frame_t * frame)
972 return snat_in2out_node_fn_inline (vm, node, frame, 0 /* is_slow_path */);
975 VLIB_REGISTER_NODE (snat_in2out_node) = {
976 .function = snat_in2out_fast_path_fn,
977 .name = "snat-in2out",
978 .vector_size = sizeof (u32),
979 .format_trace = format_snat_in2out_trace,
980 .type = VLIB_NODE_TYPE_INTERNAL,
982 .n_errors = ARRAY_LEN(snat_in2out_error_strings),
983 .error_strings = snat_in2out_error_strings,
985 .runtime_data_bytes = sizeof (snat_runtime_t),
987 .n_next_nodes = SNAT_IN2OUT_N_NEXT,
989 /* edit / add dispositions here */
991 [SNAT_IN2OUT_NEXT_DROP] = "error-drop",
992 [SNAT_IN2OUT_NEXT_LOOKUP] = "ip4-lookup",
993 [SNAT_IN2OUT_NEXT_SLOW_PATH] = "snat-in2out-slowpath",
997 VLIB_NODE_FUNCTION_MULTIARCH (snat_in2out_node, snat_in2out_fast_path_fn);
1000 snat_in2out_slow_path_fn (vlib_main_t * vm,
1001 vlib_node_runtime_t * node,
1002 vlib_frame_t * frame)
1004 return snat_in2out_node_fn_inline (vm, node, frame, 1 /* is_slow_path */);
1007 VLIB_REGISTER_NODE (snat_in2out_slowpath_node) = {
1008 .function = snat_in2out_slow_path_fn,
1009 .name = "snat-in2out-slowpath",
1010 .vector_size = sizeof (u32),
1011 .format_trace = format_snat_in2out_trace,
1012 .type = VLIB_NODE_TYPE_INTERNAL,
1014 .n_errors = ARRAY_LEN(snat_in2out_error_strings),
1015 .error_strings = snat_in2out_error_strings,
1017 .runtime_data_bytes = sizeof (snat_runtime_t),
1019 .n_next_nodes = SNAT_IN2OUT_N_NEXT,
1021 /* edit / add dispositions here */
1023 [SNAT_IN2OUT_NEXT_DROP] = "error-drop",
1024 [SNAT_IN2OUT_NEXT_LOOKUP] = "ip4-lookup",
1025 [SNAT_IN2OUT_NEXT_SLOW_PATH] = "snat-in2out-slowpath",
1029 VLIB_NODE_FUNCTION_MULTIARCH (snat_in2out_slowpath_node, snat_in2out_slow_path_fn);
1032 snat_in2out_worker_handoff_fn (vlib_main_t * vm,
1033 vlib_node_runtime_t * node,
1034 vlib_frame_t * frame)
1036 snat_main_t *sm = &snat_main;
1037 vlib_thread_main_t *tm = vlib_get_thread_main ();
1038 u32 n_left_from, *from, *to_next = 0;
1039 static __thread vlib_frame_queue_elt_t **handoff_queue_elt_by_worker_index;
1040 static __thread vlib_frame_queue_t **congested_handoff_queue_by_worker_index
1042 vlib_frame_queue_elt_t *hf = 0;
1043 vlib_frame_t *f = 0;
1045 u32 n_left_to_next_worker = 0, *to_next_worker = 0;
1046 u32 next_worker_index = 0;
1047 u32 current_worker_index = ~0;
1048 u32 cpu_index = os_get_cpu_number ();
1050 ASSERT (vec_len (sm->workers));
1052 if (PREDICT_FALSE (handoff_queue_elt_by_worker_index == 0))
1054 vec_validate (handoff_queue_elt_by_worker_index, tm->n_vlib_mains - 1);
1056 vec_validate_init_empty (congested_handoff_queue_by_worker_index,
1057 sm->first_worker_index + sm->num_workers - 1,
1058 (vlib_frame_queue_t *) (~0));
1061 from = vlib_frame_vector_args (frame);
1062 n_left_from = frame->n_vectors;
1064 while (n_left_from > 0)
1071 snat_user_key_t key0;
1072 clib_bihash_kv_8_8_t kv0, value0;
1079 b0 = vlib_get_buffer (vm, bi0);
1081 sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
1082 rx_fib_index0 = ip4_fib_table_get_index_for_sw_if_index(sw_if_index0);
1084 ip0 = vlib_buffer_get_current (b0);
1086 key0.addr = ip0->src_address;
1087 key0.fib_index = rx_fib_index0;
1089 kv0.key = key0.as_u64;
1091 /* Ever heard of of the "user" before? */
1092 if (clib_bihash_search_8_8 (&sm->worker_by_in, &kv0, &value0))
1094 /* No, assign next available worker (RR) */
1095 next_worker_index = sm->first_worker_index +
1096 sm->workers[sm->next_worker++ % vec_len (sm->workers)];
1098 /* add non-traslated packets worker lookup */
1099 kv0.value = next_worker_index;
1100 clib_bihash_add_del_8_8 (&sm->worker_by_in, &kv0, 1);
1103 next_worker_index = value0.value;
1105 if (PREDICT_FALSE (next_worker_index != cpu_index))
1109 if (next_worker_index != current_worker_index)
1112 hf->n_vectors = VLIB_FRAME_SIZE - n_left_to_next_worker;
1114 hf = vlib_get_worker_handoff_queue_elt (sm->fq_in2out_index,
1116 handoff_queue_elt_by_worker_index);
1118 n_left_to_next_worker = VLIB_FRAME_SIZE - hf->n_vectors;
1119 to_next_worker = &hf->buffer_index[hf->n_vectors];
1120 current_worker_index = next_worker_index;
1123 /* enqueue to correct worker thread */
1124 to_next_worker[0] = bi0;
1126 n_left_to_next_worker--;
1128 if (n_left_to_next_worker == 0)
1130 hf->n_vectors = VLIB_FRAME_SIZE;
1131 vlib_put_frame_queue_elt (hf);
1132 current_worker_index = ~0;
1133 handoff_queue_elt_by_worker_index[next_worker_index] = 0;
1140 /* if this is 1st frame */
1143 f = vlib_get_frame_to_node (vm, snat_in2out_node.index);
1144 to_next = vlib_frame_vector_args (f);
1152 if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)
1153 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
1155 snat_in2out_worker_handoff_trace_t *t =
1156 vlib_add_trace (vm, node, b0, sizeof (*t));
1157 t->next_worker_index = next_worker_index;
1158 t->do_handoff = do_handoff;
1163 vlib_put_frame_to_node (vm, snat_in2out_node.index, f);
1166 hf->n_vectors = VLIB_FRAME_SIZE - n_left_to_next_worker;
1168 /* Ship frames to the worker nodes */
1169 for (i = 0; i < vec_len (handoff_queue_elt_by_worker_index); i++)
1171 if (handoff_queue_elt_by_worker_index[i])
1173 hf = handoff_queue_elt_by_worker_index[i];
1175 * It works better to let the handoff node
1176 * rate-adapt, always ship the handoff queue element.
1178 if (1 || hf->n_vectors == hf->last_n_vectors)
1180 vlib_put_frame_queue_elt (hf);
1181 handoff_queue_elt_by_worker_index[i] = 0;
1184 hf->last_n_vectors = hf->n_vectors;
1186 congested_handoff_queue_by_worker_index[i] =
1187 (vlib_frame_queue_t *) (~0);
1190 current_worker_index = ~0;
1191 return frame->n_vectors;
1194 VLIB_REGISTER_NODE (snat_in2out_worker_handoff_node) = {
1195 .function = snat_in2out_worker_handoff_fn,
1196 .name = "snat-in2out-worker-handoff",
1197 .vector_size = sizeof (u32),
1198 .format_trace = format_snat_in2out_worker_handoff_trace,
1199 .type = VLIB_NODE_TYPE_INTERNAL,
1208 VLIB_NODE_FUNCTION_MULTIARCH (snat_in2out_worker_handoff_node, snat_in2out_worker_handoff_fn);
1210 static inline u32 icmp_in2out_static_map (snat_main_t *sm,
1213 icmp46_header_t * icmp0,
1215 vlib_node_runtime_t * node,
1219 snat_session_key_t key0, sm0;
1220 icmp_echo_header_t *echo0;
1221 u32 new_addr0, old_addr0;
1222 u16 old_id0, new_id0;
1224 snat_runtime_t * rt = (snat_runtime_t *)node->runtime_data;
1226 echo0 = (icmp_echo_header_t *)(icmp0+1);
1228 key0.addr = ip0->src_address;
1229 key0.port = echo0->identifier;
1230 key0.fib_index = rx_fib_index0;
1232 if (snat_static_mapping_match(sm, key0, &sm0, 0))
1234 ip4_address_t * first_int_addr;
1236 if (PREDICT_FALSE(rt->cached_sw_if_index != sw_if_index0))
1239 ip4_interface_first_address (sm->ip4_main, sw_if_index0,
1240 0 /* just want the address */);
1241 rt->cached_sw_if_index = sw_if_index0;
1242 rt->cached_ip4_address = first_int_addr->as_u32;
1245 /* Don't NAT packet aimed at the intfc address */
1246 if (PREDICT_FALSE(ip0->dst_address.as_u32 ==
1247 rt->cached_ip4_address))
1250 b0->error = node->errors[SNAT_IN2OUT_ERROR_NO_TRANSLATION];
1251 return SNAT_IN2OUT_NEXT_DROP;
1254 new_addr0 = sm0.addr.as_u32;
1256 vnet_buffer(b0)->sw_if_index[VLIB_TX] = sm0.fib_index;
1257 old_addr0 = ip0->src_address.as_u32;
1258 ip0->src_address.as_u32 = new_addr0;
1260 sum0 = ip0->checksum;
1261 sum0 = ip_csum_update (sum0, old_addr0, new_addr0,
1263 src_address /* changed member */);
1264 ip0->checksum = ip_csum_fold (sum0);
1266 if (PREDICT_FALSE(new_id0 != echo0->identifier))
1268 old_id0 = echo0->identifier;
1269 echo0->identifier = new_id0;
1271 sum0 = icmp0->checksum;
1272 sum0 = ip_csum_update (sum0, old_id0, new_id0, icmp_echo_header_t,
1274 icmp0->checksum = ip_csum_fold (sum0);
1281 snat_in2out_fast_static_map_fn (vlib_main_t * vm,
1282 vlib_node_runtime_t * node,
1283 vlib_frame_t * frame)
1285 u32 n_left_from, * from, * to_next;
1286 snat_in2out_next_t next_index;
1287 u32 pkts_processed = 0;
1288 snat_main_t * sm = &snat_main;
1289 snat_runtime_t * rt = (snat_runtime_t *)node->runtime_data;
1290 u32 stats_node_index;
1292 stats_node_index = snat_in2out_fast_node.index;
1294 from = vlib_frame_vector_args (frame);
1295 n_left_from = frame->n_vectors;
1296 next_index = node->cached_next_index;
1298 while (n_left_from > 0)
1302 vlib_get_next_frame (vm, node, next_index,
1303 to_next, n_left_to_next);
1305 while (n_left_from > 0 && n_left_to_next > 0)
1313 u32 new_addr0, old_addr0;
1314 u16 old_port0, new_port0;
1315 udp_header_t * udp0;
1316 tcp_header_t * tcp0;
1317 icmp46_header_t * icmp0;
1318 snat_session_key_t key0, sm0;
1322 /* speculatively enqueue b0 to the current next frame */
1328 n_left_to_next -= 1;
1330 b0 = vlib_get_buffer (vm, bi0);
1331 next0 = SNAT_IN2OUT_NEXT_LOOKUP;
1333 ip0 = vlib_buffer_get_current (b0);
1334 udp0 = ip4_next_header (ip0);
1335 tcp0 = (tcp_header_t *) udp0;
1336 icmp0 = (icmp46_header_t *) udp0;
1338 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
1339 rx_fib_index0 = ip4_fib_table_get_index_for_sw_if_index(sw_if_index0);
1342 proto0 = (ip0->protocol == IP_PROTOCOL_UDP)
1343 ? SNAT_PROTOCOL_UDP : proto0;
1344 proto0 = (ip0->protocol == IP_PROTOCOL_TCP)
1345 ? SNAT_PROTOCOL_TCP : proto0;
1346 proto0 = (ip0->protocol == IP_PROTOCOL_ICMP)
1347 ? SNAT_PROTOCOL_ICMP : proto0;
1349 if (PREDICT_FALSE (proto0 == ~0))
1352 if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP))
1354 ip4_address_t * first_int_addr;
1356 if (PREDICT_FALSE(rt->cached_sw_if_index != sw_if_index0))
1359 ip4_interface_first_address (sm->ip4_main, sw_if_index0,
1360 0 /* just want the address */);
1361 rt->cached_sw_if_index = sw_if_index0;
1362 rt->cached_ip4_address = first_int_addr->as_u32;
1365 /* Don't NAT packet aimed at the intfc address */
1366 if (PREDICT_FALSE(ip0->dst_address.as_u32 ==
1367 rt->cached_ip4_address))
1370 next0 = icmp_in2out_static_map
1371 (sm, b0, ip0, icmp0, sw_if_index0, node, next0, rx_fib_index0);
1375 key0.addr = ip0->src_address;
1376 key0.port = udp0->src_port;
1377 key0.fib_index = rx_fib_index0;
1379 if (snat_static_mapping_match(sm, key0, &sm0, 0))
1381 b0->error = node->errors[SNAT_IN2OUT_ERROR_NO_TRANSLATION];
1382 next0= SNAT_IN2OUT_NEXT_DROP;
1386 new_addr0 = sm0.addr.as_u32;
1387 new_port0 = sm0.port;
1388 vnet_buffer(b0)->sw_if_index[VLIB_TX] = sm0.fib_index;
1389 old_addr0 = ip0->src_address.as_u32;
1390 ip0->src_address.as_u32 = new_addr0;
1392 sum0 = ip0->checksum;
1393 sum0 = ip_csum_update (sum0, old_addr0, new_addr0,
1395 src_address /* changed member */);
1396 ip0->checksum = ip_csum_fold (sum0);
1398 if (PREDICT_FALSE(new_port0 != udp0->dst_port))
1400 if (PREDICT_TRUE(proto0 == SNAT_PROTOCOL_TCP))
1402 old_port0 = tcp0->ports.src;
1403 tcp0->ports.src = new_port0;
1405 sum0 = tcp0->checksum;
1406 sum0 = ip_csum_update (sum0, old_addr0, new_addr0,
1408 dst_address /* changed member */);
1409 sum0 = ip_csum_update (sum0, old_port0, new_port0,
1410 ip4_header_t /* cheat */,
1411 length /* changed member */);
1412 tcp0->checksum = ip_csum_fold(sum0);
1416 old_port0 = udp0->src_port;
1417 udp0->src_port = new_port0;
1423 if (PREDICT_TRUE(proto0 == SNAT_PROTOCOL_TCP))
1425 sum0 = tcp0->checksum;
1426 sum0 = ip_csum_update (sum0, old_addr0, new_addr0,
1428 dst_address /* changed member */);
1429 tcp0->checksum = ip_csum_fold(sum0);
1434 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
1435 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
1437 snat_in2out_trace_t *t =
1438 vlib_add_trace (vm, node, b0, sizeof (*t));
1439 t->sw_if_index = sw_if_index0;
1440 t->next_index = next0;
1443 pkts_processed += next0 != SNAT_IN2OUT_NEXT_DROP;
1445 /* verify speculative enqueue, maybe switch current next frame */
1446 vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
1447 to_next, n_left_to_next,
1451 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
1454 vlib_node_increment_counter (vm, stats_node_index,
1455 SNAT_IN2OUT_ERROR_IN2OUT_PACKETS,
1457 return frame->n_vectors;
1461 VLIB_REGISTER_NODE (snat_in2out_fast_node) = {
1462 .function = snat_in2out_fast_static_map_fn,
1463 .name = "snat-in2out-fast",
1464 .vector_size = sizeof (u32),
1465 .format_trace = format_snat_in2out_fast_trace,
1466 .type = VLIB_NODE_TYPE_INTERNAL,
1468 .n_errors = ARRAY_LEN(snat_in2out_error_strings),
1469 .error_strings = snat_in2out_error_strings,
1471 .runtime_data_bytes = sizeof (snat_runtime_t),
1473 .n_next_nodes = SNAT_IN2OUT_N_NEXT,
1475 /* edit / add dispositions here */
1477 [SNAT_IN2OUT_NEXT_DROP] = "error-drop",
1478 [SNAT_IN2OUT_NEXT_LOOKUP] = "ip4-lookup",
1479 [SNAT_IN2OUT_NEXT_SLOW_PATH] = "snat-in2out-slowpath",
1483 VLIB_NODE_FUNCTION_MULTIARCH (snat_in2out_fast_node, snat_in2out_fast_static_map_fn);