Skip to content

Commit 343ace4

Browse files
committed
pfctl: parser must not ignore error from pfctl_optimize_ruleset()
Ignoring the error may cause pfctl(8) to load inconsistent ruleset preventing pf(4) to enforce desired policy. Issue reported and fix suggested by berts _from_ fastmail _dot_ com 'Looks good.' @deraadt MFC after: 1 week Obtained from: OpenBSD, sashan <sashan@openbsd.org>, 9fd28a8cca Sponsored by: Rubicon Communications, LLC ("Netgate")
1 parent 0b0d34f commit 343ace4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sbin/pfctl/pfctl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,8 +2513,9 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pfctl_ruleset *rs,
25132513
printf("\n");
25142514
}
25152515

2516-
if (pf->optimize && rs_num == PF_RULESET_FILTER)
2517-
pfctl_optimize_ruleset(pf, rs);
2516+
if (pf->optimize && rs_num == PF_RULESET_FILTER &&
2517+
(error = pfctl_optimize_ruleset(pf, rs)) != 0)
2518+
goto error;
25182519

25192520
while ((r = TAILQ_FIRST(rs->rules[rs_num].active.ptr)) != NULL) {
25202521
TAILQ_REMOVE(rs->rules[rs_num].active.ptr, r, entries);

0 commit comments

Comments
 (0)