FD.io VPP  v18.10-34-gcce845e
Vector Packet Processing
nat_inlines.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 /**
16  * @brief The NAT inline functions
17  */
18 
19 #ifndef __included_nat_inlines_h__
20 #define __included_nat_inlines_h__
21 
22 #include <vnet/fib/ip4_fib.h>
23 #include <nat/nat.h>
24 
27 {
28  u32 snat_proto = ~0;
29 
30  snat_proto = (ip_proto == IP_PROTOCOL_UDP) ? SNAT_PROTOCOL_UDP : snat_proto;
31  snat_proto = (ip_proto == IP_PROTOCOL_TCP) ? SNAT_PROTOCOL_TCP : snat_proto;
32  snat_proto =
33  (ip_proto == IP_PROTOCOL_ICMP) ? SNAT_PROTOCOL_ICMP : snat_proto;
34  snat_proto =
35  (ip_proto == IP_PROTOCOL_ICMP6) ? SNAT_PROTOCOL_ICMP : snat_proto;
36 
37  return snat_proto;
38 }
39 
42 {
43  u8 ip_proto = ~0;
44 
45  ip_proto = (snat_proto == SNAT_PROTOCOL_UDP) ? IP_PROTOCOL_UDP : ip_proto;
46  ip_proto = (snat_proto == SNAT_PROTOCOL_TCP) ? IP_PROTOCOL_TCP : ip_proto;
47  ip_proto = (snat_proto == SNAT_PROTOCOL_ICMP) ? IP_PROTOCOL_ICMP : ip_proto;
48 
49  return ip_proto;
50 }
51 
53 icmp_is_error_message (icmp46_header_t * icmp)
54 {
55  switch (icmp->type)
56  {
57  case ICMP4_destination_unreachable:
58  case ICMP4_time_exceeded:
59  case ICMP4_parameter_problem:
60  case ICMP4_source_quench:
61  case ICMP4_redirect:
62  case ICMP4_alternate_host_address:
63  return 1;
64  }
65  return 0;
66 }
67 
70  u32 sw_if_index0, u32 ip4_addr)
71 {
73  ip4_address_t *first_int_addr;
74 
75  if (PREDICT_FALSE (rt->cached_sw_if_index != sw_if_index0))
76  {
77  first_int_addr =
78  ip4_interface_first_address (sm->ip4_main, sw_if_index0,
79  0 /* just want the address */ );
80  rt->cached_sw_if_index = sw_if_index0;
81  if (first_int_addr)
82  rt->cached_ip4_address = first_int_addr->as_u32;
83  else
84  rt->cached_ip4_address = 0;
85  }
86 
87  if (PREDICT_FALSE (ip4_addr == rt->cached_ip4_address))
88  return 1;
89  else
90  return 0;
91 }
92 
95 {
96  if (pool_elts (sm->per_thread_data[thread_index].sessions) >=
97  sm->max_translations)
98  return 1;
99 
100  return 0;
101 }
102 
103 always_inline void
105  vlib_node_runtime_t * node, vlib_error_t * error,
106  u32 next)
107 {
108  u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
109 
110  from = bi_vector;
111  n_left_from = vec_len (bi_vector);
112  next_index = node->cached_next_index;
113  while (n_left_from > 0)
114  {
115  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
116  while (n_left_from > 0 && n_left_to_next > 0)
117  {
118  u32 bi0 = to_next[0] = from[0];
119  from += 1;
120  n_left_from -= 1;
121  to_next += 1;
122  n_left_to_next -= 1;
123  vlib_buffer_t *p0 = vlib_get_buffer (vm, bi0);
124  if (error)
125  p0->error = *error;
126  vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
127  n_left_to_next, bi0, next);
128  }
129  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
130  }
131 }
132 
133 always_inline void
135 {
137  {
138  if (is_static)
139  u->nstaticsessions++;
140  else
141  u->nsessions++;
142  }
143 }
144 
145 always_inline void
147  u32 thread_index)
148 {
150  snat_user_key_t u_key;
152  thread_index);
153 
154  if (u->nstaticsessions == 0 && u->nsessions == 0)
155  {
156  u_key.addr.as_u32 = u->addr.as_u32;
157  u_key.fib_index = u->fib_index;
158  kv.key = u_key.as_u64;
160  pool_put (tsm->users, u);
161  clib_bihash_add_del_8_8 (&tsm->user_hash, &kv, 0);
162  }
163 }
164 
165 always_inline void
166 nat44_delete_session (snat_main_t * sm, snat_session_t * ses,
167  u32 thread_index)
168 {
170  thread_index);
171  clib_bihash_kv_8_8_t kv, value;
172  snat_user_key_t u_key;
173  snat_user_t *u;
174 
175  nat_log_debug ("session deleted %U", format_snat_session, tsm, ses);
176 
177  clib_dlist_remove (tsm->list_pool, ses->per_user_index);
178  pool_put_index (tsm->list_pool, ses->per_user_index);
179  pool_put (tsm->sessions, ses);
180 
181  u_key.addr = ses->in2out.addr;
182  u_key.fib_index = ses->in2out.fib_index;
183  kv.key = u_key.as_u64;
184  if (!clib_bihash_search_8_8 (&tsm->user_hash, &kv, &value))
185  {
186  u = pool_elt_at_index (tsm->users, value.value);
187  if (snat_is_session_static (ses))
188  u->nstaticsessions--;
189  else
190  u->nsessions--;
191 
192  nat44_delete_user_with_no_session (sm, u, thread_index);
193  }
194 }
195 
196 /** \brief Set TCP session state.
197  @return 1 if session was closed, otherwise 0
198 */
199 always_inline int
200 nat44_set_tcp_session_state_i2o (snat_main_t * sm, snat_session_t * ses,
201  tcp_header_t * tcp, u32 thread_index)
202 {
203  if ((ses->state == 0) && (tcp->flags & TCP_FLAG_RST))
204  ses->state = NAT44_SES_RST;
205  if ((ses->state == NAT44_SES_RST) && !(tcp->flags & TCP_FLAG_RST))
206  ses->state = 0;
207  if ((tcp->flags & TCP_FLAG_ACK) && (ses->state & NAT44_SES_I2O_SYN) &&
208  (ses->state & NAT44_SES_O2I_SYN))
209  ses->state = 0;
210  if (tcp->flags & TCP_FLAG_SYN)
211  ses->state |= NAT44_SES_I2O_SYN;
212  if (tcp->flags & TCP_FLAG_FIN)
213  {
214  ses->i2o_fin_seq = clib_net_to_host_u32 (tcp->seq_number);
215  ses->state |= NAT44_SES_I2O_FIN;
216  }
217  if ((tcp->flags & TCP_FLAG_ACK) && (ses->state & NAT44_SES_O2I_FIN))
218  {
219  if (clib_net_to_host_u32 (tcp->ack_number) > ses->o2i_fin_seq)
220  ses->state |= NAT44_SES_O2I_FIN_ACK;
221  }
222  if (nat44_is_ses_closed (ses)
223  && !(ses->flags & SNAT_SESSION_FLAG_OUTPUT_FEATURE))
224  {
225  nat_log_debug ("TCP close connection %U", format_snat_session,
226  &sm->per_thread_data[thread_index], ses);
227  nat_free_session_data (sm, ses, thread_index);
228  nat44_delete_session (sm, ses, thread_index);
229  return 1;
230  }
231  return 0;
232 }
233 
234 always_inline int
235 nat44_set_tcp_session_state_o2i (snat_main_t * sm, snat_session_t * ses,
236  tcp_header_t * tcp, u32 thread_index)
237 {
238  if ((ses->state == 0) && (tcp->flags & TCP_FLAG_RST))
239  ses->state = NAT44_SES_RST;
240  if ((ses->state == NAT44_SES_RST) && !(tcp->flags & TCP_FLAG_RST))
241  ses->state = 0;
242  if ((tcp->flags & TCP_FLAG_ACK) && (ses->state & NAT44_SES_I2O_SYN) &&
243  (ses->state & NAT44_SES_O2I_SYN))
244  ses->state = 0;
245  if (tcp->flags & TCP_FLAG_SYN)
246  ses->state |= NAT44_SES_O2I_SYN;
247  if (tcp->flags & TCP_FLAG_FIN)
248  {
249  ses->o2i_fin_seq = clib_net_to_host_u32 (tcp->seq_number);
250  ses->state |= NAT44_SES_O2I_FIN;
251  }
252  if ((tcp->flags & TCP_FLAG_ACK) && (ses->state & NAT44_SES_I2O_FIN))
253  {
254  if (clib_net_to_host_u32 (tcp->ack_number) > ses->i2o_fin_seq)
255  ses->state |= NAT44_SES_I2O_FIN_ACK;
256  }
257  if (nat44_is_ses_closed (ses))
258  {
259  nat_log_debug ("TCP close connection %U", format_snat_session,
260  &sm->per_thread_data[thread_index], ses);
261  nat_free_session_data (sm, ses, thread_index);
262  nat44_delete_session (sm, ses, thread_index);
263  return 1;
264  }
265  return 0;
266 }
267 
269 nat44_session_get_timeout (snat_main_t * sm, snat_session_t * s)
270 {
271  switch (s->in2out.protocol)
272  {
273  case SNAT_PROTOCOL_ICMP:
274  return sm->icmp_timeout;
275  case SNAT_PROTOCOL_UDP:
276  return sm->udp_timeout;
277  case SNAT_PROTOCOL_TCP:
278  {
279  if (s->state)
280  return sm->tcp_transitory_timeout;
281  else
282  return sm->tcp_established_timeout;
283  }
284  default:
285  return sm->udp_timeout;
286  }
287 
288  return 0;
289 }
290 
291 always_inline void
292 nat44_session_update_counters (snat_session_t * s, f64 now, uword bytes)
293 {
294  s->last_heard = now;
295  s->total_pkts++;
296  s->total_bytes += bytes;
297 }
298 
299 /** \brief Per-user LRU list maintenance */
300 always_inline void
301 nat44_session_update_lru (snat_main_t * sm, snat_session_t * s,
302  u32 thread_index)
303 {
304  clib_dlist_remove (sm->per_thread_data[thread_index].list_pool,
305  s->per_user_index);
306  clib_dlist_addtail (sm->per_thread_data[thread_index].list_pool,
307  s->per_user_list_head_index, s->per_user_index);
308 }
309 
310 always_inline void
312  ip4_address_t * r_addr, u8 proto, u32 fib_index, u16 l_port,
313  u16 r_port)
314 {
315  nat_ed_ses_key_t *key = (nat_ed_ses_key_t *) kv->key;
316 
317  key->l_addr.as_u32 = l_addr->as_u32;
318  key->r_addr.as_u32 = r_addr->as_u32;
319  key->fib_index = fib_index;
320  key->proto = proto;
321  key->l_port = l_port;
322  key->r_port = r_port;
323 
324  kv->value = ~0ULL;
325 }
326 
327 always_inline void
329  u32 fib_index, u16 port)
330 {
331  snat_session_key_t key;
332 
333  key.addr.as_u32 = addr->as_u32;
334  key.port = port;
335  key.protocol = proto;
336  key.fib_index = fib_index;
337 
338  kv->key = key.as_u64;
339  kv->value = ~0ULL;
340 }
341 
342 always_inline void
344 {
345  u8 *data;
346  u8 opt_len, opts_len, kind;
347  u16 mss;
348 
349  if (!(sm->mss_clamping && tcp_syn (tcp)))
350  return;
351 
352  opts_len = (tcp_doff (tcp) << 2) - sizeof (tcp_header_t);
353  data = (u8 *) (tcp + 1);
354  for (; opts_len > 0; opts_len -= opt_len, data += opt_len)
355  {
356  kind = data[0];
357 
358  if (kind == TCP_OPTION_EOL)
359  break;
360  else if (kind == TCP_OPTION_NOOP)
361  {
362  opt_len = 1;
363  continue;
364  }
365  else
366  {
367  if (opts_len < 2)
368  return;
369  opt_len = data[1];
370 
371  if (opt_len < 2 || opt_len > opts_len)
372  return;
373  }
374 
375  if (kind == TCP_OPTION_MSS)
376  {
377  mss = *(u16 *) (data + 2);
378  if (clib_net_to_host_u16 (mss) > sm->mss_clamping)
379  {
380  *sum =
381  ip_csum_update (*sum, mss, sm->mss_value_net, ip4_header_t,
382  length);
383  clib_memcpy (data + 2, &sm->mss_value_net, 2);
384  }
385  return;
386  }
387  }
388 }
389 
390 /**
391  * @brief Check if packet should be translated
392  *
393  * Packets aimed at outside interface and external address with active session
394  * should be translated.
395  *
396  * @param sm NAT main
397  * @param rt NAT runtime data
398  * @param sw_if_index0 index of the inside interface
399  * @param ip0 IPv4 header
400  * @param proto0 NAT protocol
401  * @param rx_fib_index0 RX FIB index
402  *
403  * @returns 0 if packet should be translated otherwise 1
404  */
405 static inline int
407  u32 sw_if_index0, ip4_header_t * ip0, u32 proto0,
408  u32 rx_fib_index0)
409 {
410  if (sm->out2in_dpo)
411  return 0;
412 
414  nat_outside_fib_t *outside_fib;
415  fib_prefix_t pfx = {
417  .fp_len = 32,
418  .fp_addr = {
419  .ip4.as_u32 = ip0->dst_address.as_u32,
420  }
421  ,
422  };
423 
424  /* Don't NAT packet aimed at the intfc address */
425  if (PREDICT_FALSE (is_interface_addr (sm, node, sw_if_index0,
426  ip0->dst_address.as_u32)))
427  return 1;
428 
429  fei = fib_table_lookup (rx_fib_index0, &pfx);
430  if (FIB_NODE_INDEX_INVALID != fei)
431  {
433  if (sw_if_index == ~0)
434  {
435  vec_foreach (outside_fib, sm->outside_fibs)
436  {
437  fei = fib_table_lookup (outside_fib->fib_index, &pfx);
438  if (FIB_NODE_INDEX_INVALID != fei)
439  {
440  sw_if_index = fib_entry_get_resolving_interface (fei);
441  if (sw_if_index != ~0)
442  break;
443  }
444  }
445  }
446  if (sw_if_index == ~0)
447  return 1;
448 
450  pool_foreach (i, sm->interfaces, (
451  {
452  /* NAT packet aimed at outside interface */
453  if ((nat_interface_is_outside (i))
454  && (sw_if_index ==
455  i->sw_if_index)) return 0;}
456  ));
457  }
458 
459  return 1;
460 }
461 
462 #endif /* __included_nat_inlines_h__ */
463 
464 /*
465  * fd.io coding-style-patch-verification: ON
466  *
467  * Local Variables:
468  * eval: (c-set-style "gnu")
469  * End:
470  */
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:212
nat_outside_fib_t * outside_fibs
Definition: nat.h:473
#define snat_is_session_static(s)
Check if SNAT session is created from static mapping.
Definition: nat.h:598
u32 sessions_per_user_list_head_index
Definition: nat.h:233
End of options.
Definition: tcp_packet.h:104
#define NAT44_SES_I2O_FIN
Definition: nat.h:162
u32 icmp_timeout
Definition: nat.h:526
u8 runtime_data[0]
Function dependent node-runtime data.
Definition: node.h:521
static u32 nat44_session_get_timeout(snat_main_t *sm, snat_session_t *s)
Definition: nat_inlines.h:269
#define TCP_FLAG_SYN
Definition: fa_node.h:13
u32 nsessions
Definition: nat.h:234
static_always_inline u8 icmp_is_error_message(icmp46_header_t *icmp)
Definition: nat_inlines.h:53
ip4_address_t * ip4_interface_first_address(ip4_main_t *im, u32 sw_if_index, ip_interface_address_t **result_ia)
Definition: ip4_forward.c:313
static void make_sm_kv(clib_bihash_kv_8_8_t *kv, ip4_address_t *addr, u8 proto, u32 fib_index, u16 port)
Definition: nat_inlines.h:328
#define tcp_doff(_th)
Definition: tcp_packet.h:78
u32 nstaticsessions
Definition: nat.h:235
u16 vlib_error_t
Definition: error.h:44
int i
uword ip_csum_t
Definition: ip_packet.h:181
u32 fib_index
Definition: nat.h:232
#define nat44_is_ses_closed(s)
Check if NAT44 endpoint-dependent TCP session is closed.
Definition: nat.h:652
#define NAT44_SES_O2I_FIN
Definition: nat.h:163
No operation.
Definition: tcp_packet.h:105
dlist_elt_t * list_pool
Definition: nat.h:396
struct _tcp_header tcp_header_t
vhost_vring_addr_t addr
Definition: vhost_user.h:121
u32 proto
Definition: nat.h:69
unsigned char u8
Definition: types.h:56
static int nat44_set_tcp_session_state_o2i(snat_main_t *sm, snat_session_t *ses, tcp_header_t *tcp, u32 thread_index)
Definition: nat_inlines.h:235
u16 l_port
Definition: nat.h:70
double f64
Definition: types.h:142
clib_bihash_8_8_t user_hash
Definition: nat.h:387
u32 cached_sw_if_index
Definition: nat.h:554
static int snat_not_translate_fast(snat_main_t *sm, vlib_node_runtime_t *node, u32 sw_if_index0, ip4_header_t *ip0, u32 proto0, u32 rx_fib_index0)
Check if packet should be translated.
Definition: nat_inlines.h:406
u32 max_translations_per_user
Definition: nat.h:516
Limit MSS.
Definition: tcp_packet.h:106
#define static_always_inline
Definition: clib.h:95
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:443
u16 r_port
Definition: nat.h:71
u32 sw_if_index
Definition: vxlan_gbp.api:39
#define always_inline
Definition: clib.h:94
ip4_address_t dst_address
Definition: ip4_packet.h:169
#define TCP_FLAG_ACK
Definition: fa_node.h:16
ip4_address_t addr
Definition: nat.h:231
#define SNAT_SESSION_FLAG_OUTPUT_FEATURE
Definition: nat.h:178
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Aggregrate type for a prefix.
Definition: fib_types.h:203
ip4_main_t * ip4_main
Definition: nat.h:541
unsigned int u32
Definition: types.h:88
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
Definition: fib_table.c:66
#define NAT44_SES_RST
Definition: nat.h:168
static u8 maximum_sessions_exceeded(snat_main_t *sm, u32 thread_index)
Definition: nat_inlines.h:94
static void nat44_delete_session(snat_main_t *sm, snat_session_t *ses, u32 thread_index)
Definition: nat_inlines.h:166
u32 max_translations
Definition: nat.h:513
static void mss_clamping(snat_main_t *sm, tcp_header_t *tcp, ip_csum_t *sum)
Definition: nat_inlines.h:343
u32 fib_index
Definition: nat.h:69
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:464
void nat_free_session_data(snat_main_t *sm, snat_session_t *s, u32 thread_index)
Free NAT44 session data (lookup keys, external addrres port)
Definition: nat.c:177
u32 fib_index
Definition: nat.h:254
u16 mss_value_net
Definition: nat.h:530
u64 key
the key
Definition: bihash_8_8.h:33
u16 mss_clamping
Definition: nat.h:529
static void clib_dlist_addtail(dlist_elt_t *pool, u32 head_index, u32 new_index)
Definition: dlist.h:43
unsigned short u16
Definition: types.h:57
u16 protocol
Definition: nat.h:54
u8 out2in_dpo
Definition: nat.h:509
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:274
u32 udp_timeout
Definition: nat.h:523
#define PREDICT_FALSE(x)
Definition: clib.h:107
#define TCP_FLAG_FIN
Definition: fa_node.h:12
#define NAT44_SES_O2I_SYN
Definition: nat.h:167
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
Definition: buffer_node.h:218
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
Definition: node_funcs.h:364
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:138
#define TCP_FLAG_RST
Definition: fa_node.h:14
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
Definition: fib_entry.c:1409
u64 value
the value
Definition: bihash_8_8.h:34
snat_user_t * users
Definition: nat.h:390
static void nat44_delete_user_with_no_session(snat_main_t *sm, snat_user_t *u, u32 thread_index)
Definition: nat_inlines.h:146
#define nat_log_debug(...)
Definition: nat.h:693
static u8 snat_proto_to_ip_proto(snat_protocol_t snat_proto)
Definition: nat_inlines.h:41
vlib_main_t * vm
Definition: buffer.c:294
ip4_address_t l_addr
Definition: nat.h:67
#define clib_memcpy(a, b, c)
Definition: string.h:75
static void nat44_session_update_counters(snat_session_t *s, f64 now, uword bytes)
Definition: nat_inlines.h:292
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
8 octet key, 8 octet key value pair
Definition: bihash_8_8.h:31
ip4_address_t addr
Definition: nat.h:52
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
Definition: main.c:455
static void make_ed_kv(clib_bihash_kv_16_8_t *kv, ip4_address_t *l_addr, ip4_address_t *r_addr, u8 proto, u32 fib_index, u16 l_port, u16 r_port)
Definition: nat_inlines.h:311
u32 tcp_transitory_timeout
Definition: nat.h:525
ip4_address_t r_addr
Definition: nat.h:68
static int nat44_set_tcp_session_state_i2o(snat_main_t *sm, snat_session_t *ses, tcp_header_t *tcp, u32 thread_index)
Set TCP session state.
Definition: nat_inlines.h:200
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
Definition: node.h:513
#define pool_put_index(p, i)
Free pool element with given index.
Definition: pool.h:299
#define tcp_syn(_th)
Definition: tcp_packet.h:80
static void nat44_session_update_lru(snat_main_t *sm, snat_session_t *s, u32 thread_index)
Per-user LRU list maintenance.
Definition: nat_inlines.h:301
u64 as_u64
Definition: nat.h:102
ip4_address_t addr
Definition: nat.h:99
static void clib_dlist_remove(dlist_elt_t *pool, u32 index)
Definition: dlist.h:99
#define NAT44_SES_I2O_SYN
Definition: nat.h:166
format_function_t format_snat_session
Definition: nat.h:584
static u32 ip_proto_to_snat_proto(u8 ip_proto)
The NAT inline functions.
Definition: nat_inlines.h:26
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:31
static void user_session_increment(snat_main_t *sm, snat_user_t *u, u8 is_static)
Definition: nat_inlines.h:134
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u64 uword
Definition: types.h:112
snat_main_per_thread_data_t * per_thread_data
Definition: nat.h:443
snat_protocol_t
Definition: nat.h:133
#define ip_csum_update(sum, old, new, type, field)
Definition: ip_packet.h:231
static u8 is_interface_addr(snat_main_t *sm, vlib_node_runtime_t *node, u32 sw_if_index0, u32 ip4_addr)
Definition: nat_inlines.h:69
u32 fib_index
Definition: nat.h:100
#define NAT44_SES_I2O_FIN_ACK
Definition: nat.h:164
#define vec_foreach(var, vec)
Vector iterator.
static void nat_send_all_to_node(vlib_main_t *vm, u32 *bi_vector, vlib_node_runtime_t *node, vlib_error_t *error, u32 next)
Definition: nat_inlines.h:104
#define NAT44_SES_O2I_FIN_ACK
Definition: nat.h:165
snat_session_t * sessions
Definition: nat.h:393
u32 cached_ip4_address
Definition: nat.h:555
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:58
snat_interface_t * interfaces
Definition: nat.h:455
u16 fib_index
Definition: nat.h:54
u32 tcp_established_timeout
Definition: nat.h:524
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:128