pf: remove pd_refs from pfsync
It only served to complicate cleanup, and added no value. While here drop packets in pfsync_defer_tmo() if we don't have a syncif, rather than just leaving them on the queue. Reviewed by: markj Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D39248
This commit is contained in:
parent
01194da28a
commit
27b23cdec9
@ -185,7 +185,6 @@ struct pfsync_upd_req_item {
|
||||
struct pfsync_deferral {
|
||||
struct pfsync_softc *pd_sc;
|
||||
TAILQ_ENTRY(pfsync_deferral) pd_entry;
|
||||
u_int pd_refs;
|
||||
struct callout pd_tmo;
|
||||
|
||||
struct pf_kstate *pd_st;
|
||||
@ -421,10 +420,8 @@ pfsync_clone_destroy(struct ifnet *ifp)
|
||||
if (ret > 0) {
|
||||
pfsync_undefer(pd, 1);
|
||||
} else {
|
||||
pd->pd_refs++;
|
||||
callout_drain(&pd->pd_tmo);
|
||||
}
|
||||
free(pd, M_PFSYNC);
|
||||
PFSYNC_BUCKET_LOCK(b);
|
||||
}
|
||||
MPASS(b->b_deferred == 0);
|
||||
@ -1780,7 +1777,6 @@ pfsync_defer(struct pf_kstate *st, struct mbuf *m)
|
||||
st->state_flags |= PFSTATE_ACK;
|
||||
|
||||
pd->pd_sc = sc;
|
||||
pd->pd_refs = 0;
|
||||
pd->pd_st = st;
|
||||
pf_ref_state(st);
|
||||
pd->pd_m = m;
|
||||
@ -1831,21 +1827,21 @@ pfsync_defer_tmo(void *arg)
|
||||
|
||||
PFSYNC_BUCKET_LOCK_ASSERT(b);
|
||||
|
||||
TAILQ_REMOVE(&b->b_deferrals, pd, pd_entry);
|
||||
b->b_deferred--;
|
||||
pd->pd_st->state_flags &= ~PFSTATE_ACK; /* XXX: locking! */
|
||||
PFSYNC_BUCKET_UNLOCK(b);
|
||||
free(pd, M_PFSYNC);
|
||||
|
||||
if (sc->sc_sync_if == NULL) {
|
||||
PFSYNC_BUCKET_UNLOCK(b);
|
||||
pf_release_state(st);
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
|
||||
NET_EPOCH_ENTER(et);
|
||||
CURVNET_SET(sc->sc_sync_if->if_vnet);
|
||||
|
||||
TAILQ_REMOVE(&b->b_deferrals, pd, pd_entry);
|
||||
b->b_deferred--;
|
||||
pd->pd_st->state_flags &= ~PFSTATE_ACK; /* XXX: locking! */
|
||||
if (pd->pd_refs == 0)
|
||||
free(pd, M_PFSYNC);
|
||||
PFSYNC_BUCKET_UNLOCK(b);
|
||||
|
||||
pfsync_tx(sc, m);
|
||||
|
||||
pf_release_state(st);
|
||||
|
Loading…
Reference in New Issue
Block a user