MCPcopy Create free account
hub / github.com/F-Stack/f-stack / expire_flow

Function expire_flow

freebsd/netgraph/netflow/netflow.c:225–277  ·  view source on GitHub ↗

* The flow is over. Call export_add() and free it. If datagram is * full, then call export_send(). */

Source from the content-addressed store, hash-verified

223 * full, then call export_send().
224 */
225static void
226expire_flow(priv_p priv, fib_export_p fe, struct flow_entry *fle, int flags)
227{
228 struct netflow_export_item exp;
229 uint16_t version = fle->f.version;
230
231 if ((priv->export != NULL) && (version == IPVERSION)) {
232 exp.item = get_export_dgram(priv, fe);
233 if (exp.item == NULL) {
234 priv->nfinfo_export_failed++;
235 if (priv->export9 != NULL)
236 priv->nfinfo_export9_failed++;
237 /* fle definitely contains IPv4 flow. */
238 uma_zfree_arg(priv->zone, fle, priv);
239 return;
240 }
241
242 if (export_add(exp.item, fle) > 0)
243 export_send(priv, fe, exp.item, flags);
244 else
245 return_export_dgram(priv, fe, exp.item, NG_QUEUE);
246 }
247
248 if (priv->export9 != NULL) {
249 exp.item9 = get_export9_dgram(priv, fe, &exp.item9_opt);
250 if (exp.item9 == NULL) {
251 priv->nfinfo_export9_failed++;
252 if (version == IPVERSION)
253 uma_zfree_arg(priv->zone, fle, priv);
254#ifdef INET6
255 else if (version == IP6VERSION)
256 uma_zfree_arg(priv->zone6, fle, priv);
257#endif
258 else
259 panic("ng_netflow: Unknown IP proto: %d",
260 version);
261 return;
262 }
263
264 if (export9_add(exp.item9, exp.item9_opt, fle) > 0)
265 export9_send(priv, fe, exp.item9, exp.item9_opt, flags);
266 else
267 return_export9_dgram(priv, fe, exp.item9,
268 exp.item9_opt, NG_QUEUE);
269 }
270
271 if (version == IPVERSION)
272 uma_zfree_arg(priv->zone, fle, priv);
273#ifdef INET6
274 else if (version == IP6VERSION)
275 uma_zfree_arg(priv->zone6, fle, priv);
276#endif
277}
278
279/* Get a snapshot of node statistics */
280void

Callers 4

ng_netflow_cache_flushFunction · 0.85
ng_netflow_flow_addFunction · 0.85
ng_netflow_flow6_addFunction · 0.85
ng_netflow_expireFunction · 0.85

Calls 9

get_export_dgramFunction · 0.85
uma_zfree_argFunction · 0.85
export_addFunction · 0.85
export_sendFunction · 0.85
return_export_dgramFunction · 0.85
get_export9_dgramFunction · 0.85
export9_addFunction · 0.85
export9_sendFunction · 0.85
return_export9_dgramFunction · 0.85

Tested by

no test coverage detected