-/* $OpenBSD: if_pfsync.c,v 1.257 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.258 2018/08/24 12:29:33 sashan Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
if (TAILQ_EMPTY(&sc->sc_qs[q]))
continue;
- TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) {
+ while ((st = TAILQ_FIRST(&sc->sc_qs[q])) != NULL) {
+ TAILQ_REMOVE(&sc->sc_qs[q], st, sync_list);
#ifdef PFSYNC_DEBUG
KASSERT(st->sync_state == q);
#endif
st->sync_state = PFSYNC_S_NONE;
}
- TAILQ_INIT(&sc->sc_qs[q]);
}
while ((ur = TAILQ_FIRST(&sc->sc_upd_req_list)) != NULL) {
sc->sc_plus = NULL;
- if (!TAILQ_EMPTY(&sc->sc_tdb_q)) {
- TAILQ_FOREACH(t, &sc->sc_tdb_q, tdb_sync_entry)
- CLR(t->tdb_flags, TDBF_PFSYNC);
-
- TAILQ_INIT(&sc->sc_tdb_q);
+ while ((t = TAILQ_FIRST(&sc->sc_tdb_q)) != NULL) {
+ TAILQ_REMOVE(&sc->sc_tdb_q, t, tdb_sync_entry);
+ CLR(t->tdb_flags, TDBF_PFSYNC);
}
sc->sc_len = PFSYNC_MINPKT;
offset += sizeof(*subh);
count = 0;
- TAILQ_FOREACH(t, &sc->sc_tdb_q, tdb_sync_entry) {
+ while ((t = TAILQ_FIRST(&sc->sc_tdb_q)) != NULL) {
+ TAILQ_REMOVE(&sc->sc_tdb_q, t, tdb_sync_entry);
pfsync_out_tdb(t, m->m_data + offset);
offset += sizeof(struct pfsync_tdb);
CLR(t->tdb_flags, TDBF_PFSYNC);
-
count++;
}
- TAILQ_INIT(&sc->sc_tdb_q);
bzero(subh, sizeof(*subh));
subh->action = PFSYNC_ACT_TDB;
offset += sizeof(*subh);
count = 0;
- TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) {
+ while ((st = TAILQ_FIRST(&sc->sc_qs[q])) != NULL) {
+ TAILQ_REMOVE(&sc->sc_qs[q], st, sync_list);
#ifdef PFSYNC_DEBUG
KASSERT(st->sync_state == q);
#endif
st->sync_state = PFSYNC_S_NONE;
count++;
}
- TAILQ_INIT(&sc->sc_qs[q]);
bzero(subh, sizeof(*subh));
subh->action = pfsync_qs[q].action;