FD.io VPP  v21.06-1-gbb7418cf9
Vector Packet Processing
nat44_ei.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 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  * @file nat44_ei.h
17  * NAT44 endpoint independent plugin declarations
18  */
19 #ifndef __included_nat44_ei_h__
20 #define __included_nat44_ei_h__
21 
22 #include <vlib/log.h>
23 #include <vlibapi/api.h>
24 
25 #include <vnet/vnet.h>
26 #include <vnet/ip/ip.h>
27 #include <vnet/ethernet/ethernet.h>
28 #include <vnet/ip/icmp46_packet.h>
29 #include <vnet/api_errno.h>
30 #include <vnet/fib/fib_source.h>
31 
32 #include <vppinfra/dlist.h>
33 #include <vppinfra/error.h>
34 #include <vppinfra/bihash_8_8.h>
35 
36 #include <nat/lib/lib.h>
37 #include <nat/lib/inlines.h>
38 
39 /* default number of worker handoff frame queue elements */
40 #define NAT_FQ_NELTS_DEFAULT 64
41 
42 /* External address and port allocation modes */
43 #define foreach_nat44_ei_addr_and_port_alloc_alg \
44  _ (0, DEFAULT, "default") \
45  _ (1, MAPE, "map-e") \
46  _ (2, RANGE, "port-range")
47 
48 typedef enum
49 {
50 #define _(v, N, s) NAT44_EI_ADDR_AND_PORT_ALLOC_ALG_##N = v,
52 #undef _
54 
55 /* Interface flags */
56 #define NAT44_EI_INTERFACE_FLAG_IS_INSIDE (1 << 0)
57 #define NAT44_EI_INTERFACE_FLAG_IS_OUTSIDE (1 << 1)
58 
59 /* Session flags */
60 #define NAT44_EI_SESSION_FLAG_STATIC_MAPPING (1 << 0)
61 #define NAT44_EI_SESSION_FLAG_UNKNOWN_PROTO (1 << 1)
62 
63 /* Static mapping flags */
64 #define NAT44_EI_STATIC_MAPPING_FLAG_ADDR_ONLY (1 << 0)
65 #define NAT44_EI_STATIC_MAPPING_FLAG_IDENTITY_NAT (1 << 1)
66 
67 typedef struct
68 {
71 #define _(N, i, n, s) \
72  u32 busy_##n##_ports; \
73  u32 *busy_##n##_ports_per_thread; \
74  u32 busy_##n##_port_refcounts[0xffff + 1];
76 #undef _
78 
80 
81 /* NAT address and port allocation function */
83  nat44_ei_address_t *addresses, u32 fib_index, u32 thread_index,
85  u16 port_per_thread, u32 snat_thread_index);
86 
87 typedef struct
88 {
92 
93 typedef struct
94 {
97 
98 typedef struct
99 {
100  union
101  {
102  struct
103  {
106  };
108  };
110 
111 typedef struct
112 {
113  /* maximum number of users */
115  /* maximum number of sessions */
117  /* maximum number of ssessions per user */
119 
120  /* plugin features */
124 
127 
129 
130 typedef struct
131 {
143  u8 *tag;
145 
146 // TODO: cleanup/redo (there is no lb in EI nat)
147 typedef struct
148 {
149  /* backend IP address */
151  /* backend port number */
153  /* probability of the backend to be randomly matched */
156  /* backend FIB table */
160 
161 typedef struct
162 {
163  /* prefered pool address */
165  /* local IP address */
167  /* external IP address */
169  /* local port */
171  /* external port */
173  /* local FIB table */
176  /* protocol */
178  /* worker threads used by backends/local host */
180  /* opaque string tag */
181  u8 *tag;
182  /* backends for load-balancing mode */
184  /* flags */
187 
188 typedef struct
189 {
193 
194 typedef struct
195 {
199 
200 typedef struct
201 {
205 
206 typedef CLIB_PACKED (struct {
207  /* Outside network tuple */
208  struct
209  {
211  u32 fib_index;
212  u16 port;
213  } out2in;
214 
215  /* Inside network tuple */
216  struct
217  {
219  u32 fib_index;
220  u16 port;
221  } in2out;
222 
223  nat_protocol_t nat_proto;
224 
225  /* Flags */
226  u32 flags;
227 
228  /* Per-user translations */
229  u32 per_user_index;
230  u32 per_user_list_head_index;
231 
232  /* head of LRU list in which this session is tracked */
233  u32 lru_head_index;
234  /* index in global LRU list */
235  u32 lru_index;
236  f64 last_lru_update;
237 
238  /* Last heard timer */
239  f64 last_heard;
240 
241  /* Last HA refresh */
242  f64 ha_last_refreshed;
243 
244  /* Counters */
245  u64 total_bytes;
246  u32 total_pkts;
247 
248  /* External host address and port */
249  ip4_address_t ext_host_addr;
250  u16 ext_host_port;
251 
252  /* External host address and port after translation */
253  ip4_address_t ext_host_nat_addr;
254  u16 ext_host_nat_port;
255 
256  /* TCP session state */
257  u8 state;
258  u32 i2o_fin_seq;
259  u32 o2i_fin_seq;
260  u64 tcp_closed_timestamp;
261 
262  /* user index */
263  u32 user_index;
264 }) nat44_ei_session_t;
265 
266 typedef CLIB_PACKED (struct {
268  u32 fib_index;
269  u32 sessions_per_user_list_head_index;
270  u32 nsessions;
271  u32 nstaticsessions;
272 }) nat44_ei_user_t;
273 
274 typedef struct
275 {
276  /* Find-a-user => src address lookup */
277  clib_bihash_8_8_t user_hash;
278 
279  /* User pool */
280  nat44_ei_user_t *users;
281 
282  /* Session pool */
283  nat44_ei_session_t *sessions;
284 
285  /* Pool of doubly-linked list elements */
287 
288  /* LRU session list - head is stale, tail is fresh */
295 
296  /* NAT thread index */
298 
299  /* real thread index */
301 
303 
304 typedef struct
305 {
309 
310 typedef struct
311 {
315 
316 typedef struct nat44_ei_main_s
317 {
321 
326 
328 
329  /* Find a static mapping by local */
330  clib_bihash_8_8_t static_mapping_by_local;
331 
332  /* Find a static mapping by external */
333  clib_bihash_8_8_t static_mapping_by_external;
334 
335  /* Static mapping pool */
337 
338  /* Interface pool */
341 
342  /* Is translation memory size calculated or user defined */
344 
348 
351 
354 
355  /* Thread settings */
360 
361  /* Main lookup tables */
362  clib_bihash_8_8_t out2in;
363  clib_bihash_8_8_t in2out;
364 
365  /* Per thread data */
367 
368  /* Vector of outside addresses */
369  nat44_ei_address_t *addresses;
370 
372  /* Address and port allocation type */
373  nat44_ei_addr_and_port_alloc_alg_t addr_and_port_alloc_alg;
374  /* Port set parameters (MAP-E) */
378  /* Port range parameters */
381 
382  /* vector of fibs */
384 
385  /* vector of outside fibs */
387 
388  /* sw_if_indices whose intfc addresses should be auto-added */
390 
391  /* vector of interface address static mappings to resolve. */
393 
397 
401 
402  /* Randomize port allocation order */
404 
406 
407  /* counters */
411 
412 #define _(x) vlib_simple_counter_main_t x;
413  struct
414  {
415  struct
416  {
417  struct
418  {
420  } in2out;
421 
422  struct
423  {
425  } out2in;
426 
427  } fastpath;
428 
429  struct
430  {
431  struct
432  {
434  } in2out;
435 
436  struct
437  {
439  } out2in;
440  } slowpath;
441 
443  } counters;
444 #undef _
445 
446  /* API message ID base */
448 
449  /* log class */
451  /* logging level */
453 
454  /* convenience */
458 
461 
462  /* pat (port address translation)
463  * dynamic mapping enabled or conneciton tracking */
465 
466  /* number of worker handoff frame queue elements */
468 
469  /* nat44 plugin enabled */
471 
473 
478 
481 
483 
485 
487 
488 /**
489  * @brief Delete specific NAT44 EI user and his sessions
490  *
491  * @param addr IPv4 address
492  * @param fib_index FIB table index
493  */
494 int nat44_ei_user_del (ip4_address_t *addr, u32 fib_index);
495 
496 /**
497  * @brief Delete session for static mapping
498  *
499  * @param addr IPv4 address
500  * @param fib_index FIB table index
501  */
504  nat44_ei_user_key_t u_key, int addr_only, ip4_address_t e_addr, u16 e_port);
505 
507  u8 is_output);
508 
510  u32 rx_fib_index0, u8 is_output);
511 
512 /**
513  * @brief Set address and port assignment algorithm to default/standard
514  */
515 void nat44_ei_set_alloc_default (void);
516 
517 /**
518  * @brief Set address and port assignment algorithm for MAP-E CE
519  *
520  * @param psid Port Set Identifier value
521  * @param psid_offset number of offset bits
522  * @param psid_length length of PSID
523  */
525 
526 /**
527  * @brief Set address and port assignment algorithm for port range
528  *
529  * @param start_port beginning of the port range
530  * @param end_port end of the port range
531  */
533 
534 /**
535  * @brief Add/delete NAT44-EI static mapping
536  *
537  * @param l_addr local IPv4 address
538  * @param e_addr external IPv4 address
539  * @param l_port local port number
540  * @param e_port external port number
541  * @param proto L4 protocol
542  * @param sw_if_index use interface address as external IPv4 address
543  * @param vrf_id local VRF ID
544  * @param addr_only 1 = 1:1NAT, 0 = 1:1NAPT
545  * @param identity_nat identity NAT
546  * @param tag opaque string tag
547  * @param is_add 1 = add, 0 = delete
548  *
549  * @return 0 on success, non-zero value otherwise
550 
551  */
553  ip4_address_t e_addr, u16 l_port,
554  u16 e_port, nat_protocol_t proto,
555  u32 sw_if_index, u32 vrf_id, u8 addr_only,
556  u8 identity_nat, u8 *tag, u8 is_add);
557 
558 /**
559  * @brief Delete NAT44-EI session
560  *
561  * @param addr IPv4 address
562  * @param port L4 port number
563  * @param proto L4 protocol
564  * @param vrf_id VRF ID
565  * @param is_in 1 = inside network address and port pair, 0 = outside
566  *
567  * @return 0 on success, non-zero value otherwise
568  */
570  nat_protocol_t proto, u32 vrf_id, int is_in);
571 
572 /**
573  * @brief Match NAT44-EI static mapping.
574  *
575  * @param key address and port to match
576  * @param addr external/local address of the matched mapping
577  * @param port port of the matched mapping
578  * @param fib_index fib index of the matched mapping
579  * @param by_external if 0 match by local address otherwise match by
580  * external address
581  * @param is_addr_only 1 if matched mapping is address only
582  * @param is_identity_nat 1 if indentity mapping
583  *
584  * @returns 0 if match found otherwise 1.
585  */
586 int nat44_ei_static_mapping_match (ip4_address_t match_addr, u16 match_port,
587  u32 match_fib_index,
588  nat_protocol_t match_protocol,
589  ip4_address_t *mapping_addr,
590  u16 *mapping_port, u32 *mapping_fib_index,
591  u8 by_external, u8 *is_addr_only,
592  u8 *is_identity_nat);
593 
594 /**
595  * @brief Clear all active NAT44-EI sessions.
596  */
598 
600  ip4_address_t *addr,
601  u32 fib_index, u32 thread_index);
602 
604  nat44_ei_user_t *u,
605  u32 thread_index,
606  f64 now);
607 
608 void nat44_ei_free_session_data_v2 (nat44_ei_main_t *nm, nat44_ei_session_t *s,
609  u32 thread_index, u8 is_ha);
610 
611 void nat44_ei_free_outside_address_and_port (nat44_ei_address_t *addresses,
612  u32 thread_index,
613  ip4_address_t *addr, u16 port,
615 
616 int nat44_ei_set_outside_address_and_port (nat44_ei_address_t *addresses,
617  u32 thread_index,
618  ip4_address_t addr, u16 port,
620 
622  u8 delete_sm);
623 
624 void nat44_ei_free_session_data (nat44_ei_main_t *nm, nat44_ei_session_t *s,
625  u32 thread_index, u8 is_ha);
626 
627 int nat44_ei_set_workers (uword *bitmap);
628 
629 void nat44_ei_add_del_address_dpo (ip4_address_t addr, u8 is_add);
630 
632  u32 vrf_id);
633 
634 void nat44_ei_delete_session (nat44_ei_main_t *nm, nat44_ei_session_t *ses,
635  u32 thread_index);
636 
637 int nat44_ei_interface_add_del (u32 sw_if_index, u8 is_inside, int is_del);
638 
640  int is_del);
641 
643  int is_del);
644 
645 /* Call back functions for clib_bihash_add_or_overwrite_stale */
648 
650  nat44_ei_main_t *nm, u32 thread_index,
651  vlib_buffer_t *b0, ip4_header_t *ip0,
652  udp_header_t *udp0, tcp_header_t *tcp0, u32 proto0,
653  int do_trace, u32 *required_thread_index);
654 
656  vlib_buffer_t *b,
657  ip4_header_t *ip);
658 
660  u32 thread_index, ip4_header_t *ip0,
661  icmp46_header_t *icmp0,
662  u32 *required_thread_index);
663 
665 
666 #define nat44_ei_is_session_static(sp) \
667  (sp->flags & NAT44_EI_SESSION_FLAG_STATIC_MAPPING)
668 #define nat44_ei_is_unk_proto_session(sp) \
669  (sp->flags & NAT44_EI_SESSION_FLAG_UNKNOWN_PROTO)
670 
671 #define nat44_ei_interface_is_inside(ip) \
672  (ip->flags & NAT44_EI_INTERFACE_FLAG_IS_INSIDE)
673 #define nat44_ei_interface_is_outside(ip) \
674  (ip->flags & NAT44_EI_INTERFACE_FLAG_IS_OUTSIDE)
675 
676 #define nat44_ei_is_addr_only_static_mapping(mp) \
677  (mp->flags & NAT44_EI_STATIC_MAPPING_FLAG_ADDR_ONLY)
678 #define nat44_ei_is_identity_static_mapping(mp) \
679  (mp->flags & NAT44_EI_STATIC_MAPPING_FLAG_IDENTITY_NAT)
680 
681 /* logging */
682 #define nat44_ei_log_err(...) \
683  vlib_log (VLIB_LOG_LEVEL_ERR, nat44_ei_main.log_class, __VA_ARGS__)
684 #define nat44_ei_log_warn(...) \
685  vlib_log (VLIB_LOG_LEVEL_WARNING, nat44_ei_main.log_class, __VA_ARGS__)
686 #define nat44_ei_log_notice(...) \
687  vlib_log (VLIB_LOG_LEVEL_NOTICE, nat44_ei_main.log_class, __VA_ARGS__)
688 #define nat44_ei_log_info(...) \
689  vlib_log (VLIB_LOG_LEVEL_INFO, nat44_ei_main.log_class, __VA_ARGS__)
690 #define nat44_ei_log_debug(...) \
691  vlib_log (VLIB_LOG_LEVEL_DEBUG, nat44_ei_main.log_class, __VA_ARGS__)
692 
693 #endif /* __included_nat44_ei_h__ */
694 /*
695  * fd.io coding-style-patch-verification: ON
696  *
697  * Local Variables:
698  * eval: (c-set-style "gnu")
699  * End:
700  */
enum fib_source_t_ fib_source_t
The different sources that can create a route.
ip4_address_t addr
Definition: nat44_ei.h:69
int nat44_o2i_is_idle_session_cb(clib_bihash_kv_8_8_t *kv, void *arg)
nat44_ei_main_t nat44_ei_main
Definition: nat44_ei.c:40
u16 port_per_thread
Definition: nat44_ei.h:359
struct nat44_ei_main_s::@81::@82 fastpath
u32 fq_out2in_index
Definition: nat44_ei.h:400
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
nat44_ei_user_t * users
Definition: nat44_ei.h:280
nat44_ei_config_t rconfig
Definition: nat44_ei.h:472
u32 fq_in2out_output_index
Definition: nat44_ei.h:399
nat44_ei_interface_t * interfaces
Definition: nat44_ei.h:339
u32 thread_index
int nat44_ei_hairpinning(vlib_main_t *vm, vlib_node_runtime_t *node, nat44_ei_main_t *nm, u32 thread_index, vlib_buffer_t *b0, ip4_header_t *ip0, udp_header_t *udp0, tcp_header_t *tcp0, u32 proto0, int do_trace, u32 *required_thread_index)
unsigned long u64
Definition: types.h:89
vl_api_ip_port_and_mask_t dst_port
Definition: flow_types.api:92
u32 vrf_id
Definition: nat44_ed.api:1053
vl_api_ip_proto_t protocol
Definition: lb_types.api:72
nat44_ei_lb_addr_port_t * locals
Definition: nat44_ei.h:183
int() nat44_ei_alloc_out_addr_and_port_function_t(nat44_ei_address_t *addresses, u32 fib_index, u32 thread_index, nat_protocol_t proto, ip4_address_t s_addr, ip4_address_t *addr, u16 *port, u16 port_per_thread, u32 snat_thread_index)
Definition: nat44_ei.h:82
u32 outside_fib_index
Definition: nat44_ei.h:353
void nat44_ei_set_alloc_range(u16 start_port, u16 end_port)
Set address and port assignment algorithm for port range.
Definition: nat44_ei.c:1706
nat44_ei_session_t * sessions
Definition: nat44_ei.h:283
int nat44_ei_interface_add_del(u32 sw_if_index, u8 is_inside, int is_del)
Definition: nat44_ei.c:496
nat_protocol_t
Definition: lib.h:63
struct nat44_ei_main_s nat44_ei_main_t
NAT port/address allocation lib.
u32 out2in_node_index
Definition: nat44_ei.h:395
struct _tcp_header tcp_header_t
clib_bihash_8_8_t static_mapping_by_external
Definition: nat44_ei.h:333
vhost_vring_addr_t addr
Definition: vhost_user.h:130
nat44_ei_fib_t * fibs
Definition: nat44_ei.h:383
unsigned char u8
Definition: types.h:56
vlib_buffer_t ** b
nat44_ei_static_mapping_t * static_mappings
Definition: nat44_ei.h:336
double f64
Definition: types.h:142
unsigned int u32
Definition: types.h:88
fib_source_t fib_src_hi
Definition: nat44_ei.h:459
nat44_ei_addr_and_port_alloc_alg_t
Definition: nat44_ei.h:48
int nat44_ei_set_outside_address_and_port(nat44_ei_address_t *addresses, u32 thread_index, ip4_address_t addr, u16 port, nat_protocol_t protocol)
Definition: nat44_ei.c:983
int nat44_ei_user_del(ip4_address_t *addr, u32 fib_index)
Delete specific NAT44 EI user and his sessions.
Definition: nat44_ei.c:1314
u32 vlib_log_class_t
Definition: vlib.h:52
nat44_ei_main_per_thread_data_t * tnm
nat44_ei_address_t * addresses
Definition: nat44_ei.h:369
int nat44_ei_del_address(nat44_ei_main_t *nm, ip4_address_t addr, u8 delete_sm)
Definition: nat44_ei.c:2708
int nat44_ei_interface_add_del_output_feature(u32 sw_if_index, u8 is_inside, int is_del)
Definition: nat44_ei.c:747
ip4_address_t addr
Definition: nat44_ei.h:150
int nat44_ei_set_workers(uword *bitmap)
Definition: nat44_ei.c:252
vlib_simple_counter_main_t hairpinning
Definition: nat44_ei.h:442
u32 nat44_ei_icmp_hairpinning(nat44_ei_main_t *nm, vlib_buffer_t *b0, u32 thread_index, ip4_header_t *ip0, icmp46_header_t *icmp0, u32 *required_thread_index)
u32 in2out_node_index
Definition: nat44_ei.h:394
u32 hairpin_dst_fq_index
Definition: nat44_ei.h:477
struct nat44_ei_main_s::@81::@83 slowpath
A collection of simple counters.
Definition: counter.h:57
struct nat44_ei_main_s::@81 counters
nat44_ei_user_t * nat44_ei_user_get_or_create(nat44_ei_main_t *nm, ip4_address_t *addr, u32 fib_index, u32 thread_index)
Definition: nat44_ei.c:1121
void nat44_ei_free_session_data(nat44_ei_main_t *nm, nat44_ei_session_t *s, u32 thread_index, u8 is_ha)
Definition: nat44_ei.c:1252
u32 inside_fib_index
Definition: nat44_ei.h:350
u32 max_users_per_thread
Definition: nat44_ei.h:345
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
nat44_ei_static_map_resolve_t * to_resolve
Definition: nat44_ei.h:392
u32 nat44_ei_get_in2out_worker_index(ip4_header_t *ip0, u32 rx_fib_index0, u8 is_output)
Definition: nat44_ei.c:1408
vl_api_ip_proto_t proto
Definition: acl_types.api:51
nat44_ei_session_t * nat44_ei_session_alloc_or_recycle(nat44_ei_main_t *nm, nat44_ei_user_t *u, u32 thread_index, f64 now)
Definition: nat44_ei.c:1180
nat44_ei_interface_t * output_feature_interfaces
Definition: nat44_ei.h:340
unsigned short u16
Definition: types.h:57
u8 static_mapping_only
Definition: nat44_ei.h:324
clib_error_t * nat44_ei_api_hookup(vlib_main_t *vm)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
u32 max_translations_per_user
Definition: nat44_ei.h:347
int nat44_ei_add_address(nat44_ei_main_t *nm, ip4_address_t *addr, u32 vrf_id)
Definition: nat44_ei.c:2575
u32 frame_queue_nelts
Definition: nat44_ei.h:467
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:228
clib_bihash_8_8_t static_mapping_by_local
Definition: nat44_ei.h:330
u32 * auto_add_sw_if_indices
Definition: nat44_ei.h:389
int nat44_ei_add_del_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr, u16 l_port, u16 e_port, nat_protocol_t proto, u32 sw_if_index, u32 vrf_id, u8 addr_only, u8 identity_nat, u8 *tag, u8 is_add)
Add/delete NAT44-EI static mapping.
Definition: nat44_ei.c:1853
vnet_main_t * vnet_main
Definition: nat44_ei.h:479
u32 outside_vrf_id
Definition: nat44_ei.h:352
nat44_ei_main_per_thread_data_t * per_thread_data
Definition: nat44_ei.h:366
svmdb_client_t * c
int nat44_i2o_is_idle_session_cb(clib_bihash_kv_8_8_t *kv, void *arg)
void nat44_ei_static_mapping_del_sessions(nat44_ei_main_t *nm, nat44_ei_main_per_thread_data_t *tnm, nat44_ei_user_key_t u_key, int addr_only, ip4_address_t e_addr, u16 e_port)
Delete session for static mapping.
Definition: nat44_ei.c:1356
u8 static_mapping_connection_tracking
Definition: nat44_ei.h:325
u32 first_worker_index
Definition: nat44_ei.h:357
int nat44_ei_del_session(nat44_ei_main_t *nm, ip4_address_t *addr, u16 port, nat_protocol_t proto, u32 vrf_id, int is_in)
Delete NAT44-EI session.
Definition: nat44_ei.c:1785
nat_protocol_t proto
Definition: nat44_ei.h:177
u32 translation_buckets
Definition: nat44_ei.h:319
int nat44_ei_plugin_enable(nat44_ei_config_t c)
Definition: nat44_ei.c:419
ip4_address_t addr
Definition: nat44_ei.h:104
u32 in2out_hairpinning_finish_interface_output_node_fq_index
Definition: nat44_ei.h:475
8 octet key, 8 octet key value pair
Definition: bihash_8_8.h:41
fib_source_t fib_src_low
Definition: nat44_ei.h:460
int nat44_ei_set_frame_queue_nelts(u32 frame_queue_nelts)
Definition: nat44_ei.c:2874
u32 nat44_ei_get_out2in_worker_index(vlib_buffer_t *b, ip4_header_t *ip0, u32 rx_fib_index0, u8 is_output)
Definition: nat44_ei.c:1428
u32 hairpinning_fq_index
Definition: nat44_ei.h:476
nat_timeouts_t timeouts
Definition: nat44_ei.h:405
u32 in2out_hairpinning_finish_ip4_lookup_node_fq_index
Definition: nat44_ei.h:474
vlib_simple_counter_main_t user_limit_reached
Definition: nat44_ei.h:410
void nat44_ei_free_outside_address_and_port(nat44_ei_address_t *addresses, u32 thread_index, ip4_address_t *addr, u16 port, nat_protocol_t protocol)
Definition: nat44_ei.c:1043
ip4_main_t * ip4_main
Definition: nat44_ei.h:456
clib_bihash_8_8_t out2in
Definition: nat44_ei.h:362
u32 fq_in2out_index
Definition: nat44_ei.h:398
IPv4 main type.
Definition: ip4.h:107
ip4_address_t external_addr
Definition: nat44_ei.h:168
ip4_address_t pool_addr
Definition: nat44_ei.h:164
u8 translation_memory_size_set
Definition: nat44_ei.h:343
ip_lookup_main_t * ip4_lookup_main
Definition: nat44_ei.h:457
vlib_simple_counter_main_t total_sessions
Definition: nat44_ei.h:409
void nat44_ei_set_alloc_mape(u16 psid, u16 psid_offset, u16 psid_length)
Set address and port assignment algorithm for MAP-E CE.
Definition: nat44_ei.c:1717
vlib_log_class_t log_class
Definition: nat44_ei.h:450
vl_api_address_t ip
Definition: l2.api:558
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
VLIB buffer representation.
Definition: buffer.h:111
nat44_ei_outside_fib_t * outside_fibs
Definition: nat44_ei.h:386
u64 uword
Definition: types.h:112
api_main_t * api_main
Definition: nat44_ei.h:455
u16 port
Definition: lb_types.api:73
void nat44_ei_sessions_clear()
Clear all active NAT44-EI sessions.
Definition: nat44_ei.c:2478
u32 in2out_output_node_index
Definition: nat44_ei.h:396
ip4_address_t local_addr
Definition: nat44_ei.h:166
nat44_ei_main_t * nm
vl_api_dhcp_client_state_t state
Definition: dhcp.api:201
void nat44_ei_add_del_address_dpo(ip4_address_t addr, u8 is_add)
Definition: nat44_ei.c:1019
clib_bihash_8_8_t in2out
Definition: nat44_ei.h:363
f64 now
#define foreach_nat44_ei_addr_and_port_alloc_alg
Definition: nat44_ei.h:43
int nat44_ei_add_interface_address(nat44_ei_main_t *nm, u32 sw_if_index, int is_del)
Definition: nat44_ei.c:2632
void nat44_ei_delete_session(nat44_ei_main_t *nm, nat44_ei_session_t *ses, u32 thread_index)
Definition: nat44_ei.c:1753
nat44_ei_alloc_out_addr_and_port_function_t * alloc_addr_and_port
Definition: nat44_ei.h:371
void nat44_ei_free_session_data_v2(nat44_ei_main_t *nm, nat44_ei_session_t *s, u32 thread_index, u8 is_ha)
Definition: nat44_ei.c:1079
void nat44_ei_hairpinning_sm_unknown_proto(nat44_ei_main_t *nm, vlib_buffer_t *b, ip4_header_t *ip)
nat44_ei_addr_and_port_alloc_alg_t addr_and_port_alloc_alg
Definition: nat44_ei.h:373
void nat44_ei_set_alloc_default(void)
Set address and port assignment algorithm to default/standard.
Definition: nat44_ei.c:1697
u32 max_translations_per_thread
Definition: nat44_ei.h:346
u8 forwarding_enabled
Definition: nat44_ei.h:323
typedef CLIB_PACKED(struct { struct { ip4_address_t addr;u32 fib_index;u16 port;} out2in;struct { ip4_address_t addr;u32 fib_index;u16 port;} in2out;nat_protocol_t nat_proto;u32 flags;u32 per_user_index;u32 per_user_list_head_index;u32 lru_head_index;u32 lru_index;f64 last_lru_update;f64 last_heard;f64 ha_last_refreshed;u64 total_bytes;u32 total_pkts;ip4_address_t ext_host_addr;u16 ext_host_port;ip4_address_t ext_host_nat_addr;u16 ext_host_nat_port;u8 state;u32 i2o_fin_seq;u32 o2i_fin_seq;u64 tcp_closed_timestamp;u32 user_index;}) nat44_ei_session_t
clib_bihash_8_8_t user_hash
Definition: nat44_ei.h:277
int nat44_ei_plugin_disable()
Definition: nat44_ei.c:920
int nat44_ei_static_mapping_match(ip4_address_t match_addr, u16 match_port, u32 match_fib_index, nat_protocol_t match_protocol, ip4_address_t *mapping_addr, u16 *mapping_port, u32 *mapping_fib_index, u8 by_external, u8 *is_addr_only, u8 *is_identity_nat)
Match NAT44-EI static mapping.
Definition: nat44_ei.c:2253
vlib_simple_counter_main_t total_users
Definition: nat44_ei.h:408