nat: ipfix logging separation & refactor
Type: refactor Change-Id: I8785e4987e4f60361072440d0c3c6954c9c12394 Signed-off-by: Filip Varga <fivarga@cisco.com>
This commit is contained in:
@@ -15,9 +15,11 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
add_vpp_library(nat
|
||||
SOURCES
|
||||
lib/ipfix_logging.c
|
||||
lib/alloc.c
|
||||
|
||||
INSTALL_HEADERS
|
||||
lib/ipfix_logging.h
|
||||
lib/alloc.h
|
||||
)
|
||||
|
||||
@@ -29,7 +31,6 @@ add_vpp_plugin(nat
|
||||
in2out_ed.c
|
||||
out2in.c
|
||||
out2in_ed.c
|
||||
nat_ipfix_logging.c
|
||||
nat_dpo.c
|
||||
nat44_cli.c
|
||||
nat44_handoff.c
|
||||
@@ -59,6 +60,8 @@ add_vpp_plugin(nat
|
||||
INSTALL_HEADERS
|
||||
nat_all_api_h.h
|
||||
nat_msg_enum.h
|
||||
|
||||
LINK_LIBRARIES nat
|
||||
)
|
||||
|
||||
add_vpp_plugin(dslite
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <nat/lib/lib.h>
|
||||
#include <nat/lib/inlines.h>
|
||||
#include <nat/lib/ipfix_logging.h>
|
||||
|
||||
/* Session state */
|
||||
#define foreach_det44_session_state \
|
||||
@@ -417,10 +418,9 @@ snat_det_ses_create (u32 thread_index, snat_det_map_t * dm,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO:
|
||||
/*snat_ipfix_logging_max_entries_per_user (thread_index,
|
||||
DET44_SES_PER_USER,
|
||||
in_addr->as_u32); */
|
||||
nat_ipfix_logging_max_entries_per_user (thread_index,
|
||||
DET44_SES_PER_USER,
|
||||
in_addr->as_u32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -25,7 +25,7 @@
|
||||
#include <vnet/fib/ip4_fib.h>
|
||||
#include <vnet/udp/udp.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
#include <nat/lib/ipfix_logging.h>
|
||||
#include <nat/nat_inlines.h>
|
||||
#include <nat/nat44/inlines.h>
|
||||
#include <nat/nat_syslog.h>
|
||||
@@ -203,13 +203,13 @@ nat44_i2o_is_idle_session_cb (clib_bihash_kv_8_8_t * kv, void *arg)
|
||||
if (clib_bihash_add_del_8_8 (&tsm->out2in, &s_kv, 0))
|
||||
nat_elog_warn ("out2in key del failed");
|
||||
|
||||
snat_ipfix_logging_nat44_ses_delete (ctx->thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_delete (ctx->thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
|
||||
nat_syslog_nat44_apmdel (s->user_index, s->in2out.fib_index,
|
||||
&s->in2out.addr, s->in2out.port,
|
||||
@@ -370,12 +370,12 @@ slow_path (snat_main_t * sm, vlib_buffer_t * b0,
|
||||
nat_elog_notice ("out2in key add failed");
|
||||
|
||||
/* log NAT event */
|
||||
snat_ipfix_logging_nat44_ses_create (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port, s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_create (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port, s->in2out.fib_index);
|
||||
|
||||
nat_syslog_nat44_apmadd (s->user_index, s->in2out.fib_index,
|
||||
&s->in2out.addr, s->in2out.port, &s->out2in.addr,
|
||||
|
||||
+15
-15
@@ -25,7 +25,7 @@
|
||||
#include <vnet/udp/udp.h>
|
||||
#include <vppinfra/error.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
#include <nat/lib/ipfix_logging.h>
|
||||
#include <nat/nat_inlines.h>
|
||||
#include <nat/nat44/inlines.h>
|
||||
#include <nat/nat_syslog.h>
|
||||
@@ -118,13 +118,13 @@ nat44_i2o_ed_is_idle_session_cb (clib_bihash_kv_16_8_t * kv, void *arg)
|
||||
if (snat_is_unk_proto_session (s))
|
||||
goto delete;
|
||||
|
||||
snat_ipfix_logging_nat44_ses_delete (ctx->thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_delete (ctx->thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
|
||||
nat_syslog_nat44_sdel (s->user_index, s->in2out.fib_index,
|
||||
&s->in2out.addr, s->in2out.port,
|
||||
@@ -284,7 +284,7 @@ nat_ed_alloc_addr_and_port (snat_main_t * sm, u32 rx_fib_index,
|
||||
#undef _
|
||||
|
||||
/* Totally out of translations to use... */
|
||||
snat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
nat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -468,12 +468,12 @@ slow_path_ed (snat_main_t * sm,
|
||||
*sessionp = s;
|
||||
|
||||
/* log NAT event */
|
||||
snat_ipfix_logging_nat44_ses_create (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port, s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_create (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port, s->in2out.fib_index);
|
||||
|
||||
nat_syslog_nat44_sadd (s->user_index, s->in2out.fib_index,
|
||||
&s->in2out.addr, s->in2out.port,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* nat_ipfix_logging.h - NAT Events IPFIX logging
|
||||
* ipfix_logging.h - NAT Events IPFIX logging
|
||||
*
|
||||
* Copyright (c) 2016 Cisco and/or its affiliates.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,10 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef __included_nat_ipfix_logging_h__
|
||||
#define __included_nat_ipfix_logging_h__
|
||||
#ifndef __included_nat_lib_ipfix_logging_h__
|
||||
#define __included_nat_lib_ipfix_logging_h__
|
||||
|
||||
#include <nat/nat.h>
|
||||
#include <vlib/buffer.h>
|
||||
#include <vlib/node.h>
|
||||
|
||||
#include <nat/lib/lib.h>
|
||||
|
||||
typedef enum {
|
||||
NAT_ADDRESSES_EXHAUTED = 3,
|
||||
@@ -72,7 +75,7 @@ typedef struct {
|
||||
u32 nat64_bib_next_record_offset;
|
||||
u32 nat64_ses_next_record_offset;
|
||||
|
||||
} snat_ipfix_per_thread_data_t;
|
||||
} nat_ipfix_per_thread_data_t;
|
||||
|
||||
typedef struct {
|
||||
/** NAT plugin IPFIX logging enabled */
|
||||
@@ -83,7 +86,7 @@ typedef struct {
|
||||
f64 vlib_time_0;
|
||||
|
||||
/* Per thread data */
|
||||
snat_ipfix_per_thread_data_t *per_thread_data;
|
||||
nat_ipfix_per_thread_data_t *per_thread_data;
|
||||
|
||||
/** template IDs */
|
||||
u16 nat44_session_template_id;
|
||||
@@ -105,24 +108,24 @@ typedef struct {
|
||||
/** nat data callbacks call counter */
|
||||
u16 call_counter;
|
||||
|
||||
} snat_ipfix_logging_main_t;
|
||||
} nat_ipfix_logging_main_t;
|
||||
|
||||
extern snat_ipfix_logging_main_t snat_ipfix_logging_main;
|
||||
extern nat_ipfix_logging_main_t nat_ipfix_logging_main;
|
||||
|
||||
void snat_ipfix_logging_init (vlib_main_t * vm);
|
||||
int snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port);
|
||||
void snat_ipfix_logging_nat44_ses_create (u32 thread_index, u32 src_ip,
|
||||
void nat_ipfix_logging_init (vlib_main_t * vm);
|
||||
int nat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port);
|
||||
void nat_ipfix_logging_nat44_ses_create (u32 thread_index, u32 src_ip,
|
||||
u32 nat_src_ip,
|
||||
nat_protocol_t nat_proto,
|
||||
u16 src_port, u16 nat_src_port,
|
||||
u32 vrf_id);
|
||||
void snat_ipfix_logging_nat44_ses_delete (u32 thread_index, u32 src_ip,
|
||||
void nat_ipfix_logging_nat44_ses_delete (u32 thread_index, u32 src_ip,
|
||||
u32 nat_src_ip,
|
||||
nat_protocol_t nat_proto,
|
||||
u16 src_port, u16 nat_src_port,
|
||||
u32 vrf_id);
|
||||
void snat_ipfix_logging_addresses_exhausted(u32 thread_index, u32 pool_id);
|
||||
void snat_ipfix_logging_max_entries_per_user(u32 thread_index,
|
||||
void nat_ipfix_logging_addresses_exhausted(u32 thread_index, u32 pool_id);
|
||||
void nat_ipfix_logging_max_entries_per_user(u32 thread_index,
|
||||
u32 limit, u32 src_ip);
|
||||
void nat_ipfix_logging_max_sessions(u32 thread_index, u32 limit);
|
||||
void nat_ipfix_logging_max_bibs(u32 thread_index, u32 limit);
|
||||
@@ -140,4 +143,4 @@ void nat_ipfix_logging_nat64_bib(u32 thread_index,
|
||||
u16 src_port, u16 nat_src_port,
|
||||
u32 vrf_id, u8 is_create);
|
||||
|
||||
#endif /* __included_nat_ipfix_logging_h__ */
|
||||
#endif /* __included_nat_lib_ipfix_logging_h__ */
|
||||
+19
-19
@@ -21,7 +21,7 @@
|
||||
#include <vnet/plugin/plugin.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_dpo.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
#include <nat/lib/ipfix_logging.h>
|
||||
#include <nat/nat_inlines.h>
|
||||
#include <nat/nat44/inlines.h>
|
||||
#include <nat/nat_affinity.h>
|
||||
@@ -288,13 +288,13 @@ nat_free_session_data (snat_main_t * sm, snat_session_t * s, u32 thread_index,
|
||||
if (!is_ha)
|
||||
{
|
||||
/* log NAT event */
|
||||
snat_ipfix_logging_nat44_ses_delete (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_delete (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
|
||||
nat_ha_sdel (&s->out2in.addr, s->out2in.port, &s->ext_host_addr,
|
||||
s->ext_host_port, s->nat_proto, s->out2in.fib_index,
|
||||
@@ -411,13 +411,13 @@ nat44_free_session_data (snat_main_t * sm, snat_session_t * s,
|
||||
|
||||
if (!is_ha)
|
||||
{
|
||||
snat_ipfix_logging_nat44_ses_delete (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_delete (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
nat_ha_sdel (&s->out2in.addr, s->out2in.port, &s->ext_host_addr,
|
||||
s->ext_host_port, s->nat_proto, s->out2in.fib_index,
|
||||
thread_index);
|
||||
@@ -2710,7 +2710,7 @@ snat_init (vlib_main_t * vm)
|
||||
sm->counters.hairpinning.stat_segment_name = "/nat44/hairpinning";
|
||||
|
||||
/* Init IPFIX logging */
|
||||
snat_ipfix_logging_init (vm);
|
||||
nat_ipfix_logging_init (vm);
|
||||
|
||||
ip4_table_bind_callback_t cbt4 = {
|
||||
.function = snat_ip4_table_bind,
|
||||
@@ -3067,7 +3067,7 @@ nat_alloc_addr_and_port_default (snat_address_t * addresses,
|
||||
}
|
||||
|
||||
/* Totally out of translations to use... */
|
||||
snat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
nat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3116,7 +3116,7 @@ nat_alloc_addr_and_port_mape (snat_address_t * addresses, u32 fib_index,
|
||||
|
||||
exhausted:
|
||||
/* Totally out of translations to use... */
|
||||
snat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
nat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3163,7 +3163,7 @@ nat_alloc_addr_and_port_range (snat_address_t * addresses, u32 fib_index,
|
||||
|
||||
exhausted:
|
||||
/* Totally out of translations to use... */
|
||||
snat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
nat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
#include <nat/lib/ipfix_logging.h>
|
||||
#include <nat/lib/nat_inlines.h>
|
||||
#include <nat/nat_inlines.h>
|
||||
#include <nat/nat44/inlines.h>
|
||||
@@ -156,8 +156,8 @@ snat_ipfix_logging_enable_disable_command_fn (vlib_main_t * vm,
|
||||
/* Get a line of input. */
|
||||
if (!unformat_user (input, unformat_line_input, line_input))
|
||||
{
|
||||
rv = snat_ipfix_logging_enable_disable (enable, domain_id,
|
||||
(u16) src_port);
|
||||
rv = nat_ipfix_logging_enable_disable (enable, domain_id,
|
||||
(u16) src_port);
|
||||
if (rv)
|
||||
return clib_error_return (0, "ipfix logging enable failed");
|
||||
return 0;
|
||||
@@ -179,7 +179,7 @@ snat_ipfix_logging_enable_disable_command_fn (vlib_main_t * vm,
|
||||
}
|
||||
}
|
||||
|
||||
rv = snat_ipfix_logging_enable_disable (enable, domain_id, (u16) src_port);
|
||||
rv = nat_ipfix_logging_enable_disable (enable, domain_id, (u16) src_port);
|
||||
|
||||
if (rv)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <vnet/plugin/plugin.h>
|
||||
#include <vpp/app/version.h>
|
||||
|
||||
#include <nat/lib/ipfix_logging.h>
|
||||
#include <nat/nat64/nat64.h>
|
||||
|
||||
nat64_main_t nat64_main;
|
||||
@@ -293,9 +294,8 @@ nat64_init (vlib_main_t * vm)
|
||||
nm->port_per_thread = (0xffff - 1024) / _vec_len (nm->workers);
|
||||
}
|
||||
|
||||
// TODO: ipfix needs to be separated from NAT base plugin
|
||||
/* Init IPFIX logging */
|
||||
//snat_ipfix_logging_init (vm);
|
||||
nat_ipfix_logging_init (vm);
|
||||
|
||||
#define _(x) \
|
||||
nm->counters.in2out.x.name = #x; \
|
||||
@@ -749,7 +749,7 @@ nat64_alloc_addr_and_port_default (nat64_address_t * addresses,
|
||||
}
|
||||
|
||||
/* Totally out of translations to use... */
|
||||
//snat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
nat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <vnet/fib/fib_table.h>
|
||||
//#include <nat/nat_ipfix_logging.h>
|
||||
#include <nat/lib/ipfix_logging.h>
|
||||
#include <nat/nat_syslog.h>
|
||||
#include <nat/lib/inlines.h>
|
||||
#include <nat/nat64/nat64_db.h>
|
||||
@@ -137,9 +137,9 @@ nat64_db_bib_entry_create (u32 thread_index, nat64_db_t * db,
|
||||
kv.key[2] = bibe_key.as_u64[2];
|
||||
clib_bihash_add_del_24_8 (&db->bib.out2in, &kv, 1);
|
||||
|
||||
/*fib_table_t *fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
|
||||
nat_ipfix_logging_nat64_bib (thread_index, in_addr, out_addr, proto,
|
||||
in_port, out_port, fib->ft_table_id, 1); */
|
||||
fib_table_t *fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
|
||||
nat_ipfix_logging_nat64_bib (thread_index, in_addr, out_addr, proto,
|
||||
in_port, out_port, fib->ft_table_id, 1);
|
||||
return bibe;
|
||||
}
|
||||
|
||||
@@ -212,10 +212,10 @@ nat64_db_bib_entry_free (u32 thread_index, nat64_db_t * db,
|
||||
if (!db->addr_free)
|
||||
db->free_addr_port_cb (db, &bibe->out_addr, bibe->out_port, bibe->proto);
|
||||
|
||||
/*fib_table_t *fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
|
||||
nat_ipfix_logging_nat64_bib (thread_index, &bibe->in_addr, &bibe->out_addr,
|
||||
bibe->proto, bibe->in_port, bibe->out_port,
|
||||
fib->ft_table_id, 0); */
|
||||
fib_table_t *fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
|
||||
nat_ipfix_logging_nat64_bib (thread_index, &bibe->in_addr, &bibe->out_addr,
|
||||
bibe->proto, bibe->in_port, bibe->out_port,
|
||||
fib->ft_table_id, 0);
|
||||
|
||||
/* delete from pool */
|
||||
pool_put (bib, bibe);
|
||||
@@ -470,13 +470,13 @@ nat64_db_st_entry_create (u32 thread_index, nat64_db_t * db,
|
||||
kv.key[5] = ste_key.as_u64[5];
|
||||
clib_bihash_add_del_48_8 (&db->st.out2in, &kv, 1);
|
||||
|
||||
/*fib_table_t *fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
|
||||
nat_ipfix_logging_nat64_session (thread_index, &bibe->in_addr,
|
||||
&bibe->out_addr, bibe->proto,
|
||||
bibe->in_port, bibe->out_port,
|
||||
&ste->in_r_addr, &ste->out_r_addr,
|
||||
ste->r_port, ste->r_port, fib->ft_table_id,
|
||||
1); */
|
||||
fib_table_t *fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
|
||||
nat_ipfix_logging_nat64_session (thread_index, &bibe->in_addr,
|
||||
&bibe->out_addr, bibe->proto,
|
||||
bibe->in_port, bibe->out_port,
|
||||
&ste->in_r_addr, &ste->out_r_addr,
|
||||
ste->r_port, ste->r_port, fib->ft_table_id,
|
||||
1);
|
||||
nat_syslog_nat64_sadd (bibe->fib_index, &bibe->in_addr, bibe->in_port,
|
||||
&bibe->out_addr, bibe->out_port, &ste->out_r_addr,
|
||||
ste->r_port, bibe->proto);
|
||||
@@ -545,13 +545,13 @@ nat64_db_st_entry_free (u32 thread_index,
|
||||
kv.key[5] = ste_key.as_u64[5];
|
||||
clib_bihash_add_del_48_8 (&db->st.out2in, &kv, 0);
|
||||
|
||||
/*fib_table_t *fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
|
||||
nat_ipfix_logging_nat64_session (thread_index, &bibe->in_addr,
|
||||
&bibe->out_addr, bibe->proto,
|
||||
bibe->in_port, bibe->out_port,
|
||||
&ste->in_r_addr, &ste->out_r_addr,
|
||||
ste->r_port, ste->r_port, fib->ft_table_id,
|
||||
0); */
|
||||
fib_table_t *fib = fib_table_get (bibe->fib_index, FIB_PROTOCOL_IP6);
|
||||
nat_ipfix_logging_nat64_session (thread_index, &bibe->in_addr,
|
||||
&bibe->out_addr, bibe->proto,
|
||||
bibe->in_port, bibe->out_port,
|
||||
&ste->in_r_addr, &ste->out_r_addr,
|
||||
ste->r_port, ste->r_port, fib->ft_table_id,
|
||||
0);
|
||||
nat_syslog_nat64_sdel (bibe->fib_index, &bibe->in_addr, bibe->in_port,
|
||||
&bibe->out_addr, bibe->out_port, &ste->out_r_addr,
|
||||
ste->r_port, bibe->proto);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#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
|
||||
@@ -341,11 +341,10 @@ vl_api_nat_ipfix_enable_disable_t_handler (vl_api_nat_ipfix_enable_disable_t *
|
||||
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);
|
||||
}
|
||||
|
||||
+14
-14
@@ -25,7 +25,7 @@
|
||||
#include <vnet/ethernet/ethernet.h>
|
||||
#include <vnet/fib/ip4_fib.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
#include <nat/lib/ipfix_logging.h>
|
||||
#include <nat/nat_inlines.h>
|
||||
#include <nat/nat44/inlines.h>
|
||||
#include <nat/nat_syslog.h>
|
||||
@@ -119,13 +119,13 @@ nat44_o2i_is_idle_session_cb (clib_bihash_kv_8_8_t * kv, void *arg)
|
||||
if (clib_bihash_add_del_8_8 (&tsm->in2out, &s_kv, 0))
|
||||
nat_elog_warn ("out2in key del failed");
|
||||
|
||||
snat_ipfix_logging_nat44_ses_delete (ctx->thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_delete (ctx->thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
|
||||
nat_syslog_nat44_apmdel (s->user_index, s->in2out.fib_index,
|
||||
&s->in2out.addr, s->in2out.port,
|
||||
@@ -235,12 +235,12 @@ create_session_for_static_mapping (snat_main_t * sm,
|
||||
nat_elog_notice ("out2in key add failed");
|
||||
|
||||
/* log NAT event */
|
||||
snat_ipfix_logging_nat44_ses_create (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port, s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_create (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port, s->in2out.fib_index);
|
||||
|
||||
nat_syslog_nat44_apmadd (s->user_index, s->in2out.fib_index,
|
||||
&s->in2out.addr, s->in2out.port, &s->out2in.addr,
|
||||
|
||||
+15
-15
@@ -25,7 +25,7 @@
|
||||
#include <vnet/udp/udp.h>
|
||||
#include <vppinfra/error.h>
|
||||
#include <nat/nat.h>
|
||||
#include <nat/nat_ipfix_logging.h>
|
||||
#include <nat/lib/ipfix_logging.h>
|
||||
#include <nat/nat_inlines.h>
|
||||
#include <nat/nat44/inlines.h>
|
||||
#include <nat/nat_syslog.h>
|
||||
@@ -137,13 +137,13 @@ nat44_o2i_ed_is_idle_session_cb (clib_bihash_kv_16_8_t * kv, void *arg)
|
||||
if (snat_is_unk_proto_session (s))
|
||||
goto delete;
|
||||
|
||||
snat_ipfix_logging_nat44_ses_delete (ctx->thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_delete (ctx->thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port,
|
||||
s->in2out.fib_index);
|
||||
|
||||
nat_syslog_nat44_sdel (s->user_index, s->in2out.fib_index,
|
||||
&s->in2out.addr, s->in2out.port,
|
||||
@@ -230,7 +230,7 @@ nat_alloc_addr_and_port_exact (snat_address_t * a,
|
||||
}
|
||||
|
||||
/* Totally out of translations to use... */
|
||||
snat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
nat_ipfix_logging_addresses_exhausted (thread_index, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -371,12 +371,12 @@ create_session_for_static_mapping_ed (snat_main_t * sm,
|
||||
&ctx))
|
||||
nat_elog_notice ("in2out-ed key add failed");
|
||||
|
||||
snat_ipfix_logging_nat44_ses_create (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port, s->in2out.fib_index);
|
||||
nat_ipfix_logging_nat44_ses_create (thread_index,
|
||||
s->in2out.addr.as_u32,
|
||||
s->out2in.addr.as_u32,
|
||||
s->nat_proto,
|
||||
s->in2out.port,
|
||||
s->out2in.port, s->in2out.fib_index);
|
||||
|
||||
nat_syslog_nat44_sadd (s->user_index, s->in2out.fib_index,
|
||||
&s->in2out.addr, s->in2out.port,
|
||||
|
||||
@@ -415,8 +415,6 @@ class TestNAT64(VppTestCase):
|
||||
self.assert_packet_checksums_valid(p)
|
||||
return p
|
||||
|
||||
# TODO: ipfix needs to be separated from NAT base plugin
|
||||
@unittest.skipUnless(running_extended_tests, "part of extended tests")
|
||||
def verify_ipfix_max_bibs(self, data, limit):
|
||||
"""
|
||||
Verify IPFIX maximum BIB entries exceeded event
|
||||
@@ -433,8 +431,6 @@ class TestNAT64(VppTestCase):
|
||||
# maxBIBEntries
|
||||
self.assertEqual(struct.pack("I", limit), record[472])
|
||||
|
||||
# TODO: ipfix needs to be separated from NAT base plugin
|
||||
@unittest.skipUnless(running_extended_tests, "part of extended tests")
|
||||
def verify_ipfix_bib(self, data, is_create, src_addr):
|
||||
"""
|
||||
Verify IPFIX NAT64 BIB create and delete events
|
||||
@@ -463,8 +459,6 @@ class TestNAT64(VppTestCase):
|
||||
# postNAPTSourceTransportPort
|
||||
self.assertEqual(struct.pack("!H", self.tcp_port_out), record[227])
|
||||
|
||||
# TODO: ipfix needs to be separated from NAT base plugin
|
||||
@unittest.skipUnless(running_extended_tests, "part of extended tests")
|
||||
def verify_ipfix_nat64_ses(self, data, is_create, src_addr, dst_addr,
|
||||
dst_port):
|
||||
"""
|
||||
@@ -583,8 +577,6 @@ class TestNAT64(VppTestCase):
|
||||
packed_pref_n = b''.join([scapy.compat.chb(x) for x in pref_n])
|
||||
return socket.inet_ntop(socket.AF_INET6, packed_pref_n)
|
||||
|
||||
# TODO: ipfix needs to be separated from NAT base plugin
|
||||
@unittest.skipUnless(running_extended_tests, "part of extended tests")
|
||||
def verify_ipfix_max_sessions(self, data, limit):
|
||||
"""
|
||||
Verify IPFIX maximum session entries exceeded event
|
||||
@@ -1655,7 +1647,6 @@ class TestNAT64(VppTestCase):
|
||||
addresses = self.vapi.nat64_pool_addr_dump()
|
||||
self.assertEqual(0, len(addresses))
|
||||
|
||||
# TODO: ipfix needs to be separated from NAT base plugin
|
||||
@unittest.skipUnless(running_extended_tests, "part of extended tests")
|
||||
def test_ipfix_max_bibs_sessions(self):
|
||||
""" IPFIX logging maximum session and BIB entries exceeded """
|
||||
@@ -1751,8 +1742,6 @@ class TestNAT64(VppTestCase):
|
||||
data = ipfix.decode_data_set(p.getlayer(Set))
|
||||
self.verify_ipfix_max_bibs(data, max_bibs)
|
||||
|
||||
# TODO: ipfix needs to be separated from NAT base plugin
|
||||
@unittest.skipUnless(running_extended_tests, "part of extended tests")
|
||||
def test_ipfix_bib_ses(self):
|
||||
""" IPFIX logging NAT64 BIB/session create and delete events """
|
||||
self.tcp_port_in = random.randint(1025, 65535)
|
||||
|
||||
Reference in New Issue
Block a user