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

Function pfr_ina_commit

freebsd/netpfil/pf/pf_table.c:1596–1639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1594}
1595
1596int
1597pfr_ina_commit(struct pfr_table *trs, u_int32_t ticket, int *nadd,
1598 int *nchange, int flags)
1599{
1600 struct pfr_ktable *p, *q;
1601 struct pfr_ktableworkq workq;
1602 struct pf_kruleset *rs;
1603 int xadd = 0, xchange = 0;
1604 long tzero = time_second;
1605
1606 PF_RULES_WASSERT();
1607
1608 ACCEPT_FLAGS(flags, PFR_FLAG_DUMMY);
1609 rs = pf_find_kruleset(trs->pfrt_anchor);
1610 if (rs == NULL || !rs->topen || ticket != rs->tticket)
1611 return (EBUSY);
1612
1613 SLIST_INIT(&workq);
1614 RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) {
1615 if (!(p->pfrkt_flags & PFR_TFLAG_INACTIVE) ||
1616 pfr_skip_table(trs, p, 0))
1617 continue;
1618 SLIST_INSERT_HEAD(&workq, p, pfrkt_workq);
1619 if (p->pfrkt_flags & PFR_TFLAG_ACTIVE)
1620 xchange++;
1621 else
1622 xadd++;
1623 }
1624
1625 if (!(flags & PFR_FLAG_DUMMY)) {
1626 for (p = SLIST_FIRST(&workq); p != NULL; p = q) {
1627 q = SLIST_NEXT(p, pfrkt_workq);
1628 pfr_commit_ktable(p, tzero);
1629 }
1630 rs->topen = 0;
1631 pf_remove_if_empty_kruleset(rs);
1632 }
1633 if (nadd != NULL)
1634 *nadd = xadd;
1635 if (nchange != NULL)
1636 *nchange = xchange;
1637
1638 return (0);
1639}
1640
1641static void
1642pfr_commit_ktable(struct pfr_ktable *kt, long tzero)

Callers 1

pfioctlFunction · 0.85

Calls 4

pf_find_krulesetFunction · 0.85
pfr_skip_tableFunction · 0.85
pfr_commit_ktableFunction · 0.85

Tested by

no test coverage detected