-/* $OpenBSD: pf.c,v 1.919 2015/06/16 11:09:39 mpi Exp $ */
+/* $OpenBSD: pf.c,v 1.920 2015/06/22 15:58:23 mikeb Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
mrm->r->states_cur++; \
} while (0)
-#define STATE_DEC_COUNTERS(s) \
- do { \
- struct pf_rule_item *mrm; \
- if (s->anchor.ptr != NULL) \
- s->anchor.ptr->states_cur--; \
- s->rule.ptr->states_cur--; \
- SLIST_FOREACH(mrm, &s->match_rules, entry) \
- mrm->r->states_cur--; \
- } while (0)
-
static __inline int pf_src_compare(struct pf_src_node *, struct pf_src_node *);
static __inline int pf_state_compare_key(struct pf_state_key *,
struct pf_state_key *);
s->anchor.ptr = a;
s->natrule.ptr = nr;
memcpy(&s->match_rules, rules, sizeof(s->match_rules));
- STATE_INC_COUNTERS(s);
if (r->allow_opts)
s->state_flags |= PFSTATE_ALLOWOPTS;
if (r->rule_flag & PFRULE_STATESLOPPY)
} else
*sm = s;
+ STATE_INC_COUNTERS(s);
+
if (tag > 0) {
pf_tag_ref(tag);
s->tag = tag;
if (s) {
pf_normalize_tcp_cleanup(s); /* safe even w/o init */
pf_src_tree_remove_state(s);
+ pool_put(&pf_state_pl, s);
}
for (i = 0; i < PF_SN_MAX; i++)
if (sns[i] != NULL)
pf_remove_src_node(sns[i]);
- if (s) {
- STATE_DEC_COUNTERS(s);
- pool_put(&pf_state_pl, s);
- }
-
return (PF_DROP);
}