| 296 | } |
| 297 | |
| 298 | struct pfi_kkif * |
| 299 | pfi_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 | |
| 329 | void |
| 330 | pfi_kkif_ref(struct pfi_kkif *kif) |
no test coverage detected