37#define NG_NETFLOW_NODE_TYPE "netflow"
38#define NGM_NETFLOW_COOKIE 1365756954
39#define NGM_NETFLOW_V9_COOKIE 1349865386
41#define NG_NETFLOW_MAXIFACES USHRT_MAX
45#define NG_NETFLOW_HOOK_DATA "iface"
46#define NG_NETFLOW_HOOK_OUT "out"
47#define NG_NETFLOW_HOOK_EXPORT "export"
48#define NG_NETFLOW_HOOK_EXPORT9 "export9"
91#define NG_NETFLOW_INFO_TYPE { \
92 { "IPv4 bytes", &ng_parse_uint64_type },\
93 { "IPv4 packets", &ng_parse_uint64_type },\
94 { "IPv6 bytes", &ng_parse_uint64_type },\
95 { "IPv6 packets", &ng_parse_uint64_type },\
96 { "IPv4 skipped bytes", &ng_parse_uint64_type },\
97 { "IPv4 skipped packets", &ng_parse_uint64_type },\
98 { "IPv6 skipped bytes", &ng_parse_uint64_type },\
99 { "IPv6 skipped packets", &ng_parse_uint64_type },\
100 { "Active expiries", &ng_parse_uint64_type },\
101 { "Inactive expiries", &ng_parse_uint64_type },\
102 { "IPv4 records used", &ng_parse_uint32_type },\
103 { "IPv6 records used", &ng_parse_uint32_type },\
104 { "Failed allocations", &ng_parse_uint32_type },\
105 { "V5 failed exports", &ng_parse_uint32_type },\
106 { "V9 failed exports", &ng_parse_uint32_type },\
107 { "mbuf reallocations", &ng_parse_uint32_type },\
108 { "fibs allocated", &ng_parse_uint32_type },\
109 { "Inactive timeout", &ng_parse_uint32_type },\
110 { "Active timeout", &ng_parse_uint32_type },\
118#define MAXDLTNAMELEN 20
141#define NG_NETFLOW_CONF_INGRESS 0x01
142#define NG_NETFLOW_CONF_EGRESS 0x02
143#define NG_NETFLOW_CONF_ONCE 0x04
144#define NG_NETFLOW_CONF_THISONCE 0x08
145#define NG_NETFLOW_CONF_NOSRCLOOKUP 0x10
146#define NG_NETFLOW_CONF_NODSTLOOKUP 0x20
148#define NG_NETFLOW_IS_FRAG 0x01
149#define NG_NETFLOW_FLOW_FLAGS (NG_NETFLOW_CONF_NOSRCLOOKUP|\
150 NG_NETFLOW_CONF_NODSTLOOKUP)
242#define r_ip_p misc.i.prot
243#define r_tos misc.i.tos
244#define r_i_ifx misc.i.i_ifx
245#define r_misc misc.all
246#define r_ports ports.both
247#define r_sport ports.dir.s_port
248#define r_dport ports.dir.d_port
256#define fle_i_ifx r.misc.i.i_ifx
274#define fle_i_ifx r.misc.i.i_ifx
288#define NREC_AT_ONCE 1000
289#define NREC6_AT_ONCE (NREC_AT_ONCE * sizeof(struct flow_entry_data) / \
290 sizeof(struct flow6_entry_data))
291#define NGRESP_SIZE (sizeof(struct ngnf_show_header) + (NREC_AT_ONCE * \
292 sizeof(struct flow_entry_data)))
293#define SORCVBUF_SIZE (NGRESP_SIZE + 2 * sizeof(struct ng_mesg))
311#define NG_NETFLOW_IFINFO_TYPE { \
312 { "packets", &ng_parse_uint32_type },\
313 { "data link type", &ng_parse_uint8_type }, \
314 { "index", &ng_parse_uint16_type },\
315 { "conf", &ng_parse_uint32_type },\
320#define NG_NETFLOW_SETDLT_TYPE { \
321 { "iface", &ng_parse_uint16_type }, \
322 { "dlt", &ng_parse_uint8_type }, \
327#define NG_NETFLOW_SETIFINDEX_TYPE { \
328 { "iface", &ng_parse_uint16_type }, \
329 { "index", &ng_parse_uint16_type }, \
334#define NG_NETFLOW_SETTIMEOUTS_TYPE { \
335 { "inactive", &ng_parse_uint32_type }, \
336 { "active", &ng_parse_uint32_type }, \
341#define NG_NETFLOW_SETCONFIG_TYPE { \
342 { "iface", &ng_parse_uint16_type }, \
343 { "conf", &ng_parse_uint32_type }, \
348#define NG_NETFLOW_SETTEMPLATE_TYPE { \
349 { "time", &ng_parse_uint16_type }, \
350 { "packets", &ng_parse_uint16_type }, \
355#define NG_NETFLOW_SETMTU_TYPE { \
356 { "mtu", &ng_parse_uint16_type }, \
361#define NG_NETFLOW_V9INFO_TYPE { \
362 { "v9 template packets", &ng_parse_uint16_type },\
363 { "v9 template time", &ng_parse_uint16_type },\
364 { "v9 MTU", &ng_parse_uint16_type },\
419#define CACHESIZE (65536*16)
420#define CACHELOWAT (CACHESIZE * 3/4)
421#define CACHEHIGHWAT (CACHESIZE * 9/10)
473#define NETFLOW_V9_MAX_FLOWSETS 2
494#define ERROUT(x) { error = (x); goto done; }
496#define MTAG_NETFLOW 1221656444
497#define MTAG_NETFLOW_CALLED 0
499#define m_pktlen(m) ((m)->m_pkthdr.len)
502#define priv_to_fib(priv, fib) (priv)->fib_data[(fib)]
509#define MILLIUPTIME(t) (((t) << 9) + \
524 uint8_t, uint8_t,
unsigned int);
526 uint8_t, uint8_t,
unsigned int);
void ng_netflow_cache_flush(priv_p)
int ng_netflow_fib_init(priv_p priv, int fib)
callout_func_t ng_netflow_expire
struct ng_netflow_iface * iface_p
#define NETFLOW_V9_MAX_FLOWSETS
void ng_netflow_copyinfo(priv_p, struct ng_netflow_info *)
void ng_netflow_v9_cache_init(priv_p)
struct ng_netflow_ifinfo * ifinfo_p
int ng_netflow_flow_show(priv_p, struct ngnf_show_header *req, struct ngnf_show_header *resp)
struct fib_export * fib_export_p
item_p get_export9_dgram(priv_p, fib_export_p, struct netflow_v9_packet_opt **)
int ng_netflow_flow6_add(priv_p, fib_export_p, struct ip6_hdr *, caddr_t, uint8_t, uint8_t, unsigned int)
void ng_netflow_cache_init(priv_p)
int export9_send(priv_p, fib_export_p, item_p, struct netflow_v9_packet_opt *, int)
@ NGM_NETFLOW_SETTIMEOUTS
@ NGM_NETFLOW_SETTEMPLATE
int ng_netflow_flow_add(priv_p, fib_export_p, struct ip *, caddr_t, uint8_t, uint8_t, unsigned int)
void return_export9_dgram(priv_p, fib_export_p, item_p, struct netflow_v9_packet_opt *, int)
int export9_add(item_p, struct netflow_v9_packet_opt *, struct flow_entry *)
void ng_netflow_v9_cache_flush(priv_p)
void ng_netflow_copyv9info(priv_p, struct ng_netflow_v9info *)
#define NG_NETFLOW_MAXIFACES
struct netflow_export_item exp
struct netflow_v9_packet_opt * export9_opt
struct in6_addr next_hop6
union flow6_entry_data::@22 n
struct flow6_entry_data f
TAILQ_ENTRY(flow_entry) fle_hash
union flow6_rec::@19 misc
struct flow6_rec::@19::@21 i
struct flow6_rec::@18::@20 dir
union flow6_rec::@18 ports
TAILQ_ENTRY(flow_entry) fle_hash
TAILQ_HEAD(fhead, flow_entry) head
union flow_rec::@12 ports
struct flow_rec::@12::@14 dir
struct flow_rec::@13::@15 i
struct netflow_v9_packet_opt * item9_opt
uint32_t nfinfo_export_failed
counter_u64_t nfinfo_bytes6
counter_u64_t nfinfo_packets6
struct netflow_v9_flowset_header * v9_flowsets[NETFLOW_V9_MAX_FLOWSETS - 1]
counter_u64_t nfinfo_spackets6
struct callout exp_callout
uint32_t nfinfo_realloc_mbuf
uint32_t nfinfo_alloc_failed
uint32_t nfinfo_alloc_fibs
struct flow_hash_entry * hash
counter_u64_t nfinfo_act_exp
uint32_t nfinfo_export9_failed
struct ng_netflow_iface ifaces[NG_NETFLOW_MAXIFACES]
counter_u64_t nfinfo_packets
counter_u64_t nfinfo_inact_exp
counter_u64_t nfinfo_sbytes6
counter_u64_t nfinfo_bytes
counter_u64_t nfinfo_spackets
u_char flowset_records[NETFLOW_V9_MAX_FLOWSETS - 1]
counter_u64_t nfinfo_sbytes
struct ng_netflow_ifinfo info
uint64_t nfinfo_inact_exp
uint32_t nfinfo_export_failed
uint32_t nfinfo_realloc_mbuf
uint32_t nfinfo_export9_failed
uint32_t nfinfo_alloc_failed
uint64_t nfinfo_spackets6
uint32_t nfinfo_alloc_fibs
uint32_t inactive_timeout