diff options
author | melifaro <melifaro@FreeBSD.org> | 2012-06-18 13:56:36 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2012-06-18 13:56:36 +0000 |
commit | a0b36d5a0f0c40ddf24df49d87f4c3821a55df16 (patch) | |
tree | d964270b7ca705bda10cab664f2f95c517987ec8 /sys/netgraph/netflow/ng_netflow.c | |
parent | 45df7964fe21fb200bbfa053a6f5367cd2dc9a22 (diff) | |
download | FreeBSD-src-a0b36d5a0f0c40ddf24df49d87f4c3821a55df16.zip FreeBSD-src-a0b36d5a0f0c40ddf24df49d87f4c3821a55df16.tar.gz |
Make radix lookup on src and dst flow addresses optional
and configurable on per-interface basis.
Remove __inline__ for several functions being called once per
flow (e.g once per 10-20 packets on common traffic flows).
Update manual page to simplify search for BPF data link types.
Sponsored by Yandex LLC
Reviewed by: glebius
Approved by: ae(mentor)
MFC after: 2 weeks
Diffstat (limited to 'sys/netgraph/netflow/ng_netflow.c')
-rw-r--r-- | sys/netgraph/netflow/ng_netflow.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/netgraph/netflow/ng_netflow.c b/sys/netgraph/netflow/ng_netflow.c index 6e6589e..1cb6179 100644 --- a/sys/netgraph/netflow/ng_netflow.c +++ b/sys/netgraph/netflow/ng_netflow.c @@ -560,7 +560,7 @@ ng_netflow_rcvdata (hook_p hook, item_p item) struct ip6_hdr *ip6 = NULL; struct m_tag *mtag; int pullup_len = 0, off; - uint8_t acct = 0, bypass = 0, is_frag = 0, upper_proto = 0; + uint8_t acct = 0, bypass = 0, flags = 0, upper_proto = 0; int error = 0, l3_off = 0; unsigned int src_if_index; caddr_t upper_ptr = NULL; @@ -619,6 +619,9 @@ ng_netflow_rcvdata (hook_p hook, item_p item) } } + /* Import configuration flags related to flow creation */ + flags = iface->info.conf & NG_NETFLOW_FLOW_FLAGS; + NGI_GET_M(item, m); m_old = m; @@ -759,7 +762,7 @@ ng_netflow_rcvdata (hook_p hook, item_p item) } } else if (ip != NULL) { /* Nothing to save except upper layer proto, since this is packet fragment */ - is_frag = 1; + flags |= NG_NETFLOW_IS_FRAG; upper_proto = ip->ip_p; if ((ip->ip_v != IPVERSION) || ((ip->ip_hl << 2) < sizeof(struct ip))) @@ -821,7 +824,7 @@ ng_netflow_rcvdata (hook_p hook, item_p item) upper_proto = ip6f->ip6f_nxt; hdr_off = sizeof(struct ip6_frag); off += hdr_off; - is_frag = 1; + flags |= NG_NETFLOW_IS_FRAG; goto loopend; #if 0 @@ -886,10 +889,10 @@ loopend: } if (ip != NULL) - error = ng_netflow_flow_add(priv, fe, ip, upper_ptr, upper_proto, is_frag, src_if_index); + error = ng_netflow_flow_add(priv, fe, ip, upper_ptr, upper_proto, flags, src_if_index); #ifdef INET6 else if (ip6 != NULL) - error = ng_netflow_flow6_add(priv, fe, ip6, upper_ptr, upper_proto, is_frag, src_if_index); + error = ng_netflow_flow6_add(priv, fe, ip6, upper_ptr, upper_proto, flags, src_if_index); #endif else goto bypass; |