| 1261 | } |
| 1262 | |
| 1263 | int |
| 1264 | pfr_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 | |
| 1296 | int |
| 1297 | pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size, |
no test coverage detected