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

Function pf_clear_srcnodes

freebsd/netpfil/pf/pf_ioctl.c:4326–4362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4324}
4325
4326static void
4327pf_clear_srcnodes(struct pf_ksrc_node *n)
4328{
4329 struct pf_state *s;
4330 int i;
4331
4332 for (i = 0; i <= pf_hashmask; i++) {
4333 struct pf_idhash *ih = &V_pf_idhash[i];
4334
4335 PF_HASHROW_LOCK(ih);
4336 LIST_FOREACH(s, &ih->states, entry) {
4337 if (n == NULL || n == s->src_node)
4338 s->src_node = NULL;
4339 if (n == NULL || n == s->nat_src_node)
4340 s->nat_src_node = NULL;
4341 }
4342 PF_HASHROW_UNLOCK(ih);
4343 }
4344
4345 if (n == NULL) {
4346 struct pf_srchash *sh;
4347
4348 for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask;
4349 i++, sh++) {
4350 PF_HASHROW_LOCK(sh);
4351 LIST_FOREACH(n, &sh->nodes, entry) {
4352 n->expire = 1;
4353 n->states = 0;
4354 }
4355 PF_HASHROW_UNLOCK(sh);
4356 }
4357 } else {
4358 /* XXX: hash slot should already be locked here. */
4359 n->expire = 1;
4360 n->states = 0;
4361 }
4362}
4363
4364static void
4365pf_kill_srcnodes(struct pfioc_src_node_kill *psnk)

Callers 2

pfioctlFunction · 0.85
shutdown_pfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected