* The flow is over. Call export_add() and free it. If datagram is * full, then call export_send(). */
| 223 | * full, then call export_send(). |
| 224 | */ |
| 225 | static void |
| 226 | expire_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 */ |
| 280 | void |
no test coverage detected