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

Function export_send

freebsd/netgraph/netflow/netflow.c:1008–1040  ·  view source on GitHub ↗

We have full datagram in privdata. Send it to export hook. */

Source from the content-addressed store, hash-verified

1006
1007/* We have full datagram in privdata. Send it to export hook. */
1008static int
1009export_send(priv_p priv, fib_export_p fe, item_p item, int flags)
1010{
1011 struct mbuf *m = NGI_M(item);
1012 struct netflow_v5_export_dgram *dgram = mtod(m,
1013 struct netflow_v5_export_dgram *);
1014 struct netflow_v5_header *header = &dgram->header;
1015 struct timespec ts;
1016 int error = 0;
1017
1018 /* Fill mbuf header. */
1019 m->m_len = m->m_pkthdr.len = sizeof(struct netflow_v5_record) *
1020 header->count + sizeof(struct netflow_v5_header);
1021
1022 /* Fill export header. */
1023 header->sys_uptime = htonl(MILLIUPTIME(time_uptime));
1024 getnanotime(&ts);
1025 header->unix_secs = htonl(ts.tv_sec);
1026 header->unix_nsecs = htonl(ts.tv_nsec);
1027 header->engine_type = 0;
1028 header->engine_id = fe->domain_id;
1029 header->pad = 0;
1030 header->flow_seq = htonl(atomic_fetchadd_32(&fe->flow_seq,
1031 header->count));
1032 header->count = htons(header->count);
1033
1034 if (priv->export != NULL)
1035 NG_FWD_ITEM_HOOK_FLAGS(error, item, priv->export, flags);
1036 else
1037 NG_FREE_ITEM(item);
1038
1039 return (error);
1040}
1041
1042/* Add export record to dgram. */
1043static int

Callers 3

return_export_dgramFunction · 0.85
expire_flowFunction · 0.85
ng_netflow_cache_flushFunction · 0.85

Calls 2

getnanotimeFunction · 0.85
atomic_fetchadd_32Function · 0.50

Tested by

no test coverage detected