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

Function pf_begin_rules

freebsd/netpfil/pf/pf_ioctl.c:906–926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

904#endif /* ALTQ */
905
906static int
907pf_begin_rules(u_int32_t *ticket, int rs_num, const char *anchor)
908{
909 struct pf_kruleset *rs;
910 struct pf_krule *rule;
911
912 PF_RULES_WASSERT();
913
914 if (rs_num < 0 || rs_num >= PF_RULESET_MAX)
915 return (EINVAL);
916 rs = pf_find_or_create_kruleset(anchor);
917 if (rs == NULL)
918 return (EINVAL);
919 while ((rule = TAILQ_FIRST(rs->rules[rs_num].inactive.ptr)) != NULL) {
920 pf_unlink_rule(rs->rules[rs_num].inactive.ptr, rule);
921 rs->rules[rs_num].inactive.rcount--;
922 }
923 *ticket = ++rs->rules[rs_num].inactive.ticket;
924 rs->rules[rs_num].inactive.open = 1;
925 return (0);
926}
927
928static int
929pf_rollback_rules(u_int32_t ticket, int rs_num, char *anchor)

Callers 2

pfioctlFunction · 0.85
shutdown_pfFunction · 0.85

Calls 2

pf_unlink_ruleFunction · 0.85

Tested by

no test coverage detected