MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pfr_del_tables

Function pfr_del_tables

freebsd/netpfil/pf/pf_table.c:1229–1261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1227}
1228
1229int
1230pfr_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
1263int
1264pfr_get_tables(struct pfr_table *filter, struct pfr_table *tbl, int *size,

Callers 1

pfioctlFunction · 0.85

Calls 3

pfr_validate_tableFunction · 0.85
pfr_ktable_compareFunction · 0.85
pfr_setflags_ktablesFunction · 0.85

Tested by

no test coverage detected