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

Function pfr_ina_rollback

freebsd/netpfil/pf/pf_table.c:1563–1594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1561}
1562
1563int
1564pfr_ina_rollback(struct pfr_table *trs, u_int32_t ticket, int *ndel, int flags)
1565{
1566 struct pfr_ktableworkq workq;
1567 struct pfr_ktable *p;
1568 struct pf_kruleset *rs;
1569 int xdel = 0;
1570
1571 PF_RULES_WASSERT();
1572
1573 ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY);
1574 rs = pf_find_kruleset(trs->pfrt_anchor);
1575 if (rs == NULL || !rs->topen || ticket != rs->tticket)
1576 return (0);
1577 SLIST_INIT(&workq);
1578 RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) {
1579 if (!(p->pfrkt_flags & PFR_TFLAG_INACTIVE) ||
1580 pfr_skip_table(trs, p, 0))
1581 continue;
1582 p->pfrkt_nflags = p->pfrkt_flags & ~PFR_TFLAG_INACTIVE;
1583 SLIST_INSERT_HEAD(&workq, p, pfrkt_workq);
1584 xdel++;
1585 }
1586 if (!(flags & PFR_FLAG_DUMMY)) {
1587 pfr_setflags_ktables(&workq);
1588 rs->topen = 0;
1589 pf_remove_if_empty_kruleset(rs);
1590 }
1591 if (ndel != NULL)
1592 *ndel = xdel;
1593 return (0);
1594}
1595
1596int
1597pfr_ina_commit(struct pfr_table *trs, u_int32_t ticket, int *nadd,

Callers 1

pfioctlFunction · 0.85

Calls 4

pf_find_krulesetFunction · 0.85
pfr_skip_tableFunction · 0.85
pfr_setflags_ktablesFunction · 0.85

Tested by

no test coverage detected