nfq: use switch instead of 'else if'

This patch convert a 'else if' serie to a switch to increase
the readability of the decision related code.

 Please enter the commit message for your changes. Lines starting
remotes/origin/master-1.0.x
Eric Leblond 16 years ago committed by Victor Julien
parent c96586446b
commit 56cccdfa62

@ -390,25 +390,25 @@ void NFQSetVerdict(NFQThreadVars *t, Packet *p) {
//printf("%p verdicting on queue %" PRIu32 "\n", t, t->queue_num); //printf("%p verdicting on queue %" PRIu32 "\n", t, t->queue_num);
if (p->action == ACTION_ALERT) { switch (p->action) {
case ACTION_ALERT:
case ACTION_PASS:
verdict = NF_ACCEPT; verdict = NF_ACCEPT;
} else if (p->action == ACTION_PASS) { #ifdef COUNTERS
verdict = NF_ACCEPT; t->accepted++;
} else if (p->action == ACTION_DROP) { #endif /* COUNTERS */
verdict = NF_DROP; break;
} else if (p->action == ACTION_REJECT || case ACTION_REJECT:
p->action == ACTION_REJECT_DST || case ACTION_REJECT_DST:
p->action == ACTION_REJECT_BOTH){ case ACTION_REJECT_BOTH:
verdict = NF_DROP; case ACTION_DROP:
} else { default:
/* a verdict we don't know about, drop to be sure */ /* a verdict we don't know about, drop to be sure */
verdict = NF_DROP; verdict = NF_DROP;
}
#ifdef COUNTERS #ifdef COUNTERS
if (verdict == NF_ACCEPT) t->accepted++; t->dropped++;
if (verdict == NF_DROP) t->dropped++;
#endif /* COUNTERS */ #endif /* COUNTERS */
}
SCMutexLock(&t->mutex_qh); SCMutexLock(&t->mutex_qh);
ret = nfq_set_verdict(t->qh, p->nfq_v.id, verdict, 0, NULL); ret = nfq_set_verdict(t->qh, p->nfq_v.id, verdict, 0, NULL);

Loading…
Cancel
Save