| 1227 | } |
| 1228 | |
| 1229 | int |
| 1230 | pfr_del_tables(struct pfr_table *tbl, int size, int *ndel, int flags) |
| 1231 | { |
| 1232 | struct pfr_ktableworkq workq; |
| 1233 | struct pfr_ktable *p, *q, key; |
| 1234 | int i, xdel = 0; |
| 1235 | |
| 1236 | ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY); |
| 1237 | SLIST_INIT(&workq); |
| 1238 | for (i = 0; i < size; i++) { |
| 1239 | bcopy(tbl+i, &key.pfrkt_t, sizeof(key.pfrkt_t)); |
| 1240 | if (pfr_validate_table(&key.pfrkt_t, 0, |
| 1241 | flags & PFR_FLAG_USERIOCTL)) |
| 1242 | return (EINVAL); |
| 1243 | p = RB_FIND(pfr_ktablehead, &V_pfr_ktables, &key); |
| 1244 | if (p != NULL && (p->pfrkt_flags & PFR_TFLAG_ACTIVE)) { |
| 1245 | SLIST_FOREACH(q, &workq, pfrkt_workq) |
| 1246 | if (!pfr_ktable_compare(p, q)) |
| 1247 | goto _skip; |
| 1248 | p->pfrkt_nflags = p->pfrkt_flags & ~PFR_TFLAG_ACTIVE; |
| 1249 | SLIST_INSERT_HEAD(&workq, p, pfrkt_workq); |
| 1250 | xdel++; |
| 1251 | } |
| 1252 | _skip: |
| 1253 | ; |
| 1254 | } |
| 1255 | |
| 1256 | if (!(flags & PFR_FLAG_DUMMY)) |
| 1257 | pfr_setflags_ktables(&workq); |
| 1258 | if (ndel != NULL) |
| 1259 | *ndel = xdel; |
| 1260 | return (0); |
| 1261 | } |
| 1262 | |
| 1263 | int |
| 1264 | pfr_get_tables(struct pfr_table *filter, struct pfr_table *tbl, int *size, |
no test coverage detected