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

Function pfr_get_tables

freebsd/netpfil/pf/pf_table.c:1263–1294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1261}
1262
1263int
1264pfr_get_tables(struct pfr_table *filter, struct pfr_table *tbl, int *size,
1265 int flags)
1266{
1267 struct pfr_ktable *p;
1268 int n, nn;
1269
1270 PF_RULES_RASSERT();
1271
1272 ACCEPT_FLAGS(flags, PFR_FLAG_ALLRSETS);
1273 if (pfr_fix_anchor(filter->pfrt_anchor))
1274 return (EINVAL);
1275 n = nn = pfr_table_count(filter, flags);
1276 if (n < 0)
1277 return (ENOENT);
1278 if (n > *size) {
1279 *size = n;
1280 return (0);
1281 }
1282 RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) {
1283 if (pfr_skip_table(filter, p, flags))
1284 continue;
1285 if (n-- <= 0)
1286 continue;
1287 bcopy(&p->pfrkt_t, tbl++, sizeof(*tbl));
1288 }
1289
1290 KASSERT(n == 0, ("%s: corruption detected (%d)", __func__, n));
1291
1292 *size = nn;
1293 return (0);
1294}
1295
1296int
1297pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size,

Callers 1

pfioctlFunction · 0.85

Calls 3

pfr_fix_anchorFunction · 0.85
pfr_table_countFunction · 0.85
pfr_skip_tableFunction · 0.85

Tested by

no test coverage detected