22 #include <vpp/app/version.h> 32 .arc_name =
"ip6-unicast",
33 .node_name =
"nat64-in2out",
38 .arc_name =
"ip4-unicast",
39 .node_name =
"nat64-out2in",
44 .arc_name =
"ip6-unicast",
45 .node_name =
"nat64-in2out-handoff",
50 .arc_name =
"ip4-unicast",
51 .node_name =
"nat64-out2in-handoff",
56 .version = VPP_BUILD_VER,
57 .description =
"NAT64",
60 0x00, 0x64, 0xff, 0x9b,
61 0x00, 0x00, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x00,
63 0x00, 0x00, 0x00, 0x00
67 #define nat_elog_str(_str) \ 70 ELOG_TYPE_DECLARE (e) = \ 72 .format = "nat-msg " _str, \ 75 ELOG_DATA (&vlib_global_main.elog_main, e); \ 83 u32 if_address_index,
u32 is_delete)
123 #ifdef clib_crc32c_uses_intrinsics 124 hash = clib_crc32c ((
u8 *) addr->as_u32, 16);
126 u64 tmp = addr->as_u64[0] ^ addr->as_u64[1];
131 next_worker_index += nm->
workers[hash & (_vec_len (nm->
workers) - 1)];
135 return next_worker_index;
154 ip46_address_t daddr;
155 nat64_db_bib_entry_t *bibe;
165 return (
u32) (db - nm->
db);
174 icmp46_header_t *
icmp = (icmp46_header_t *) udp;
177 (
vnet_buffer (b)->ip.reass.icmp_type_or_tcp_flags))
187 case NAT_PROTOCOL_ICMP:
188 icmp = (icmp46_header_t *) l4_header;
192 case NAT_PROTOCOL_UDP:
193 case NAT_PROTOCOL_TCP:
203 port = clib_net_to_host_u16 (port);
301 nm->counters.in2out.x.name = #x; \ 302 nm->counters.in2out.x.stat_segment_name = "/nat64/in2out/" #x; \ 303 nm->counters.out2in.x.name = #x; \ 304 nm->counters.out2in.x.stat_segment_name = "/nat64/out2in/" #x; 387 return VNET_API_ERROR_VALUE_EXIST;
396 #define _(N, id, n, s) \ 397 clib_memset (a->busy_##n##_port_refcounts, 0, sizeof(a->busy_##n##_port_refcounts)); \ 398 a->busy_##n##_ports = 0; \ 399 vec_validate_init_empty (a->busy_##n##_ports_per_thread, tm->n_vlib_mains - 1, 0); 406 return VNET_API_ERROR_NO_SUCH_ENTRY;
469 return VNET_API_ERROR_VALUE_EXIST;
475 first_int_addr, ~0, 0);
483 return VNET_API_ERROR_NO_SUCH_ENTRY;
491 first_int_addr, ~0, 1);
500 vlib_validate_simple_counter (&nm->counters.in2out.x, sw_if_index); \ 501 vlib_zero_simple_counter (&nm->counters.in2out.x, sw_if_index); \ 502 vlib_validate_simple_counter (&nm->counters.out2in.x, sw_if_index); \ 503 vlib_zero_simple_counter (&nm->counters.out2in.x, sw_if_index); 517 .ip4.as_u32 = addr->
as_u32,
544 const char *feature_name, *arc_name;
552 if (i->sw_if_index == sw_if_index)
567 interface->flags = 0;
584 return VNET_API_ERROR_NO_SUCH_ENTRY;
608 is_inside ?
"nat64-in2out-handoff" :
"nat64-out2in-handoff";
617 feature_name = is_inside ?
"nat64-in2out" :
"nat64-out2in";
619 arc_name = is_inside ?
"ip6-unicast" :
"ip4-unicast";
663 if (r >= min && r <= max)
666 return min + (rwide % (max - min + 1));
676 u16 port_per_thread,
u32 nat_thread_index)
682 for (i = 0; i <
vec_len (addresses); i++)
687 #define _(N, j, n, s) \ 688 case NAT_PROTOCOL_##N: \ 689 if (a->busy_##n##_ports_per_thread[thread_index] < port_per_thread) \ 691 if (a->fib_index == fib_index) \ 695 portnum = (port_per_thread * \ 696 nat_thread_index) + \ 697 nat64_random_port(0, port_per_thread - 1) + 1024; \ 698 if (a->busy_##n##_port_refcounts[portnum]) \ 700 --a->busy_##n##_port_refcounts[portnum]; \ 701 a->busy_##n##_ports_per_thread[thread_index]++; \ 702 a->busy_##n##_ports++; \ 704 *port = clib_host_to_net_u16(portnum); \ 708 else if (a->fib_index == ~0) \ 727 #define _(N, j, n, s) \ 728 case NAT_PROTOCOL_##N: \ 731 portnum = (port_per_thread * \ 732 nat_thread_index) + \ 733 nat64_random_port(0, port_per_thread - 1) + 1024; \ 734 if (a->busy_##n##_port_refcounts[portnum]) \ 736 ++a->busy_##n##_port_refcounts[portnum]; \ 737 a->busy_##n##_ports_per_thread[thread_index]++; \ 738 a->busy_##n##_ports++; \ 740 *port = clib_host_to_net_u16(portnum); \ 762 u32 worker_index = 0;
781 u32 thread_index = db - nm->
db;
783 u16 port_host_byte_order = clib_net_to_host_u16 (port);
794 #define _(N, j, n, s) \ 795 case NAT_PROTOCOL_##N: \ 796 ASSERT (a->busy_##n##_port_refcounts[port_host_byte_order] >= 1); \ 797 --a->busy_##n##_port_refcounts[port_host_byte_order]; \ 798 a->busy_##n##_ports--; \ 799 a->busy_##n##_ports_per_thread[thread_index]--; \ 822 nat64_db_bib_entry_t *bibe;
839 static_bib->
proto, 1);
845 addr.as_u64[0] = static_bib->
in_addr.as_u64[0];
846 addr.as_u64[1] = static_bib->
in_addr.as_u64[1];
860 static_bib->
done = 1;
873 .state = VLIB_NODE_STATE_INTERRUPT,
874 .name =
"nat64-static-bib-worker",
884 nat64_db_bib_entry_t *bibe;
891 u32 thread_index = 0;
900 db = &nm->
db[thread_index];
905 addr.as_u64[0] = in_addr->as_u64[0];
906 addr.as_u64[1] = in_addr->as_u64[1];
909 proto, fib_index, 1);
914 return VNET_API_ERROR_VALUE_EXIST;
920 return VNET_API_ERROR_INVALID_VALUE_2;
930 #define _(N, j, n, s) \ 931 case NAT_PROTOCOL_##N: \ 932 if (a->busy_##n##_port_refcounts[out_port]) \ 933 return VNET_API_ERROR_INVALID_VALUE; \ 934 ++a->busy_##n##_port_refcounts[out_port]; \ 935 if (out_port > 1024) \ 937 a->busy_##n##_ports++; \ 938 a->busy_##n##_ports_per_thread[thread_index]++; \ 945 addr.ip4.as_u32 = out_addr->
as_u32;
947 return VNET_API_ERROR_INVALID_VALUE;
955 clib_host_to_net_u16 (in_port),
956 clib_host_to_net_u16 (out_port),
957 fib_index, proto, 1);
959 return VNET_API_ERROR_UNSPECIFIED;
968 return VNET_API_ERROR_NO_SUCH_ENTRY;
983 if (static_bib->
done)
991 static_bib->
in_addr.as_u64[0] = in_addr->as_u64[0];
992 static_bib->
in_addr.as_u64[1] = in_addr->as_u64[1];
993 static_bib->
in_port = clib_host_to_net_u16 (in_port);
995 static_bib->
out_port = clib_host_to_net_u16 (out_port);
998 static_bib->
is_add = is_add;
1000 static_bib->
done = 0;
1006 return VNET_API_ERROR_UNSPECIFIED;
1107 case NAT_PROTOCOL_ICMP:
1110 case NAT_PROTOCOL_TCP:
1112 switch (ste->tcp_state)
1114 case NAT64_TCP_STATE_V4_INIT:
1115 case NAT64_TCP_STATE_V6_INIT:
1116 case NAT64_TCP_STATE_V4_FIN_RCV:
1117 case NAT64_TCP_STATE_V6_FIN_RCV:
1118 case NAT64_TCP_STATE_V6_FIN_V4_FIN_RCV:
1119 case NAT64_TCP_STATE_TRANS:
1122 case NAT64_TCP_STATE_ESTABLISHED:
1129 case NAT_PROTOCOL_UDP:
1142 switch (ste->tcp_state)
1144 case NAT64_TCP_STATE_CLOSED:
1149 ste->tcp_state = NAT64_TCP_STATE_V6_INIT;
1151 ste->tcp_state = NAT64_TCP_STATE_V4_INIT;
1155 case NAT64_TCP_STATE_V4_INIT:
1158 ste->tcp_state = NAT64_TCP_STATE_ESTABLISHED;
1161 case NAT64_TCP_STATE_V6_INIT:
1164 ste->tcp_state = NAT64_TCP_STATE_ESTABLISHED;
1167 case NAT64_TCP_STATE_ESTABLISHED:
1172 ste->tcp_state = NAT64_TCP_STATE_V6_FIN_RCV;
1174 ste->tcp_state = NAT64_TCP_STATE_V4_FIN_RCV;
1178 ste->tcp_state = NAT64_TCP_STATE_TRANS;
1182 case NAT64_TCP_STATE_V4_FIN_RCV:
1185 ste->tcp_state = NAT64_TCP_STATE_V6_FIN_V4_FIN_RCV;
1188 case NAT64_TCP_STATE_V6_FIN_RCV:
1191 ste->tcp_state = NAT64_TCP_STATE_V6_FIN_V4_FIN_RCV;
1194 case NAT64_TCP_STATE_TRANS:
1197 ste->tcp_state = NAT64_TCP_STATE_ESTABLISHED;
1213 if (plen != 32 && plen != 40 && plen != 48 && plen != 56 && plen != 64
1215 return VNET_API_ERROR_INVALID_VALUE;
1238 p->
prefix.as_u64[0] = prefix->as_u64[0];
1239 p->
prefix.as_u64[1] = prefix->as_u64[1];
1245 return VNET_API_ERROR_NO_SUCH_ENTRY;
1299 ip6->as_u32[1] = ip4->
as_u32;
1302 ip6->as_u8[5] = ip4->
as_u8[0];
1303 ip6->as_u8[6] = ip4->
as_u8[1];
1304 ip6->as_u8[7] = ip4->
as_u8[2];
1305 ip6->as_u8[9] = ip4->
as_u8[3];
1308 ip6->as_u8[6] = ip4->
as_u8[0];
1309 ip6->as_u8[7] = ip4->
as_u8[1];
1310 ip6->as_u8[9] = ip4->
as_u8[2];
1311 ip6->as_u8[10] = ip4->
as_u8[3];
1314 ip6->as_u8[7] = ip4->
as_u8[0];
1315 ip6->as_u8[9] = ip4->
as_u8[1];
1316 ip6->as_u8[10] = ip4->
as_u8[2];
1317 ip6->as_u8[11] = ip4->
as_u8[3];
1320 ip6->as_u8[9] = ip4->
as_u8[0];
1321 ip6->as_u8[10] = ip4->
as_u8[1];
1322 ip6->as_u8[11] = ip4->
as_u8[2];
1323 ip6->as_u8[12] = ip4->
as_u8[3];
1326 ip6->as_u32[3] = ip4->
as_u32;
1336 ip6->as_u32[3] = ip4->
as_u32;
1372 ip4->
as_u32 = ip6->as_u32[1];
1375 ip4->
as_u8[0] = ip6->as_u8[5];
1376 ip4->
as_u8[1] = ip6->as_u8[6];
1377 ip4->
as_u8[2] = ip6->as_u8[7];
1378 ip4->
as_u8[3] = ip6->as_u8[9];
1381 ip4->
as_u8[0] = ip6->as_u8[6];
1382 ip4->
as_u8[1] = ip6->as_u8[7];
1383 ip4->
as_u8[2] = ip6->as_u8[9];
1384 ip4->
as_u8[3] = ip6->as_u8[10];
1387 ip4->
as_u8[0] = ip6->as_u8[7];
1388 ip4->
as_u8[1] = ip6->as_u8[9];
1389 ip4->
as_u8[2] = ip6->as_u8[10];
1390 ip4->
as_u8[3] = ip6->as_u8[11];
1393 ip4->
as_u8[0] = ip6->as_u8[9];
1394 ip4->
as_u8[1] = ip6->as_u8[10];
1395 ip4->
as_u8[2] = ip6->as_u8[11];
1396 ip4->
as_u8[3] = ip6->as_u8[12];
1399 ip4->
as_u32 = ip6->as_u32[3];
1423 db = &nm->
db[thread_index];
1438 .state = VLIB_NODE_STATE_INTERRUPT,
1439 .name =
"nat64-expire-worker-walk",
1453 uword event_type, *event_data = 0;
1491 for (i = 0; i <
vec_len (worker_vms); i++)
1493 worker_vm = worker_vms[
i];
1510 "nat64-expire-walk",
1583 "inside" :
"outside");
1615 u32 *r = va_arg (*args,
u32 *);
1618 #define _(N, i, n, s) else if (unformat (input, s)) *r = NAT_PROTOCOL_##N; 1634 #define _(N, j, n, str) case NAT_PROTOCOL_##N: t = (u8 *) str; break; 1638 s =
format (s,
"unknown");
u32 nat64_get_icmp_timeout(void)
Get ICMP session timeout.
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void nat64_db_free_out_addr(u32 thread_index, nat64_db_t *db, ip4_address_t *out_addr)
Free sessions using specific outside address.
nat64_db_t * db
BIB and session DB per thread.
int nat64_alloc_out_addr_and_port(u32 fib_index, nat_protocol_t proto, ip4_address_t *addr, u16 *port, u32 thread_index)
Alloce IPv4 address and port pair from NAT64 pool.
u8 * format_nat_protocol(u8 *s, va_list *args)
nat64_address_t * addr_pool
Address pool vector.
int nat64_set_udp_timeout(u32 timeout)
Set UDP session timeout.
ip4_add_del_interface_address_callback_t * add_del_interface_address_callbacks
Functions to call when interface address changes.
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
int ip4_sv_reass_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
static_always_inline int nat64_alloc_addr_and_port_default(nat64_address_t *addresses, u32 fib_index, u32 thread_index, nat_protocol_t proto, ip4_address_t *addr, u16 *port, u16 port_per_thread, u32 nat_thread_index)
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
int nat64_db_free(nat64_db_t *db)
Free NAT64 DB.
vnet_main_t * vnet_get_main(void)
void nat_ipfix_logging_init(vlib_main_t *vm)
Initialize NAT plugin IPFIX logging.
void nat_ipfix_logging_addresses_exhausted(u32 thread_index, u32 pool_id)
Generate NAT addresses exhausted event.
#define pool_foreach(VAR, POOL)
Iterate through pool.
uword unformat_nat_protocol(unformat_input_t *input, va_list *args)
void nat64_extract_ip4(ip6_address_t *ip6, ip4_address_t *ip4, u32 fib_index)
Extract IPv4 address from the IPv4-embedded IPv6 addresses.
vl_api_ip_proto_t protocol
static void vlib_node_set_interrupt_pending(vlib_main_t *vm, u32 node_index)
#define clib_memcpy_fast(a, b, c)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void nat64_create_expire_walk_process()
ip4_address_t * ip4_interface_first_address(ip4_main_t *im, u32 sw_if_index, ip_interface_address_t **result_ia)
static f64 vlib_time_now(vlib_main_t *vm)
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
void nat64_reset_timeouts()
u32 vlib_frame_queue_main_init(u32 node_index, u32 frame_queue_nelts)
add paths without path extensions
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
nat64_db_bib_entry_t * nat64_db_bib_entry_find(nat64_db_t *db, ip46_address_t *addr, u16 port, u8 proto, u32 fib_index, u8 is_ip6)
Find NAT64 BIB entry.
static u64 clib_xxhash(u64 key)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define nat64_interface_is_inside(i)
Check if NAT64 interface is inside.
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
clib_error_t * nat64_api_hookup(vlib_main_t *vm)
#define NAT_TCP_TRANSITORY_TIMEOUT
int(* nat64_pool_addr_walk_fn_t)(nat64_address_t *addr, void *ctx)
Call back function when walking addresses in NAT64 pool, non-zero return value stop walk...
int nat64_add_interface_address(u32 sw_if_index, int is_add)
NAT64 pool address from specific (DHCP addressed) interface.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
struct _tcp_header tcp_header_t
u32 * auto_add_sw_if_indices
sw_if_indices whose interface addresses should be auto-added
vlib_main_t ** vlib_mains
format_function_t format_vnet_sw_if_index_name
fib_node_index_t fib_table_entry_update_one_path(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Update the entry to have just one path.
static void nat64_ip4_add_del_interface_address_cb(ip4_main_t *im, uword opaque, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 if_address_index, u32 is_delete)
static_always_inline u8 plugin_enabled()
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
u32 nat64_get_worker_in2out(ip6_address_t *addr)
Get worker thread index for NAT64 in2out.
#define static_always_inline
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
#define NAT64_INTERFACE_FLAG_IS_OUTSIDE
vlib_log_class_t log_class
#define VLIB_INIT_FUNCTION(x)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
description fragment has unexpected format
int nat64_set_icmp_timeout(u32 timeout)
Set ICMP session timeout.
Aggregate type for a prefix.
static_always_inline u8 icmp_type_is_error_message(u8 icmp_type)
static void * ip4_next_header(ip4_header_t *i)
int nat64_init_hash(nat64_config_t c)
vlib_node_registration_t nat64_in2out_node
(constructor) VLIB_REGISTER_NODE (nat64_in2out_node)
void nat64_tcp_session_set_state(nat64_db_st_entry_t *ste, tcp_header_t *tcp, u8 is_ip6)
Set NAT64 TCP session state.
u32 expire_worker_walk_node_index
fib_source_t fib_source_allocate(const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
u32 in2out_slowpath_node_index
static_always_inline u16 nat64_random_port(u16 min, u16 max)
char * name
The counter collection's name.
u32 udp_timeout
values of various timeouts
nat64_prefix_t * pref64
Pref64 vector.
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
#define FIB_SOURCE_PRIORITY_HI
Some priority values that plugins might use when they are not to concerned where in the list they'll ...
void nat64_session_reset_timeout(nat64_db_st_entry_t *ste, vlib_main_t *vm)
Reset NAT64 session timeout.
void nad64_db_st_free_expired(u32 thread_index, nat64_db_t *db, u32 now)
Free expired session entries in session tables.
IPv6 shallow virtual reassembly.
#define nat64_log_err(...)
IPv4 shallow virtual reassembly.
u32 nat64_get_udp_timeout(void)
Get UDP session timeout.
u32 vlib_process_create(vlib_main_t *vm, char *name, vlib_node_function_t *f, u32 log2_n_stack_bytes)
Create a vlib process.
#define pool_put(P, E)
Free an object E in pool P.
#define vec_del1(v, i)
Delete the element at index I.
static uword nat64_expire_walk_fn(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Centralized process to drive per worker expire walk.
static void vlib_set_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 value)
Set a simple counter.
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
void nat64_compose_ip6(ip6_address_t *ip6, ip4_address_t *ip4, u32 fib_index)
Compose IPv4-embedded IPv6 addresses.
vlib_simple_counter_main_t total_sessions
u32 expire_walk_node_index
static u8 well_known_prefix[]
#define pool_free(p)
Free a pool.
u32 nat64_get_tcp_est_timeout(void)
Get TCP established timeout.
#define VLIB_REGISTER_NODE(x,...)
vlib_node_registration_t nat64_out2in_node
(constructor) VLIB_REGISTER_NODE (nat64_out2in_node)
void nat64_pool_addr_walk(nat64_pool_addr_walk_fn_t fn, void *ctx)
Walk NAT64 pool.
static_always_inline uword vlib_get_thread_index(void)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
ip4_add_del_interface_address_function_t * function
int nat64_add_del_prefix(ip6_address_t *prefix, u8 plen, u32 vrf_id, u8 is_add)
Add/delete NAT64 prefix.
nat64_db_bib_entry_t * nat64_db_bib_entry_create(u32 thread_index, nat64_db_t *db, ip6_address_t *in_addr, ip4_address_t *out_addr, u16 in_port, u16 out_port, u32 fib_index, u8 proto, u8 is_static)
Create new NAT64 BIB entry.
vlib_main_t vlib_node_runtime_t * node
void vlib_validate_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
validate a simple counter
#define nat64_interface_is_outside(i)
Check if NAT64 interface is outside.
#define pool_put_index(p, i)
Free pool element with given index.
u32 nat64_get_worker_out2in(vlib_buffer_t *b, ip4_header_t *ip)
Get worker thread index for NAT64 out2in.
manual_print typedef address
u32 fq_in2out_index
Worker handoff.
nat64_static_bib_to_update_t * static_bibs
Pool of static BIB entries to be added/deleted in worker threads.
static void nat64_free_out_addr_and_port(struct nat64_db_s *db, ip4_address_t *addr, u16 port, u8 protocol)
#define foreach_nat_counter
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
#define clib_bitmap_free(v)
Free a bitmap.
static void vlib_zero_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Clear a simple counter Clears the set of per-thread u16 counters, and the u64 counter.
uword * thread_registrations_by_name
static uword nat64_expire_worker_walk_fn(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Per worker process checking expire time for NAT64 sessions.
int nat64_add_del_pool_addr(u32 thread_index, ip4_address_t *addr, u32 vrf_id, u8 is_add)
Add/delete address to NAT64 pool.
#define FIB_SOURCE_PRIORITY_LOW
static vlib_node_registration_t nat64_expire_worker_walk_node
(constructor) VLIB_REGISTER_NODE (nat64_expire_worker_walk_node)
int ip6_sv_reass_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
#define VNET_FEATURES(...)
void nat64_prefix_walk(nat64_prefix_walk_fn_t fn, void *ctx)
Walk NAT64 prefixes.
static vlib_main_t * vlib_get_main(void)
static uword is_pow2(uword x)
void nat64_interfaces_walk(nat64_interface_walk_fn_t fn, void *ctx)
Walk NAT64 interfaces.
clib_error_t * nat64_init(vlib_main_t *vm)
Initialize NAT64.
struct _vlib_node_registration vlib_node_registration_t
int nat64_set_tcp_timeouts(u32 trans, u32 est)
Set TCP session timeouts.
char * stat_segment_name
Name in stat segment directory.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define NAT_TCP_ESTABLISHED_TIMEOUT
VLIB buffer representation.
#define nat_elog_str(_str)
static uword nat64_static_bib_worker_fn(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Add/delete static BIB entry in worker thread.
#define NAT64_INTERFACE_FLAG_IS_INSIDE
int nat64_plugin_disable()
u32 error_node_index
node index
int nat64_interface_add_del(u32 sw_if_index, u8 is_inside, u8 is_add)
Enable/disable NAT64 feature on the interface.
#define hash_get_mem(h, key)
void nat64_db_bib_entry_free(u32 thread_index, nat64_db_t *db, nat64_db_bib_entry_t *bibe)
Free NAT64 BIB entry.
int nat64_plugin_enable(nat64_config_t c)
static u32 random_u32(u32 *seed)
32-bit random number generator
ip4_main_t ip4_main
Global ip4 main structure.
static vlib_thread_main_t * vlib_get_thread_main()
#define vec_foreach(var, vec)
Vector iterator.
int nat64_db_init(nat64_db_t *db, nat64_config_t c, nat64_db_free_addr_port_function_t free_addr_port_cb)
Initialize NAT64 DB.
static vlib_node_registration_t nat64_static_bib_worker_node
(constructor) VLIB_REGISTER_NODE (nat64_static_bib_worker_node)
nat64_interface_t * interfaces
Interface pool.
void nat64_add_del_addr_to_fib(ip4_address_t *addr, u8 p_len, u32 sw_if_index, int is_add)
VNET_FEATURE_INIT(nat64_in2out, static)
int nat64_add_del_static_bib_entry(ip6_address_t *in_addr, ip4_address_t *out_addr, u16 in_port, u16 out_port, u8 proto, u32 vrf_id, u8 is_add)
Add/delete static NAT64 BIB entry.
int(* nat64_prefix_walk_fn_t)(nat64_prefix_t *pref64, void *ctx)
Call back function when walking addresses in NAT64 prefixes, non-zero return value stop walk...
static void nat64_validate_counters(nat64_main_t *nm, u32 sw_if_index)
vl_api_interface_index_t sw_if_index
u32 nat64_get_tcp_trans_timeout(void)
Get TCP transitory timeout.
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
int(* nat64_interface_walk_fn_t)(nat64_interface_t *i, void *ctx)
Call back function when walking interfaces with NAT64 feature, non-zero return value stop walk...
vlib_simple_counter_main_t total_bibs