| 1954 | } |
| 1955 | |
| 1956 | static void |
| 1957 | pfr_destroy_ktable(struct pfr_ktable *kt, int flushaddr) |
| 1958 | { |
| 1959 | struct pfr_kentryworkq addrq; |
| 1960 | int pfr_dir, pfr_op; |
| 1961 | |
| 1962 | if (flushaddr) { |
| 1963 | pfr_enqueue_addrs(kt, &addrq, NULL, 0); |
| 1964 | pfr_clean_node_mask(kt, &addrq); |
| 1965 | pfr_destroy_kentries(&addrq); |
| 1966 | } |
| 1967 | if (kt->pfrkt_ip4 != NULL) |
| 1968 | rn_detachhead((void **)&kt->pfrkt_ip4); |
| 1969 | if (kt->pfrkt_ip6 != NULL) |
| 1970 | rn_detachhead((void **)&kt->pfrkt_ip6); |
| 1971 | if (kt->pfrkt_shadow != NULL) |
| 1972 | pfr_destroy_ktable(kt->pfrkt_shadow, flushaddr); |
| 1973 | if (kt->pfrkt_rs != NULL) { |
| 1974 | kt->pfrkt_rs->tables--; |
| 1975 | pf_remove_if_empty_kruleset(kt->pfrkt_rs); |
| 1976 | } |
| 1977 | for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { |
| 1978 | for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { |
| 1979 | counter_u64_free(kt->pfrkt_packets[pfr_dir][pfr_op]); |
| 1980 | counter_u64_free(kt->pfrkt_bytes[pfr_dir][pfr_op]); |
| 1981 | } |
| 1982 | } |
| 1983 | counter_u64_free(kt->pfrkt_match); |
| 1984 | counter_u64_free(kt->pfrkt_nomatch); |
| 1985 | |
| 1986 | free(kt, M_PFTABLE); |
| 1987 | } |
| 1988 | |
| 1989 | static int |
| 1990 | pfr_ktable_compare(struct pfr_ktable *p, struct pfr_ktable *q) |
no test coverage detected