MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pfsync_delete_state

Function pfsync_delete_state

freebsd/netpfil/pf/if_pfsync.c:2020–2062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2018}
2019
2020static void
2021pfsync_delete_state(struct pf_state *st)
2022{
2023 struct pfsync_softc *sc = V_pfsyncif;
2024 struct pfsync_bucket *b = pfsync_get_bucket(sc, st);
2025 bool ref = true;
2026
2027 PFSYNC_BUCKET_LOCK(b);
2028 if (st->state_flags & PFSTATE_ACK)
2029 pfsync_undefer_state(st, 1);
2030 if (st->state_flags & PFSTATE_NOSYNC) {
2031 if (st->sync_state != PFSYNC_S_NONE)
2032 pfsync_q_del(st, true, b);
2033 PFSYNC_BUCKET_UNLOCK(b);
2034 return;
2035 }
2036
2037 if (b->b_len == PFSYNC_MINPKT)
2038 callout_reset(&b->b_tmo, 1 * hz, pfsync_timeout, b);
2039
2040 switch (st->sync_state) {
2041 case PFSYNC_S_INS:
2042 /* We never got to tell the world so just forget about it. */
2043 pfsync_q_del(st, true, b);
2044 break;
2045
2046 case PFSYNC_S_UPD_C:
2047 case PFSYNC_S_UPD:
2048 case PFSYNC_S_IACK:
2049 pfsync_q_del(st, false, b);
2050 ref = false;
2051 /* FALLTHROUGH */
2052
2053 case PFSYNC_S_NONE:
2054 pfsync_q_ins(st, PFSYNC_S_DEL, ref);
2055 break;
2056
2057 default:
2058 panic("%s: unexpected sync state %d", __func__, st->sync_state);
2059 }
2060
2061 PFSYNC_BUCKET_UNLOCK(b);
2062}
2063
2064static void
2065pfsync_clear_states(u_int32_t creatorid, const char *ifname)

Callers

nothing calls this directly

Calls 5

pfsync_get_bucketFunction · 0.85
pfsync_undefer_stateFunction · 0.85
pfsync_q_delFunction · 0.85
pfsync_q_insFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected