Code logic of handling PFTM_PURGE into pf_find_state().

This commit is contained in:
Gleb Smirnoff 2013-11-04 08:20:06 +00:00
parent 7710f9f14a
commit e1b58d2cff

View File

@ -318,7 +318,7 @@ enum { PF_ICMP_MULTI_NONE, PF_ICMP_MULTI_SOLICITED, PF_ICMP_MULTI_LINK };
#define STATE_LOOKUP(i, k, d, s, pd) \ #define STATE_LOOKUP(i, k, d, s, pd) \
do { \ do { \
(s) = pf_find_state((i), (k), (d)); \ (s) = pf_find_state((i), (k), (d)); \
if ((s) == NULL || (s)->timeout == PFTM_PURGE) \ if ((s) == NULL) \
return (PF_DROP); \ return (PF_DROP); \
if (PACKET_LOOPED(pd)) \ if (PACKET_LOOPED(pd)) \
return (PF_PASS); \ return (PF_PASS); \
@ -1230,11 +1230,11 @@ pf_find_state(struct pfi_kif *kif, struct pf_state_key_cmp *key, u_int dir)
if (s->kif == V_pfi_all || s->kif == kif) { if (s->kif == V_pfi_all || s->kif == kif) {
PF_STATE_LOCK(s); PF_STATE_LOCK(s);
PF_HASHROW_UNLOCK(kh); PF_HASHROW_UNLOCK(kh);
if (s->timeout == PFTM_UNLINKED) { if (s->timeout >= PFTM_MAX) {
/* /*
* State is being processed * State is either being processed by
* by pf_unlink_state() in * pf_unlink_state() in an other thread, or
* an other thread. * is scheduled for immediate expiry.
*/ */
PF_STATE_UNLOCK(s); PF_STATE_UNLOCK(s);
return (NULL); return (NULL);