1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

Reduce copy/paste when freeing an source node.

This commit is contained in:
Gleb Smirnoff 2012-09-20 07:04:08 +00:00
parent 22c914789e
commit b7340ded6e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240737

View File

@ -673,6 +673,11 @@ pf_remove_src_node(struct pf_src_node *src)
PF_HASHROW_LOCK(sh);
LIST_REMOVE(src, entry);
PF_HASHROW_UNLOCK(sh);
V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
V_pf_status.src_nodes--;
uma_zfree(V_pf_sources_z, src);
}
/* Data storage structures initialization. */
@ -3547,18 +3552,12 @@ pf_create_state(struct pf_rule *r, struct pf_rule *nr, struct pf_rule *a,
if (nk != NULL)
uma_zfree(V_pf_state_key_z, nk);
if (sn != NULL && sn->states == 0 && sn->expire == 0) {
if (sn != NULL && sn->states == 0 && sn->expire == 0)
pf_remove_src_node(sn);
V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
V_pf_status.src_nodes--;
uma_zfree(V_pf_sources_z, sn);
}
if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) {
if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0)
pf_remove_src_node(nsn);
V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS]++;
V_pf_status.src_nodes--;
uma_zfree(V_pf_sources_z, nsn);
}
return (PF_DROP);
}