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

Function pfsync_update_state_req

freebsd/netpfil/pf/if_pfsync.c:1973–2018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1971}
1972
1973static bool
1974pfsync_update_state_req(struct pf_state *st)
1975{
1976 struct pfsync_softc *sc = V_pfsyncif;
1977 bool ref = true, full = false;
1978 struct pfsync_bucket *b = pfsync_get_bucket(sc, st);
1979
1980 PF_STATE_LOCK_ASSERT(st);
1981 PFSYNC_BUCKET_LOCK(b);
1982
1983 if (st->state_flags & PFSTATE_NOSYNC) {
1984 if (st->sync_state != PFSYNC_S_NONE)
1985 pfsync_q_del(st, true, b);
1986 PFSYNC_BUCKET_UNLOCK(b);
1987 return (full);
1988 }
1989
1990 switch (st->sync_state) {
1991 case PFSYNC_S_UPD_C:
1992 case PFSYNC_S_IACK:
1993 pfsync_q_del(st, false, b);
1994 ref = false;
1995 /* FALLTHROUGH */
1996
1997 case PFSYNC_S_NONE:
1998 pfsync_q_ins(st, PFSYNC_S_UPD, ref);
1999 pfsync_push(b);
2000 break;
2001
2002 case PFSYNC_S_INS:
2003 case PFSYNC_S_UPD:
2004 case PFSYNC_S_DEL:
2005 /* we're already handling it */
2006 break;
2007
2008 default:
2009 panic("%s: unexpected sync state %d", __func__, st->sync_state);
2010 }
2011
2012 if ((sc->sc_ifp->if_mtu - b->b_len) < sizeof(struct pfsync_state))
2013 full = true;
2014
2015 PFSYNC_BUCKET_UNLOCK(b);
2016
2017 return (full);
2018}
2019
2020static void
2021pfsync_delete_state(struct pf_state *st)

Callers 2

pfsync_in_ureqFunction · 0.85
pfsync_bulk_updateFunction · 0.85

Calls 5

pfsync_get_bucketFunction · 0.85
pfsync_q_delFunction · 0.85
pfsync_q_insFunction · 0.85
pfsync_pushFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected