FreeBSD kernel netgraph code
netflow_v9.c File Reference
#include <sys/cdefs.h>
#include "opt_inet6.h"
#include "opt_route.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/counter.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/syslog.h>
#include <sys/socket.h>
#include <vm/uma.h>
#include <net/if.h>
#include <net/route.h>
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/netflow/netflow.h>
#include <netgraph/netflow/ng_netflow.h>
#include <netgraph/netflow/netflow_v9.h>
Include dependency graph for netflow_v9.c:

Go to the source code of this file.

Functions

 __FBSDID ("$FreeBSD$")
 
 MALLOC_DECLARE (M_NETFLOW_GENERAL)
 
 MALLOC_DEFINE (M_NETFLOW_GENERAL, "netflow_general", "plog, V9 templates data")
 
static void generate_v9_templates (priv_p priv)
 
static void close_flowset (struct mbuf *m, struct netflow_v9_packet_opt *t)
 
int export9_send (priv_p priv, fib_export_p fe, item_p item, struct netflow_v9_packet_opt *t, int flags)
 
int export9_add (item_p item, struct netflow_v9_packet_opt *t, struct flow_entry *fle)
 
item_p get_export9_dgram (priv_p priv, fib_export_p fe, struct netflow_v9_packet_opt **tt)
 
void return_export9_dgram (priv_p priv, fib_export_p fe, item_p item, struct netflow_v9_packet_opt *t, int flags)
 
void ng_netflow_v9_cache_init (priv_p priv)
 
void ng_netflow_v9_cache_flush (priv_p priv)
 
void ng_netflow_copyv9info (priv_p priv, struct ng_netflow_v9info *i)
 

Variables

struct netflow_v9_template _netflow_v9_record_ipv4_tcp []
 
struct netflow_v9_template _netflow_v9_record_ipv6_tcp []
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ close_flowset()

static void close_flowset ( struct mbuf *  m,
struct netflow_v9_packet_opt t 
)
inlinestatic

Definition at line 172 of file netflow_v9.c.

References netflow_v9_packet_opt::flow_header, length, and m_pktlen.

Referenced by export9_add(), and export9_send().

Here is the caller graph for this function:

◆ export9_add()

int export9_add ( item_p  item,
struct netflow_v9_packet_opt t,
struct flow_entry fle 
)

Definition at line 241 of file netflow_v9.c.

References _NETFLOW_V9_MAX_SIZE, flow_entry_data::bytes, flow6_entry_data::bytes, close_flowset(), netflow_v9_packet_opt::count, netflow_v9_record_ipv4_tcp::d_port, netflow_v9_record_ipv6_tcp::d_port, flow6_rec::dst, netflow_v9_record_ipv4_tcp::dst_addr, netflow_v9_record_ipv6_tcp::dst_addr, netflow_v9_record_ipv4_tcp::dst_as, netflow_v9_record_ipv6_tcp::dst_as, netflow_v9_record_ipv4_tcp::dst_mask, netflow_v9_record_ipv6_tcp::dst_mask, flow_entry_data::dst_mask, flow6_entry_data::dst_mask, flow_entry::f, netflow_v9_record_ipv4_tcp::first, netflow_v9_record_ipv6_tcp::first, flow_entry_data::first, flow6_entry_data::first, netflow_v9_record_ipv4_tcp::flags, netflow_v9_record_ipv6_tcp::flags, flow_entry_data::fle_o_ifx, flow6_entry_data::fle_o_ifx, netflow_v9_packet_opt::flow_header, netflow_v9_packet_opt::flow_type, flow_rec::flow_type, netflow_v9_record_ipv4_tcp::i_ifx, netflow_v9_record_ipv6_tcp::i_ifx, netflow_v9_record_ipv4_tcp::i_octets, netflow_v9_record_ipv6_tcp::i_octets, netflow_v9_record_ipv4_tcp::i_packets, netflow_v9_record_ipv6_tcp::i_packets, netflow_v9_flowset_header::id, netflow_v9_record_ipv4_tcp::last, netflow_v9_record_ipv6_tcp::last, flow_entry_data::last, flow6_entry_data::last, netflow_v9_flowset_header::length, m_pktlen, MILLIUPTIME, netflow_v9_packet_opt::mtu, flow6_entry_data::n, NETFLOW_V9_FLOW_V4_L4, NETFLOW_V9_FLOW_V6_L4, NETFLOW_V9_MAX_RESERVED_FLOWSET, netflow_v9_record_ipv4_tcp::next_hop, netflow_v9_record_ipv6_tcp::next_hop, flow_entry_data::next_hop, flow6_entry_data::next_hop6, NGI_M, netflow_v9_record_ipv4_tcp::o_ifx, netflow_v9_record_ipv6_tcp::o_ifx, netflow_v9_record_ipv4_tcp::o_octets, netflow_v9_record_ipv6_tcp::o_octets, netflow_v9_record_ipv4_tcp::o_packets, netflow_v9_record_ipv6_tcp::o_packets, flow_entry_data::packets, flow6_entry_data::packets, netflow_v9_record_ipv4_tcp::prot, netflow_v9_record_ipv6_tcp::prot, flow_entry_data::r, flow6_entry_data::r, flow_rec::r_dst, flow6_rec::r_dst6, flow_rec::r_src, flow6_rec::r_src6, netflow_v9_record_general::rec, netflow_v9_record_ipv4_tcp::s_port, netflow_v9_record_ipv6_tcp::s_port, flow6_rec::src, netflow_v9_record_ipv4_tcp::src_addr, netflow_v9_record_ipv6_tcp::src_addr, netflow_v9_record_ipv4_tcp::src_as, netflow_v9_record_ipv6_tcp::src_as, netflow_v9_record_ipv4_tcp::src_mask, netflow_v9_record_ipv6_tcp::src_mask, flow_entry_data::src_mask, flow6_entry_data::src_mask, flow_entry_data::tcp_flags, flow6_entry_data::tcp_flags, netflow_v9_record_ipv4_tcp::tos, netflow_v9_record_ipv6_tcp::tos, netflow_v9_record_general::v4_tcp, and netflow_v9_record_general::v6_tcp.

Referenced by expire_flow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ export9_send()

int export9_send ( priv_p  priv,
fib_export_p  fe,
item_p  item,
struct netflow_v9_packet_opt t,
int  flags 
)

◆ generate_v9_templates()

static void generate_v9_templates ( priv_p  priv)
static

◆ get_export9_dgram()

◆ MALLOC_DECLARE()

MALLOC_DECLARE ( M_NETFLOW_GENERAL  )

◆ MALLOC_DEFINE()

MALLOC_DEFINE ( M_NETFLOW_GENERAL  ,
"netflow_general"  ,
plog,
V9 templates data  
)

◆ ng_netflow_copyv9info()

void ng_netflow_copyv9info ( priv_p  priv,
struct ng_netflow_v9info i 
)

Definition at line 484 of file netflow_v9.c.

References ng_netflow_v9info::mtu, ng_netflow_v9info::templ_packets, and ng_netflow_v9info::templ_time.

Referenced by ng_netflow_rcvmsg().

Here is the caller graph for this function:

◆ ng_netflow_v9_cache_flush()

void ng_netflow_v9_cache_flush ( priv_p  priv)

Definition at line 473 of file netflow_v9.c.

Referenced by ng_netflow_cache_flush().

Here is the caller graph for this function:

◆ ng_netflow_v9_cache_init()

void ng_netflow_v9_cache_init ( priv_p  priv)

Definition at line 462 of file netflow_v9.c.

References BASE_MTU, generate_v9_templates(), NETFLOW_V9_MAX_PACKETS_TEMPL, and NETFLOW_V9_MAX_TIME_TEMPL.

Referenced by ng_netflow_cache_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ return_export9_dgram()

void return_export9_dgram ( priv_p  priv,
fib_export_p  fe,
item_p  item,
struct netflow_v9_packet_opt t,
int  flags 
)

Definition at line 442 of file netflow_v9.c.

References fib_export::exp, fib_export::export9_mtx, export9_send(), flags, netflow_export_item::item9, and netflow_export_item::item9_opt.

Referenced by expire_flow().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _netflow_v9_record_ipv4_tcp

struct netflow_v9_template _netflow_v9_record_ipv4_tcp[]
Initial value:
=
{
{0, 0}
}
#define NETFLOW_V9_FIELD_INPUT_SNMP
Definition: netflow.h:158
#define NETFLOW_V9_FIELD_IN_PKTS
Definition: netflow.h:150
#define NETFLOW_V9_FIELD_IPV4_DST_ADDR
Definition: netflow.h:160
#define NETFLOW_V9_FIELD_IPV4_NEXT_HOP
Definition: netflow.h:163
#define NETFLOW_V9_FIELD_OUT_BYTES
Definition: netflow.h:171
#define NETFLOW_V9_FIELD_DST_MASK
Definition: netflow.h:161
#define NETFLOW_V9_FIELD_IPV4_SRC_ADDR
Definition: netflow.h:156
#define NETFLOW_V9_FIELD_DST_AS
Definition: netflow.h:165
#define NETFLOW_V9_FIELD_L4_DST_PORT
Definition: netflow.h:159
#define NETFLOW_V9_FIELD_TCP_FLAGS
Definition: netflow.h:154
#define NETFLOW_V9_FIELD_SRC_AS
Definition: netflow.h:164
#define NETFLOW_V9_FIELD_OUT_PKTS
Definition: netflow.h:172
#define NETFLOW_V9_FIELD_TOS
Definition: netflow.h:153
#define NETFLOW_V9_FIELD_L4_SRC_PORT
Definition: netflow.h:155
#define NETFLOW_V9_FIELD_SRC_MASK
Definition: netflow.h:157
#define NETFLOW_V9_FIELD_IN_BYTES
Definition: netflow.h:149
#define NETFLOW_V9_FIELD_PROTOCOL
Definition: netflow.h:152
#define NETFLOW_V9_FIELD_OUTPUT_SNMP
Definition: netflow.h:162
#define NETFLOW_V9_FIELD_LAST_SWITCHED
Definition: netflow.h:169
#define NETFLOW_V9_FIELD_FIRST_SWITCHED
Definition: netflow.h:170
#define CNTR
Definition: netflow_v9.h:38

Definition at line 71 of file netflow_v9.c.

Referenced by generate_v9_templates().

◆ _netflow_v9_record_ipv6_tcp