Backout accidentially leaked in r309746 not yet reviewed patch :(
This commit is contained in:
parent
4f37ca1641
commit
6c5967127b
@ -161,8 +161,8 @@ static struct pfsync_q pfsync_qs[] = {
|
||||
{ pfsync_out_del, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C }
|
||||
};
|
||||
|
||||
static void pfsync_q_ins(struct pf_state *, int, bool);
|
||||
static void pfsync_q_del(struct pf_state *, bool);
|
||||
static void pfsync_q_ins(struct pf_state *, int);
|
||||
static void pfsync_q_del(struct pf_state *);
|
||||
|
||||
static void pfsync_update_state(struct pf_state *);
|
||||
|
||||
@ -542,7 +542,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags)
|
||||
if (!(flags & PFSYNC_SI_IOCTL)) {
|
||||
st->state_flags &= ~PFSTATE_NOSYNC;
|
||||
if (st->state_flags & PFSTATE_ACK) {
|
||||
pfsync_q_ins(st, PFSYNC_S_IACK, true);
|
||||
pfsync_q_ins(st, PFSYNC_S_IACK);
|
||||
pfsync_push(sc);
|
||||
}
|
||||
}
|
||||
@ -1668,7 +1668,7 @@ pfsync_insert_state(struct pf_state *st)
|
||||
if (sc->sc_len == PFSYNC_MINPKT)
|
||||
callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif);
|
||||
|
||||
pfsync_q_ins(st, PFSYNC_S_INS, true);
|
||||
pfsync_q_ins(st, PFSYNC_S_INS);
|
||||
PFSYNC_UNLOCK(sc);
|
||||
|
||||
st->sync_updates = 0;
|
||||
@ -1789,7 +1789,7 @@ static void
|
||||
pfsync_update_state(struct pf_state *st)
|
||||
{
|
||||
struct pfsync_softc *sc = V_pfsyncif;
|
||||
bool sync = false, ref = true;
|
||||
int sync = 0;
|
||||
|
||||
PF_STATE_LOCK_ASSERT(st);
|
||||
PFSYNC_LOCK(sc);
|
||||
@ -1798,7 +1798,7 @@ pfsync_update_state(struct pf_state *st)
|
||||
pfsync_undefer_state(st, 0);
|
||||
if (st->state_flags & PFSTATE_NOSYNC) {
|
||||
if (st->sync_state != PFSYNC_S_NONE)
|
||||
pfsync_q_del(st, true);
|
||||
pfsync_q_del(st);
|
||||
PFSYNC_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
@ -1815,17 +1815,14 @@ pfsync_update_state(struct pf_state *st)
|
||||
if (st->key[PF_SK_WIRE]->proto == IPPROTO_TCP) {
|
||||
st->sync_updates++;
|
||||
if (st->sync_updates >= sc->sc_maxupdates)
|
||||
sync = true;
|
||||
sync = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case PFSYNC_S_IACK:
|
||||
pfsync_q_del(st, false);
|
||||
ref = false;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
pfsync_q_del(st);
|
||||
case PFSYNC_S_NONE:
|
||||
pfsync_q_ins(st, PFSYNC_S_UPD_C, ref);
|
||||
pfsync_q_ins(st, PFSYNC_S_UPD_C);
|
||||
st->sync_updates = 0;
|
||||
break;
|
||||
|
||||
@ -1883,14 +1880,13 @@ static void
|
||||
pfsync_update_state_req(struct pf_state *st)
|
||||
{
|
||||
struct pfsync_softc *sc = V_pfsyncif;
|
||||
bool ref = true;
|
||||
|
||||
PF_STATE_LOCK_ASSERT(st);
|
||||
PFSYNC_LOCK(sc);
|
||||
|
||||
if (st->state_flags & PFSTATE_NOSYNC) {
|
||||
if (st->sync_state != PFSYNC_S_NONE)
|
||||
pfsync_q_del(st, true);
|
||||
pfsync_q_del(st);
|
||||
PFSYNC_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
@ -1898,12 +1894,9 @@ pfsync_update_state_req(struct pf_state *st)
|
||||
switch (st->sync_state) {
|
||||
case PFSYNC_S_UPD_C:
|
||||
case PFSYNC_S_IACK:
|
||||
pfsync_q_del(st, false);
|
||||
ref = false;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
pfsync_q_del(st);
|
||||
case PFSYNC_S_NONE:
|
||||
pfsync_q_ins(st, PFSYNC_S_UPD, true);
|
||||
pfsync_q_ins(st, PFSYNC_S_UPD);
|
||||
pfsync_push(sc);
|
||||
break;
|
||||
|
||||
@ -1924,14 +1917,13 @@ static void
|
||||
pfsync_delete_state(struct pf_state *st)
|
||||
{
|
||||
struct pfsync_softc *sc = V_pfsyncif;
|
||||
bool ref = true;
|
||||
|
||||
PFSYNC_LOCK(sc);
|
||||
if (st->state_flags & PFSTATE_ACK)
|
||||
pfsync_undefer_state(st, 1);
|
||||
if (st->state_flags & PFSTATE_NOSYNC) {
|
||||
if (st->sync_state != PFSYNC_S_NONE)
|
||||
pfsync_q_del(st, true);
|
||||
pfsync_q_del(st);
|
||||
PFSYNC_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
@ -1939,27 +1931,30 @@ pfsync_delete_state(struct pf_state *st)
|
||||
if (sc->sc_len == PFSYNC_MINPKT)
|
||||
callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif);
|
||||
|
||||
pf_ref_state(st);
|
||||
|
||||
switch (st->sync_state) {
|
||||
case PFSYNC_S_INS:
|
||||
/* We never got to tell the world so just forget about it. */
|
||||
pfsync_q_del(st, true);
|
||||
pfsync_q_del(st);
|
||||
break;
|
||||
|
||||
case PFSYNC_S_UPD_C:
|
||||
case PFSYNC_S_UPD:
|
||||
case PFSYNC_S_IACK:
|
||||
pfsync_q_del(st, false);
|
||||
ref = false;
|
||||
/* FALLTHROUGH */
|
||||
pfsync_q_del(st);
|
||||
/* FALLTHROUGH to putting it on the del list */
|
||||
|
||||
case PFSYNC_S_NONE:
|
||||
pfsync_q_ins(st, PFSYNC_S_DEL, ref);
|
||||
pfsync_q_ins(st, PFSYNC_S_DEL);
|
||||
break;
|
||||
|
||||
default:
|
||||
panic("%s: unexpected sync state %d", __func__, st->sync_state);
|
||||
}
|
||||
|
||||
pf_release_state(st);
|
||||
|
||||
PFSYNC_UNLOCK(sc);
|
||||
}
|
||||
|
||||
@ -1987,7 +1982,7 @@ pfsync_clear_states(u_int32_t creatorid, const char *ifname)
|
||||
}
|
||||
|
||||
static void
|
||||
pfsync_q_ins(struct pf_state *st, int q, bool ref)
|
||||
pfsync_q_ins(struct pf_state *st, int q)
|
||||
{
|
||||
struct pfsync_softc *sc = V_pfsyncif;
|
||||
size_t nlen = pfsync_qs[q].len;
|
||||
@ -2011,12 +2006,11 @@ pfsync_q_ins(struct pf_state *st, int q, bool ref)
|
||||
sc->sc_len += nlen;
|
||||
TAILQ_INSERT_TAIL(&sc->sc_qs[q], st, sync_list);
|
||||
st->sync_state = q;
|
||||
if (ref)
|
||||
pf_ref_state(st);
|
||||
pf_ref_state(st);
|
||||
}
|
||||
|
||||
static void
|
||||
pfsync_q_del(struct pf_state *st, bool unref)
|
||||
pfsync_q_del(struct pf_state *st)
|
||||
{
|
||||
struct pfsync_softc *sc = V_pfsyncif;
|
||||
int q = st->sync_state;
|
||||
@ -2028,8 +2022,7 @@ pfsync_q_del(struct pf_state *st, bool unref)
|
||||
sc->sc_len -= pfsync_qs[q].len;
|
||||
TAILQ_REMOVE(&sc->sc_qs[q], st, sync_list);
|
||||
st->sync_state = PFSYNC_S_NONE;
|
||||
if (unref)
|
||||
pf_release_state(st);
|
||||
pf_release_state(st);
|
||||
|
||||
if (TAILQ_EMPTY(&sc->sc_qs[q]))
|
||||
sc->sc_len -= sizeof(struct pfsync_subheader);
|
||||
|
Loading…
Reference in New Issue
Block a user