aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2020-11-04 17:07:44 -0600
committerOle Tr�an <otroan@employees.org>2020-11-12 15:16:46 +0000
commitaeb7d80c84b0084c8f63792dc8588193e0bc28a3 (patch)
treec3e0c498a1b0c9eaa0df78204e95d65c563ee0cb /src/plugins/nat
parent2db9273155a328b814bf16b65dfedc5de20094c2 (diff)
nat: use table ID for nat44 ipfix session events
Type: fix IPfix messages about NAT44 session create/delete were being populated with the FIB table index instead of the table ID. The table ID is the correct identifier to report externally (NAT64 IPfix messages for BIB and session create/delete use table ID, as does NAT syslogging). Convert the table index to an ID before adding it to the IPfix NAT44 session create/delete message data. Change-Id: I0166384752b17ff3a8c55aa19fa2af7a8140791e Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src/plugins/nat')
-rw-r--r--src/plugins/nat/lib/ipfix_logging.c13
-rw-r--r--src/plugins/nat/lib/ipfix_logging.h4
2 files changed, 10 insertions, 7 deletions
diff --git a/src/plugins/nat/lib/ipfix_logging.c b/src/plugins/nat/lib/ipfix_logging.c
index 60b3c1f77a2..6a944692f47 100644
--- a/src/plugins/nat/lib/ipfix_logging.c
+++ b/src/plugins/nat/lib/ipfix_logging.c
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+#include <vnet/fib/fib_table.h>
#include <vnet/ipfix-export/flow_report.h>
#include <vnet/ip/ip4.h>
#include <vnet/udp/udp_local.h>
@@ -577,7 +578,7 @@ nat_ipfix_send (u32 thread_index, flow_report_main_t * frm,
static void
nat_ipfix_logging_nat44_ses (u32 thread_index, u8 nat_event, u32 src_ip,
u32 nat_src_ip, nat_protocol_t nat_proto,
- u16 src_port, u16 nat_src_port, u32 vrf_id,
+ u16 src_port, u16 nat_src_port, u32 fib_index,
int do_flush)
{
nat_ipfix_logging_main_t *silm = &nat_ipfix_logging_main;
@@ -591,6 +592,7 @@ nat_ipfix_logging_nat44_ses (u32 thread_index, u8 nat_event, u32 src_ip,
u64 now;
u8 proto;
u16 template_id;
+ u32 vrf_id;
proto = nat_proto_to_ip_proto (nat_proto);
@@ -658,6 +660,7 @@ nat_ipfix_logging_nat44_ses (u32 thread_index, u8 nat_event, u32 src_ip,
clib_memcpy_fast (b0->data + offset, &nat_src_port, sizeof (nat_src_port));
offset += sizeof (nat_src_port);
+ vrf_id = fib_table_get_table_id (fib_index, FIB_PROTOCOL_IP4);
vrf_id = clib_host_to_net_u32 (vrf_id);
clib_memcpy_fast (b0->data + offset, &vrf_id, sizeof (vrf_id));
offset += sizeof (vrf_id);
@@ -1316,13 +1319,13 @@ nat_ipfix_logging_nat44_ses_create (u32 thread_index,
u32 nat_src_ip,
nat_protocol_t nat_proto,
u16 src_port,
- u16 nat_src_port, u32 vrf_id)
+ u16 nat_src_port, u32 fib_index)
{
skip_if_disabled ();
nat_ipfix_logging_nat44_ses (thread_index, NAT44_SESSION_CREATE, src_ip,
nat_src_ip, nat_proto, src_port, nat_src_port,
- vrf_id, 0);
+ fib_index, 0);
}
/**
@@ -1342,13 +1345,13 @@ nat_ipfix_logging_nat44_ses_delete (u32 thread_index,
u32 nat_src_ip,
nat_protocol_t nat_proto,
u16 src_port,
- u16 nat_src_port, u32 vrf_id)
+ u16 nat_src_port, u32 fib_index)
{
skip_if_disabled ();
nat_ipfix_logging_nat44_ses (thread_index, NAT44_SESSION_DELETE, src_ip,
nat_src_ip, nat_proto, src_port, nat_src_port,
- vrf_id, 0);
+ fib_index, 0);
}
/**
diff --git a/src/plugins/nat/lib/ipfix_logging.h b/src/plugins/nat/lib/ipfix_logging.h
index b37c8567c8e..53aa86b2a38 100644
--- a/src/plugins/nat/lib/ipfix_logging.h
+++ b/src/plugins/nat/lib/ipfix_logging.h
@@ -118,12 +118,12 @@ 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);
+ u32 fib_index);
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);
+ u32 fib_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);