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

Function pfr_clr_tables

freebsd/netpfil/pf/pf_table.c:1120–1150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1118}
1119
1120int
1121pfr_clr_tables(struct pfr_table *filter, int *ndel, int flags)
1122{
1123 struct pfr_ktableworkq workq;
1124 struct pfr_ktable *p;
1125 int xdel = 0;
1126
1127 ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY | PFR_FLAG_ALLRSETS);
1128 if (pfr_fix_anchor(filter->pfrt_anchor))
1129 return (EINVAL);
1130 if (pfr_table_count(filter, flags) < 0)
1131 return (ENOENT);
1132
1133 SLIST_INIT(&workq);
1134 RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) {
1135 if (pfr_skip_table(filter, p, flags))
1136 continue;
1137 if (!strcmp(p->pfrkt_anchor, PF_RESERVED_ANCHOR))
1138 continue;
1139 if (!(p->pfrkt_flags & PFR_TFLAG_ACTIVE))
1140 continue;
1141 p->pfrkt_nflags = p->pfrkt_flags & ~PFR_TFLAG_ACTIVE;
1142 SLIST_INSERT_HEAD(&workq, p, pfrkt_workq);
1143 xdel++;
1144 }
1145 if (!(flags & PFR_FLAG_DUMMY))
1146 pfr_setflags_ktables(&workq);
1147 if (ndel != NULL)
1148 *ndel = xdel;
1149 return (0);
1150}
1151
1152int
1153pfr_add_tables(struct pfr_table *tbl, int size, int *nadd, int flags)

Callers 2

pfioctlFunction · 0.85
pf_clear_tablesFunction · 0.85

Calls 5

pfr_fix_anchorFunction · 0.85
pfr_table_countFunction · 0.85
pfr_skip_tableFunction · 0.85
strcmpFunction · 0.85
pfr_setflags_ktablesFunction · 0.85

Tested by

no test coverage detected