kt 1104 net/pf.c struct pfr_ktable *kt = aw->p.tbl;
kt 1106 net/pf.c if (aw->type != PF_ADDR_TABLE || kt == NULL)
kt 1108 net/pf.c if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE) && kt->pfrkt_root != NULL)
kt 1109 net/pf.c kt = kt->pfrkt_root;
kt 1111 net/pf.c aw->p.tblcnt = (kt->pfrkt_flags & PFR_TFLAG_ACTIVE) ?
kt 1112 net/pf.c kt->pfrkt_cnt : -1;
kt 418 net/pf_if.c struct pfr_ktable *kt;
kt 424 net/pf_if.c kt = dyn->pfid_kt;
kt 426 net/pf_if.c if (kt->pfrkt_larg != pfi_update) {
kt 428 net/pf_if.c pfi_table_update(kt, kif, dyn->pfid_net, dyn->pfid_iflags);
kt 429 net/pf_if.c kt->pfrkt_larg = pfi_update;
kt 431 net/pf_if.c pfr_dynaddr_update(kt, dyn);
kt 435 net/pf_if.c pfi_table_update(struct pfr_ktable *kt, struct pfi_kif *kif, int net, int flags)
kt 448 net/pf_if.c if ((e = pfr_set_addrs(&kt->pfrkt_t, pfi_buffer, pfi_buffer_cnt, &size2,
kt 451 net/pf_if.c "into table %s: %d\n", pfi_buffer_cnt, kt->pfrkt_name, e);
kt 209 net/pf_table.c struct pfr_ktable *kt;
kt 216 net/pf_table.c kt = pfr_lookup_table(tbl);
kt 217 net/pf_table.c if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 219 net/pf_table.c if (kt->pfrkt_flags & PFR_TFLAG_CONST)
kt 221 net/pf_table.c pfr_enqueue_addrs(kt, &workq, ndel, 0);
kt 226 net/pf_table.c pfr_remove_kentries(kt, &workq);
kt 229 net/pf_table.c if (kt->pfrkt_cnt) {
kt 231 net/pf_table.c kt->pfrkt_cnt);
kt 232 net/pf_table.c kt->pfrkt_cnt = 0;
kt 242 net/pf_table.c struct pfr_ktable *kt, *tmpkt;
kt 253 net/pf_table.c kt = pfr_lookup_table(tbl);
kt 254 net/pf_table.c if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 256 net/pf_table.c if (kt->pfrkt_flags & PFR_TFLAG_CONST)
kt 267 net/pf_table.c p = pfr_lookup_addr(kt, &ad, 1);
kt 300 net/pf_table.c pfr_insert_kentries(kt, &workq, tzero);
kt 322 net/pf_table.c struct pfr_ktable *kt;
kt 332 net/pf_table.c kt = pfr_lookup_table(tbl);
kt 333 net/pf_table.c if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 335 net/pf_table.c if (kt->pfrkt_flags & PFR_TFLAG_CONST)
kt 348 net/pf_table.c for (i = kt->pfrkt_cnt; i > 0; i >>= 1)
kt 350 net/pf_table.c if (size > kt->pfrkt_cnt/log) {
kt 352 net/pf_table.c pfr_mark_addrs(kt);
kt 360 net/pf_table.c p = pfr_lookup_addr(kt, &ad, 1);
kt 371 net/pf_table.c p = pfr_lookup_addr(kt, &ad, 1);
kt 395 net/pf_table.c pfr_remove_kentries(kt, &workq);
kt 413 net/pf_table.c struct pfr_ktable *kt, *tmpkt;
kt 425 net/pf_table.c kt = pfr_lookup_table(tbl);
kt 426 net/pf_table.c if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 428 net/pf_table.c if (kt->pfrkt_flags & PFR_TFLAG_CONST)
kt 433 net/pf_table.c pfr_mark_addrs(kt);
kt 443 net/pf_table.c p = pfr_lookup_addr(kt, &ad, 1);
kt 479 net/pf_table.c pfr_enqueue_addrs(kt, &delq, &xdel, ENQUEUE_UNMARKED_ONLY);
kt 498 net/pf_table.c pfr_insert_kentries(kt, &addq, tzero);
kt 499 net/pf_table.c pfr_remove_kentries(kt, &delq);
kt 528 net/pf_table.c struct pfr_ktable *kt;
kt 536 net/pf_table.c kt = pfr_lookup_table(tbl);
kt 537 net/pf_table.c if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 547 net/pf_table.c p = pfr_lookup_addr(kt, &ad, 0);
kt 566 net/pf_table.c struct pfr_ktable *kt;
kt 573 net/pf_table.c kt = pfr_lookup_table(tbl);
kt 574 net/pf_table.c if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 576 net/pf_table.c if (kt->pfrkt_cnt > *size) {
kt 577 net/pf_table.c *size = kt->pfrkt_cnt;
kt 584 net/pf_table.c w.pfrw_free = kt->pfrkt_cnt;
kt 586 net/pf_table.c rv = rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
kt 588 net/pf_table.c rv = rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
kt 597 net/pf_table.c *size = kt->pfrkt_cnt;
kt 605 net/pf_table.c struct pfr_ktable *kt;
kt 615 net/pf_table.c kt = pfr_lookup_table(tbl);
kt 616 net/pf_table.c if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 618 net/pf_table.c if (kt->pfrkt_cnt > *size) {
kt 619 net/pf_table.c *size = kt->pfrkt_cnt;
kt 626 net/pf_table.c w.pfrw_free = kt->pfrkt_cnt;
kt 630 net/pf_table.c rv = rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
kt 632 net/pf_table.c rv = rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
kt 634 net/pf_table.c pfr_enqueue_addrs(kt, &workq, NULL, 0);
kt 647 net/pf_table.c *size = kt->pfrkt_cnt;
kt 655 net/pf_table.c struct pfr_ktable *kt;
kt 665 net/pf_table.c kt = pfr_lookup_table(tbl);
kt 666 net/pf_table.c if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 674 net/pf_table.c p = pfr_lookup_addr(kt, &ad, 1);
kt 738 net/pf_table.c pfr_enqueue_addrs(struct pfr_ktable *kt, struct pfr_kentryworkq *workq,
kt 747 net/pf_table.c if (kt->pfrkt_ip4 != NULL)
kt 748 net/pf_table.c if (rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w))
kt 750 net/pf_table.c if (kt->pfrkt_ip6 != NULL)
kt 751 net/pf_table.c if (rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w))
kt 758 net/pf_table.c pfr_mark_addrs(struct pfr_ktable *kt)
kt 764 net/pf_table.c if (rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w))
kt 766 net/pf_table.c if (rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w))
kt 772 net/pf_table.c pfr_lookup_addr(struct pfr_ktable *kt, struct pfr_addr *ad, int exact)
kt 782 net/pf_table.c head = kt->pfrkt_ip4;
kt 785 net/pf_table.c head = kt->pfrkt_ip6;
kt 849 net/pf_table.c pfr_insert_kentries(struct pfr_ktable *kt,
kt 856 net/pf_table.c rv = pfr_route_kentry(kt, p);
kt 865 net/pf_table.c kt->pfrkt_cnt += n;
kt 869 net/pf_table.c pfr_insert_kentry(struct pfr_ktable *kt, struct pfr_addr *ad, long tzero)
kt 874 net/pf_table.c p = pfr_lookup_addr(kt, ad, 1);
kt 881 net/pf_table.c rv = pfr_route_kentry(kt, p);
kt 886 net/pf_table.c kt->pfrkt_cnt++;
kt 892 net/pf_table.c pfr_remove_kentries(struct pfr_ktable *kt,
kt 899 net/pf_table.c pfr_unroute_kentry(kt, p);
kt 902 net/pf_table.c kt->pfrkt_cnt -= n;
kt 907 net/pf_table.c pfr_clean_node_mask(struct pfr_ktable *kt,
kt 913 net/pf_table.c pfr_unroute_kentry(kt, p);
kt 974 net/pf_table.c pfr_route_kentry(struct pfr_ktable *kt, struct pfr_kentry *ke)
kt 983 net/pf_table.c head = kt->pfrkt_ip4;
kt 985 net/pf_table.c head = kt->pfrkt_ip6;
kt 999 net/pf_table.c pfr_unroute_kentry(struct pfr_ktable *kt, struct pfr_kentry *ke)
kt 1007 net/pf_table.c head = kt->pfrkt_ip4;
kt 1009 net/pf_table.c head = kt->pfrkt_ip6;
kt 1489 net/pf_table.c struct pfr_ktable *kt, *rt, *shadow, key;
kt 1506 net/pf_table.c kt = RB_FIND(pfr_ktablehead, &pfr_ktables, (struct pfr_ktable *)tbl);
kt 1507 net/pf_table.c if (kt == NULL) {
kt 1508 net/pf_table.c kt = pfr_create_ktable(tbl, 0, 1);
kt 1509 net/pf_table.c if (kt == NULL)
kt 1511 net/pf_table.c SLIST_INSERT_HEAD(&tableq, kt, pfrkt_workq);
kt 1521 net/pf_table.c kt->pfrkt_root = rt;
kt 1530 net/pf_table.c kt->pfrkt_root = rt;
kt 1531 net/pf_table.c } else if (!(kt->pfrkt_flags & PFR_TFLAG_INACTIVE))
kt 1558 net/pf_table.c if (kt->pfrkt_shadow != NULL)
kt 1559 net/pf_table.c pfr_destroy_ktable(kt->pfrkt_shadow, 1);
kt 1560 net/pf_table.c kt->pfrkt_flags |= PFR_TFLAG_INACTIVE;
kt 1564 net/pf_table.c kt->pfrkt_shadow = shadow;
kt 1662 net/pf_table.c pfr_commit_ktable(struct pfr_ktable *kt, long tzero)
kt 1664 net/pf_table.c struct pfr_ktable *shadow = kt->pfrkt_shadow;
kt 1668 net/pf_table.c if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 1669 net/pf_table.c pfr_clstats_ktable(kt, tzero, 1);
kt 1670 net/pf_table.c } else if (kt->pfrkt_flags & PFR_TFLAG_ACTIVE) {
kt 1677 net/pf_table.c pfr_mark_addrs(kt);
kt 1686 net/pf_table.c q = pfr_lookup_addr(kt, &ad, 1);
kt 1698 net/pf_table.c pfr_enqueue_addrs(kt, &delq, NULL, ENQUEUE_UNMARKED_ONLY);
kt 1699 net/pf_table.c pfr_insert_kentries(kt, &addq, tzero);
kt 1700 net/pf_table.c pfr_remove_kentries(kt, &delq);
kt 1705 net/pf_table.c SWAP(struct radix_node_head *, kt->pfrkt_ip4,
kt 1707 net/pf_table.c SWAP(struct radix_node_head *, kt->pfrkt_ip6,
kt 1709 net/pf_table.c SWAP(int, kt->pfrkt_cnt, shadow->pfrkt_cnt);
kt 1710 net/pf_table.c pfr_clstats_ktable(kt, tzero, 1);
kt 1713 net/pf_table.c (kt->pfrkt_flags & PFR_TFLAG_SETMASK) | PFR_TFLAG_ACTIVE)
kt 1716 net/pf_table.c kt->pfrkt_shadow = NULL;
kt 1717 net/pf_table.c pfr_setflags_ktable(kt, nflags);
kt 1785 net/pf_table.c pfr_skip_table(struct pfr_table *filter, struct pfr_ktable *kt, int flags)
kt 1789 net/pf_table.c if (strcmp(filter->pfrt_anchor, kt->pfrkt_anchor))
kt 1804 net/pf_table.c pfr_insert_ktable(struct pfr_ktable *kt)
kt 1806 net/pf_table.c RB_INSERT(pfr_ktablehead, &pfr_ktables, kt);
kt 1808 net/pf_table.c if (kt->pfrkt_root != NULL)
kt 1809 net/pf_table.c if (!kt->pfrkt_root->pfrkt_refcnt[PFR_REFCNT_ANCHOR]++)
kt 1810 net/pf_table.c pfr_setflags_ktable(kt->pfrkt_root,
kt 1811 net/pf_table.c kt->pfrkt_root->pfrkt_flags|PFR_TFLAG_REFDANCHOR);
kt 1826 net/pf_table.c pfr_setflags_ktable(struct pfr_ktable *kt, int newf)
kt 1836 net/pf_table.c RB_REMOVE(pfr_ktablehead, &pfr_ktables, kt);
kt 1837 net/pf_table.c if (kt->pfrkt_root != NULL)
kt 1838 net/pf_table.c if (!--kt->pfrkt_root->pfrkt_refcnt[PFR_REFCNT_ANCHOR])
kt 1839 net/pf_table.c pfr_setflags_ktable(kt->pfrkt_root,
kt 1840 net/pf_table.c kt->pfrkt_root->pfrkt_flags &
kt 1842 net/pf_table.c pfr_destroy_ktable(kt, 1);
kt 1846 net/pf_table.c if (!(newf & PFR_TFLAG_ACTIVE) && kt->pfrkt_cnt) {
kt 1847 net/pf_table.c pfr_enqueue_addrs(kt, &addrq, NULL, 0);
kt 1848 net/pf_table.c pfr_remove_kentries(kt, &addrq);
kt 1850 net/pf_table.c if (!(newf & PFR_TFLAG_INACTIVE) && kt->pfrkt_shadow != NULL) {
kt 1851 net/pf_table.c pfr_destroy_ktable(kt->pfrkt_shadow, 1);
kt 1852 net/pf_table.c kt->pfrkt_shadow = NULL;
kt 1854 net/pf_table.c kt->pfrkt_flags = newf;
kt 1867 net/pf_table.c pfr_clstats_ktable(struct pfr_ktable *kt, long tzero, int recurse)
kt 1873 net/pf_table.c pfr_enqueue_addrs(kt, &addrq, NULL, 0);
kt 1877 net/pf_table.c bzero(kt->pfrkt_packets, sizeof(kt->pfrkt_packets));
kt 1878 net/pf_table.c bzero(kt->pfrkt_bytes, sizeof(kt->pfrkt_bytes));
kt 1879 net/pf_table.c kt->pfrkt_match = kt->pfrkt_nomatch = 0;
kt 1881 net/pf_table.c kt->pfrkt_tzero = tzero;
kt 1887 net/pf_table.c struct pfr_ktable *kt;
kt 1890 net/pf_table.c kt = pool_get(&pfr_ktable_pl, PR_NOWAIT);
kt 1891 net/pf_table.c if (kt == NULL)
kt 1893 net/pf_table.c bzero(kt, sizeof(*kt));
kt 1894 net/pf_table.c kt->pfrkt_t = *tbl;
kt 1899 net/pf_table.c pfr_destroy_ktable(kt, 0);
kt 1902 net/pf_table.c kt->pfrkt_rs = rs;
kt 1906 net/pf_table.c if (!rn_inithead((void **)&kt->pfrkt_ip4,
kt 1908 net/pf_table.c !rn_inithead((void **)&kt->pfrkt_ip6,
kt 1910 net/pf_table.c pfr_destroy_ktable(kt, 0);
kt 1913 net/pf_table.c kt->pfrkt_tzero = tzero;
kt 1915 net/pf_table.c return (kt);
kt 1930 net/pf_table.c pfr_destroy_ktable(struct pfr_ktable *kt, int flushaddr)
kt 1935 net/pf_table.c pfr_enqueue_addrs(kt, &addrq, NULL, 0);
kt 1936 net/pf_table.c pfr_clean_node_mask(kt, &addrq);
kt 1939 net/pf_table.c if (kt->pfrkt_ip4 != NULL)
kt 1940 net/pf_table.c free((caddr_t)kt->pfrkt_ip4, M_RTABLE);
kt 1941 net/pf_table.c if (kt->pfrkt_ip6 != NULL)
kt 1942 net/pf_table.c free((caddr_t)kt->pfrkt_ip6, M_RTABLE);
kt 1943 net/pf_table.c if (kt->pfrkt_shadow != NULL)
kt 1944 net/pf_table.c pfr_destroy_ktable(kt->pfrkt_shadow, flushaddr);
kt 1945 net/pf_table.c if (kt->pfrkt_rs != NULL) {
kt 1946 net/pf_table.c kt->pfrkt_rs->tables--;
kt 1947 net/pf_table.c pf_remove_if_empty_ruleset(kt->pfrkt_rs);
kt 1949 net/pf_table.c pool_put(&pfr_ktable_pl, kt);
kt 1971 net/pf_table.c pfr_match_addr(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af)
kt 1976 net/pf_table.c if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE) && kt->pfrkt_root != NULL)
kt 1977 net/pf_table.c kt = kt->pfrkt_root;
kt 1978 net/pf_table.c if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 1985 net/pf_table.c ke = (struct pfr_kentry *)rn_match(&pfr_sin, kt->pfrkt_ip4);
kt 1993 net/pf_table.c ke = (struct pfr_kentry *)rn_match(&pfr_sin6, kt->pfrkt_ip6);
kt 2001 net/pf_table.c kt->pfrkt_match++;
kt 2003 net/pf_table.c kt->pfrkt_nomatch++;
kt 2008 net/pf_table.c pfr_update_stats(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af,
kt 2013 net/pf_table.c if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE) && kt->pfrkt_root != NULL)
kt 2014 net/pf_table.c kt = kt->pfrkt_root;
kt 2015 net/pf_table.c if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 2022 net/pf_table.c ke = (struct pfr_kentry *)rn_match(&pfr_sin, kt->pfrkt_ip4);
kt 2030 net/pf_table.c ke = (struct pfr_kentry *)rn_match(&pfr_sin6, kt->pfrkt_ip6);
kt 2043 net/pf_table.c kt->pfrkt_packets[dir_out][op_pass]++;
kt 2044 net/pf_table.c kt->pfrkt_bytes[dir_out][op_pass] += len;
kt 2054 net/pf_table.c struct pfr_ktable *kt, *rt;
kt 2062 net/pf_table.c kt = pfr_lookup_table(&tbl);
kt 2063 net/pf_table.c if (kt == NULL) {
kt 2064 net/pf_table.c kt = pfr_create_ktable(&tbl, time_second, 1);
kt 2065 net/pf_table.c if (kt == NULL)
kt 2073 net/pf_table.c pfr_destroy_ktable(kt, 0);
kt 2078 net/pf_table.c kt->pfrkt_root = rt;
kt 2080 net/pf_table.c pfr_insert_ktable(kt);
kt 2082 net/pf_table.c if (!kt->pfrkt_refcnt[PFR_REFCNT_RULE]++)
kt 2083 net/pf_table.c pfr_setflags_ktable(kt, kt->pfrkt_flags|PFR_TFLAG_REFERENCED);
kt 2084 net/pf_table.c return (kt);
kt 2088 net/pf_table.c pfr_detach_table(struct pfr_ktable *kt)
kt 2090 net/pf_table.c if (kt->pfrkt_refcnt[PFR_REFCNT_RULE] <= 0)
kt 2092 net/pf_table.c kt->pfrkt_refcnt[PFR_REFCNT_RULE]);
kt 2093 net/pf_table.c else if (!--kt->pfrkt_refcnt[PFR_REFCNT_RULE])
kt 2094 net/pf_table.c pfr_setflags_ktable(kt, kt->pfrkt_flags&~PFR_TFLAG_REFERENCED);
kt 2098 net/pf_table.c pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter,
kt 2110 net/pf_table.c if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE) && kt->pfrkt_root != NULL)
kt 2111 net/pf_table.c kt = kt->pfrkt_root;
kt 2112 net/pf_table.c if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
kt 2123 net/pf_table.c ke = pfr_kentry_byidx(kt, idx, af);
kt 2154 net/pf_table.c kt->pfrkt_ip4);
kt 2157 net/pf_table.c kt->pfrkt_ip6);
kt 2181 net/pf_table.c pfr_kentry_byidx(struct pfr_ktable *kt, int idx, int af)
kt 2192 net/pf_table.c rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
kt 2197 net/pf_table.c rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w);
kt 2206 net/pf_table.c pfr_dynaddr_update(struct pfr_ktable *kt, struct pfi_dynaddr *dyn)
kt 2219 net/pf_table.c rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w);
kt 2221 net/pf_table.c rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w);