We have full datagram in fib data. Send it to export hook. */
| 198 | |
| 199 | /* We have full datagram in fib data. Send it to export hook. */ |
| 200 | int |
| 201 | export9_send(priv_p priv, fib_export_p fe, item_p item, struct netflow_v9_packet_opt *t, int flags) |
| 202 | { |
| 203 | struct mbuf *m = NGI_M(item); |
| 204 | struct netflow_v9_export_dgram *dgram = mtod(m, |
| 205 | struct netflow_v9_export_dgram *); |
| 206 | struct netflow_v9_header *header = &dgram->header; |
| 207 | struct timespec ts; |
| 208 | int error = 0; |
| 209 | |
| 210 | if (t == NULL) { |
| 211 | CTR0(KTR_NET, "export9_send(): V9 export packet without tag"); |
| 212 | NG_FREE_ITEM(item); |
| 213 | return (0); |
| 214 | } |
| 215 | |
| 216 | /* Close flowset if not closed already */ |
| 217 | if (m_pktlen(m) != t->flow_header) |
| 218 | close_flowset(m, t); |
| 219 | |
| 220 | /* Fill export header. */ |
| 221 | header->count = t->count; |
| 222 | header->sys_uptime = htonl(MILLIUPTIME(time_uptime)); |
| 223 | getnanotime(&ts); |
| 224 | header->unix_secs = htonl(ts.tv_sec); |
| 225 | header->seq_num = htonl(atomic_fetchadd_32(&fe->flow9_seq, 1)); |
| 226 | header->count = htons(t->count); |
| 227 | header->source_id = htonl(fe->domain_id); |
| 228 | |
| 229 | if (priv->export9 != NULL) |
| 230 | NG_FWD_ITEM_HOOK_FLAGS(error, item, priv->export9, flags); |
| 231 | else |
| 232 | NG_FREE_ITEM(item); |
| 233 | |
| 234 | free(t, M_NETFLOW_GENERAL); |
| 235 | |
| 236 | return (error); |
| 237 | } |
| 238 | |
| 239 | /* Add V9 record to dgram. */ |
| 240 | int |
no test coverage detected