Lines Matching refs:anchor
228 struct pf_anchor *__single anchor; in pf_find_ruleset() local
236 anchor = pf_find_anchor(path); in pf_find_ruleset()
237 if (anchor == NULL) { in pf_find_ruleset()
240 return &anchor->ruleset; in pf_find_ruleset()
248 struct pf_anchor *anchor; in pf_find_ruleset_with_owner() local
256 anchor = pf_find_anchor(path); in pf_find_ruleset_with_owner()
257 if (anchor == NULL) { in pf_find_ruleset_with_owner()
261 if ((owner && (!strlcmp(anchor->owner, owner, sizeof(anchor->owner)))) in pf_find_ruleset_with_owner()
262 || (is_anchor && !strlcmp(anchor->owner, "", sizeof(anchor->owner)))) { in pf_find_ruleset_with_owner()
263 return &anchor->ruleset; in pf_find_ruleset_with_owner()
265 pf_release_anchor(anchor); in pf_find_ruleset_with_owner()
266 anchor = NULL; in pf_find_ruleset_with_owner()
275 if (r->anchor == NULL) { in pf_release_ruleset()
278 return pf_release_anchor(r->anchor); in pf_release_ruleset()
314 struct pf_anchor *__single anchor = NULL, *__single dup, *__single parent = NULL; in pf_find_or_create_ruleset() local
335 parent = ruleset->anchor; in pf_find_or_create_ruleset()
359 anchor = rs_malloc_type(struct pf_anchor); in pf_find_or_create_ruleset()
360 if (anchor == NULL) { in pf_find_or_create_ruleset()
364 RB_INIT(&anchor->children); in pf_find_or_create_ruleset()
365 …strbufcpy(anchor->name, sizeof(anchor->name), q, strlen(__unsafe_null_terminated_from_indexable(q)… in pf_find_or_create_ruleset()
367 strbufcpy(anchor->path, parent->path); in pf_find_or_create_ruleset()
368 strlcat(anchor->path, "/", sizeof(anchor->path)); in pf_find_or_create_ruleset()
370 strbufcat(anchor->path, anchor->name); in pf_find_or_create_ruleset()
371 if ((dup = RB_INSERT(pf_anchor_global, &pf_anchors, anchor)) != in pf_find_or_create_ruleset()
375 anchor->path, anchor->name, dup->path, dup->name); in pf_find_or_create_ruleset()
376 rs_free_type(struct pf_anchor, anchor); in pf_find_or_create_ruleset()
382 anchor->parent = parent; in pf_find_or_create_ruleset()
384 anchor)) != NULL) { in pf_find_or_create_ruleset()
387 "'%s' '%s'\n", anchor->path, anchor->name, in pf_find_or_create_ruleset()
390 anchor); in pf_find_or_create_ruleset()
391 rs_free_type(struct pf_anchor, anchor); in pf_find_or_create_ruleset()
396 pf_init_ruleset(&anchor->ruleset); in pf_find_or_create_ruleset()
397 anchor->ruleset.anchor = anchor; in pf_find_or_create_ruleset()
398 pf_reference_anchor(anchor); in pf_find_or_create_ruleset()
399 parent = anchor; in pf_find_or_create_ruleset()
406 if (strlcmp(anchor->name, "com.apple.nlc", in pf_find_or_create_ruleset()
407 sizeof(anchor->name)) == 0) { in pf_find_or_create_ruleset()
413 return anchor ? &anchor->ruleset : 0; in pf_find_or_create_ruleset()
430 if (ruleset->anchor == NULL || ruleset->anchor->refcnt > 0) { in pf_remove_if_empty_ruleset()
433 ASSERT(RB_EMPTY(&ruleset->anchor->children) && in pf_remove_if_empty_ruleset()
441 if (ruleset == &pf_main_ruleset || ruleset->anchor == NULL || in pf_remove_if_empty_ruleset()
442 !RB_EMPTY(&ruleset->anchor->children) || in pf_remove_if_empty_ruleset()
443 ruleset->anchor->refcnt > 0 || ruleset->tables > 0 || in pf_remove_if_empty_ruleset()
454 RB_REMOVE(pf_anchor_global, &pf_anchors, ruleset->anchor); in pf_remove_if_empty_ruleset()
456 if (strlcmp(ruleset->anchor->name, "com.apple.nlc", in pf_remove_if_empty_ruleset()
457 sizeof(ruleset->anchor->name)) == 0) { in pf_remove_if_empty_ruleset()
465 if ((parent = ruleset->anchor->parent) != NULL) { in pf_remove_if_empty_ruleset()
467 ruleset->anchor); in pf_remove_if_empty_ruleset()
469 rs_free_type(struct pf_anchor, ruleset->anchor); in pf_remove_if_empty_ruleset()
484 r->anchor = NULL; in pf_anchor_setup()
496 if (s->anchor == NULL || !s->anchor->path[0]) { in pf_anchor_setup()
499 strbufcpy(path, MAXPATHLEN, s->anchor->path, sizeof(s->anchor->path)); in pf_anchor_setup()
527 if (ruleset == NULL || ruleset->anchor == NULL) { in pf_anchor_setup()
531 r->anchor = ruleset->anchor; in pf_anchor_setup()
540 if (r->anchor == NULL) { in pf_anchor_copyout()
545 strbufcat(pr->anchor_call, r->anchor->path); in pf_anchor_copyout()
551 if (rs->anchor == NULL) { in pf_anchor_copyout()
554 strbufcpy(a, MAXPATHLEN, rs->anchor->path, sizeof(rs->anchor->path)); in pf_anchor_copyout()
564 if (strbufcmp(a, strbuflen(a, MAXPATHLEN), r->anchor->path, strbuflen(a, MAXPATHLEN))) { in pf_anchor_copyout()
566 r->anchor->path); in pf_anchor_copyout()
570 if (strbuflen(r->anchor->path, sizeof(r->anchor->path)) > strbuflen(a, MAXPATHLEN)) { in pf_anchor_copyout()
572 __unsafe_null_terminated_from_indexable(r->anchor->path + (a[0] ? in pf_anchor_copyout()
587 if (r->anchor == NULL) { in pf_anchor_remove()
590 if (r->anchor->refcnt <= 0) { in pf_anchor_remove()
592 r->anchor = NULL; in pf_anchor_remove()
595 pf_release_anchor(r->anchor); in pf_anchor_remove()
596 r->anchor = NULL; in pf_anchor_remove()