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

Function pfi_kkif_attach

freebsd/netpfil/pf/pf_if.c:298–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298struct pfi_kkif *
299pfi_kkif_attach(struct pfi_kkif *kif, const char *kif_name)
300{
301 struct pfi_kkif *kif1;
302
303 PF_RULES_WASSERT();
304 KASSERT(kif != NULL, ("%s: null kif", __func__));
305
306 kif1 = pfi_kkif_find(kif_name);
307 if (kif1 != NULL) {
308 pf_kkif_free(kif);
309 return (kif1);
310 }
311
312 pf_kkif_zero(kif);
313 strlcpy(kif->pfik_name, kif_name, sizeof(kif->pfik_name));
314 /*
315 * It seems that the value of time_second is in unintialzied state
316 * when pf sets interface statistics clear time in boot phase if pf
317 * was statically linked to kernel. Instead of setting the bogus
318 * time value have pfi_get_ifaces handle this case. In
319 * pfi_get_ifaces it uses time_second if it sees the time is 0.
320 */
321 kif->pfik_tzero = time_second > 1 ? time_second : 0;
322 TAILQ_INIT(&kif->pfik_dynaddrs);
323
324 RB_INSERT(pfi_ifhead, &V_pfi_ifs, kif);
325
326 return (kif);
327}
328
329void
330pfi_kkif_ref(struct pfi_kkif *kif)

Callers 7

pfi_initialize_vnetFunction · 0.85
pfi_attach_ifnetFunction · 0.85
pfi_attach_ifgroupFunction · 0.85
pfi_dynaddr_setupFunction · 0.85
pfi_set_flagsFunction · 0.85
pfi_change_group_eventFunction · 0.85
pfioctlFunction · 0.85

Calls 4

pfi_kkif_findFunction · 0.85
pf_kkif_freeFunction · 0.85
pf_kkif_zeroFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected