| 222 | } |
| 223 | |
| 224 | int |
| 225 | pfr_clr_addrs(struct pfr_table *tbl, int *ndel, int flags) |
| 226 | { |
| 227 | struct pfr_ktable *kt; |
| 228 | struct pfr_kentryworkq workq; |
| 229 | |
| 230 | PF_RULES_WASSERT(); |
| 231 | |
| 232 | ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY); |
| 233 | if (pfr_validate_table(tbl, 0, flags & PFR_FLAG_USERIOCTL)) |
| 234 | return (EINVAL); |
| 235 | kt = pfr_lookup_table(tbl); |
| 236 | if (kt == NULL || !(kt->pfrkt_flags & PFR_TFLAG_ACTIVE)) |
| 237 | return (ESRCH); |
| 238 | if (kt->pfrkt_flags & PFR_TFLAG_CONST) |
| 239 | return (EPERM); |
| 240 | pfr_enqueue_addrs(kt, &workq, ndel, 0); |
| 241 | |
| 242 | if (!(flags & PFR_FLAG_DUMMY)) { |
| 243 | pfr_remove_kentries(kt, &workq); |
| 244 | KASSERT(kt->pfrkt_cnt == 0, ("%s: non-null pfrkt_cnt", __func__)); |
| 245 | } |
| 246 | return (0); |
| 247 | } |
| 248 | |
| 249 | int |
| 250 | pfr_add_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size, |
no test coverage detected