#include <vnet/fib/fib_table.h>
#include <vnet/ip/ip_types_api.h>
#include <nat/nat44/ed_inlines.h>
-#include <nat/nat_ipfix_logging.h>
+#include <nat/lib/ipfix_logging.h>
#define vl_api_nat44_add_del_lb_static_mapping_t_endian vl_noop_handler
#define vl_api_nat44_nat44_lb_static_mapping_details_t_endian vl_noop_handler
REPLY_MACRO2 (VL_API_NAT_SHOW_CONFIG_REPLY,
({
rmp->translation_buckets = htonl (sm->translation_buckets);
- rmp->translation_memory_size = clib_host_to_net_u32 (
- sm->translation_memory_size > 0xffffffffULL
- ? 0xffffffffUL
- : (u32)sm->translation_memory_size);
+ rmp->translation_memory_size = 0;
rmp->user_buckets = htonl (sm->user_buckets);
- rmp->user_memory_size = clib_host_to_net_u64 (sm->user_memory_size);
+ rmp->user_memory_size = 0;
rmp->max_translations_per_user = htonl (sm->max_translations_per_user);
rmp->outside_vrf_id = htonl (sm->outside_vrf_id);
rmp->inside_vrf_id = htonl (sm->inside_vrf_id);
REPLY_MACRO2 (VL_API_NAT_SHOW_CONFIG_2_REPLY,
({
rmp->translation_buckets = htonl (sm->translation_buckets);
- rmp->translation_memory_size = clib_host_to_net_u64 (sm->translation_memory_size);
+ rmp->translation_memory_size = 0;
rmp->user_buckets = htonl (sm->user_buckets);
- rmp->user_memory_size = clib_host_to_net_u64 (sm->user_memory_size);
+ rmp->user_memory_size = 0;
rmp->max_translations_per_user = htonl (sm->max_translations_per_user);
rmp->outside_vrf_id = htonl (sm->outside_vrf_id);
rmp->inside_vrf_id = htonl (sm->inside_vrf_id);
FINISH;
}
+static void
+ vl_api_nat44_plugin_enable_disable_t_handler
+ (vl_api_nat44_plugin_enable_disable_t * mp)
+{
+ snat_main_t *sm = &snat_main;
+ nat44_config_t c = { 0 };
+ vl_api_nat44_plugin_enable_disable_reply_t *rmp;
+ int rv = 0;
+
+ if (mp->enable)
+ {
+ c.endpoint_dependent = mp->flags & NAT44_API_IS_ENDPOINT_DEPENDENT;
+ c.static_mapping_only = mp->flags & NAT44_API_IS_STATIC_MAPPING_ONLY;
+ c.connection_tracking = mp->flags & NAT44_API_IS_CONNECTION_TRACKING;
+ c.out2in_dpo = mp->flags & NAT44_API_IS_OUT2IN_DPO;
+
+ c.inside_vrf = ntohl (mp->inside_vrf);
+ c.outside_vrf = ntohl (mp->outside_vrf);
+
+ c.users = ntohl (mp->users);
+
+ c.sessions = ntohl (mp->sessions);
+
+ c.user_sessions = ntohl (mp->user_sessions);
+
+ rv = nat44_plugin_enable (c);
+ }
+ else
+ rv = nat44_plugin_disable ();
+
+ REPLY_MACRO (VL_API_NAT44_PLUGIN_ENABLE_DISABLE_REPLY);
+}
+
+static void *vl_api_nat44_plugin_enable_disable_t_print
+ (vl_api_nat44_plugin_enable_disable_t * mp, void *handle)
+{
+ u8 *s;
+ u32 val;
+
+ s = format (0, "SCRIPT: nat44_plugin_enable_disable ");
+ if (mp->enable)
+ {
+ s = format (s, "enable ");
+ if (mp->flags & NAT44_API_IS_ENDPOINT_DEPENDENT)
+ s = format (s, "endpoint-dependent ");
+ else
+ s = format (s, "endpoint-indepenednet ");
+ if (mp->flags & NAT44_API_IS_STATIC_MAPPING_ONLY)
+ s = format (s, "static_mapping_only ");
+ if (mp->flags & NAT44_API_IS_CONNECTION_TRACKING)
+ s = format (s, "connection_tracking ");
+ if (mp->flags & NAT44_API_IS_OUT2IN_DPO)
+ s = format (s, "out2in_dpo ");
+ val = ntohl (mp->inside_vrf);
+ if (val)
+ s = format (s, "inside_vrf %u ", val);
+ val = ntohl (mp->outside_vrf);
+ if (val)
+ s = format (s, "outside_vrf %u ", val);
+ val = ntohl (mp->users);
+ if (val)
+ s = format (s, "users %u ", val);
+ val = ntohl (mp->user_memory);
+ if (val)
+ s = format (s, "user_memory %u ", val);
+ val = ntohl (mp->sessions);
+ if (val)
+ s = format (s, "sessions %u ", val);
+ val = ntohl (mp->session_memory);
+ if (val)
+ s = format (s, "session_memory %u ", val);
+ val = ntohl (mp->user_sessions);
+ if (val)
+ s = format (s, "user_sessions %u ", val);
+ }
+ else
+ s = format (s, "disable ");
+
+ FINISH;
+}
+
static void
vl_api_nat_ipfix_enable_disable_t_handler (vl_api_nat_ipfix_enable_disable_t *
mp)
vl_api_nat_ipfix_enable_disable_reply_t *rmp;
int rv = 0;
- rv = snat_ipfix_logging_enable_disable (mp->enable,
- clib_host_to_net_u32
- (mp->domain_id),
- clib_host_to_net_u16
- (mp->src_port));
+ rv = nat_ipfix_logging_enable_disable (mp->enable,
+ clib_host_to_net_u32
+ (mp->domain_id),
+ clib_host_to_net_u16 (mp->src_port));
REPLY_MACRO (VL_API_NAT_IPFIX_ENABLE_DISABLE_REPLY);
}
pool_flush (u, tsm->users, { });
/* *INDENT-ON* */
clib_bihash_free_8_8 (&tsm->user_hash);
- clib_bihash_init_8_8 (&tsm->user_hash, "users", snat_main.user_buckets,
- snat_main.user_memory_size);
+ clib_bihash_init_8_8 (&tsm->user_hash, "users", snat_main.user_buckets, 0);
clib_bihash_set_kvp_format_fn_8_8 (&tsm->user_hash, format_user_kvp);
}
_(NAT_SHOW_CONFIG_2, nat_show_config_2) \
_(NAT_SET_WORKERS, nat_set_workers) \
_(NAT_WORKER_DUMP, nat_worker_dump) \
+_(NAT44_PLUGIN_ENABLE_DISABLE, nat44_plugin_enable_disable) \
_(NAT44_DEL_USER, nat44_del_user) \
_(NAT44_SET_SESSION_LIMIT, nat44_set_session_limit) \
_(NAT_SET_LOG_LEVEL, nat_set_log_level) \