questions wrt ng_netflow
Weiguang Shi
wgshizz at yahoo.com
Thu Aug 23 10:07:11 PDT 2007
Hi there,
I've been reading netlfow.c in FreeBSD-6.2 and this piece of code confuses me.
484 /*
485 * Go through hash and find our entry. If we encounter an
486 * entry, that should be expired, purge it. We do a reverse
487 * search since most active entries are first, and most
488 * searches are done on most active entries.
489 */
490 TAILQ_FOREACH_REVERSE_SAFE(fle, &hsh->head, fhead, fle_hash, fle1) {
491 if (bcmp(&r, &fle->f.r, sizeof(struct flow_rec)) == 0)
492 break;
493 if ((INACTIVE(fle) && SMALL(fle)) || AGED(fle)) {
494 TAILQ_REMOVE(&hsh->head, fle, fle_hash);
495 expire_flow(priv, &item, fle, NG_QUEUE);
496 atomic_add_32(&priv->info.nfinfo_act_exp, 1);
497 }
498 }
+-------------+ +--------+ +--------+ +--------+ +--------+
| Bucket Head |----->| RecA |----->| RecB |----->| RecC |----->| RecD |
+-------------+ +--------+ +--------+ +--------+ +--------+
In the figure above, let's say our packet matches RecC. So before the
match, RecD is examined to see if it's AGED, i.e., it's lasted for too
long, or if it's too small and inactive. As the match is found, the
code stops searching.
First, isn't INACTIVE alone enough to expire a flow? Why must INACTIVE
_and_ SMALL?
RecA and RecB would not be examined for expiration but since they are
to the beginning of the queue and therefore actually less recently
accessed, they are more likely to be INACTIVE and could be more AGED.
I must be missing something, but what justifies examining RecD but not
RecA and RecB?
Thank you very much for your time.
Wei
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433
More information about the freebsd-net
mailing list