History log of /openbsd-src/sbin/pfctl/pfctl_optimize.c (Results 1 – 25 of 50)
Revision Date Author Comments
# 30269bc3 14-Jul-2024 sashan <sashan@openbsd.org>

This change allows user to define table inside the anchor like that:
anchor foo {
table <bar> { 192.168.1.1 }
pass in from <bar> to <self>
}
Without this diff one must either create table <bar>

This change allows user to define table inside the anchor like that:
anchor foo {
table <bar> { 192.168.1.1 }
pass in from <bar> to <self>
}
Without this diff one must either create table <bar> in main
ruleset (root) or use 'pfctl -a foo -t bar -T add 192.168.1.1'
This glitch is hard to notice. Not many human admins try to attach
tables to non-global anchors. Deamons which configure pf(4) automatically
at run time such as relayd(8) and spamd(8) create tables attached to
thair anchors (for example 'relayd/*') but the deamons use way similar
to pfctl(8) to add and manage those tables.

The reason why I'd like to seal this gap is that my long term goal
is to turn global `pfr_ktable` in pf(4) into member of pf_anchor.
So each ruleset will get its own tree of tables.

feedback and OK bluhm@

show more ...


# 7401c119 28-Jan-2022 guenther <guenther@openbsd.org>

When it's the possessive of 'it', it's spelled "its", without the
apostrophe.


# e4e00973 16-Jan-2022 naddy <naddy@openbsd.org>

pfctl: fix -Wunused-but-set-variable warning

ok dlg@ guenther@


# 9c6ad19b 21-Jul-2020 henning <henning@openbsd.org>

rename PF_OPT_TABLE_PREFIX to PF_OPTIMIZER_TABLE_PFX and move it to pfvar.h
OPT is misleading and usually refers to command line arguments to pfctl
ok sashan kn


# c8d5c234 28-Jan-2020 bket <bket@openbsd.org>

sbin/pfctl: replace TAILQ concatenation loop with TAILQ_CONCAT

OK kn@, sashan@, florian@


# c802a0d9 15-Jan-2020 kn <kn@openbsd.org>

Do the actual pfr_strerror() to pf_strerror() rename

Missed in previous


# e5c92015 15-Jan-2020 kn <kn@openbsd.org>

Unify error message for nonexisting anchors

pf(4) returns EINVAL for DIOCGETRULE, DIOCGETRULES and DIOCGETRULESET if
the specified anchor does not exist.

Extend and rename {pfr -> pf}_strerror() to

Unify error message for nonexisting anchors

pf(4) returns EINVAL for DIOCGETRULE, DIOCGETRULES and DIOCGETRULESET if
the specified anchor does not exist.

Extend and rename {pfr -> pf}_strerror() to make error message more
consistent.

There are other occasions as well but those need additional tweaks;
that's stuff for another diff.

OK and rename from sashan

show more ...


# 757f1589 12-Dec-2019 kn <kn@openbsd.org>

Avoid optimizing empty rulesets

All optimizations work on actual rules; if there are none, return early.

While here, tell which ruleset/anchor is being optimized to make the debug
message actually

Avoid optimizing empty rulesets

All optimizations work on actual rules; if there are none, return early.

While here, tell which ruleset/anchor is being optimized to make the debug
message actually useful.

OK mikeb

show more ...


# df69c215 28-Jun-2019 deraadt <deraadt@openbsd.org>

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

show more ...


# f9850734 07-Mar-2019 kn <kn@openbsd.org>

Remove pfctl_*_pool() remnants

Left behind in pfctl_parser.h revision 1.91
"First pass at removing the 'pf_pool' mechanism [...]"

These functions don't exist anymore, no object change.

OK procter


# 39a868ff 03-Jan-2019 kn <kn@openbsd.org>

Unbreak build under OPT_DEBUG

In r1.39 I removed the `af' parameter from `unmask()' but accidently zapped
the macro's closing paranthese.

Since DEBUG() is needlessly under an OPT_DEBUG guard, this

Unbreak build under OPT_DEBUG

In r1.39 I removed the `af' parameter from `unmask()' but accidently zapped
the macro's closing paranthese.

Since DEBUG() is needlessly under an OPT_DEBUG guard, this was not
effecting normal builds.

Add the missing ')' and remove the ifdef.

OK sashan

show more ...


# f0bb6ca5 06-Sep-2018 kn <kn@openbsd.org>

Remove unused af argument from unmask()

This has been unused for years.

While here, zap the duplicate function signature from pfctl.h (already
present in pfctl_parser.h); spotted by sashan, thanks.

Remove unused af argument from unmask()

This has been unused for years.

While here, zap the duplicate function signature from pfctl.h (already
present in pfctl_parser.h); spotted by sashan, thanks.

OK sashan

show more ...


# 43d70b83 25-Nov-2017 sashan <sashan@openbsd.org>

- patching use-after-free and innocent memory leak in pfctl_optimzie.c

OK bluhm@


# a2fcc045 25-Nov-2017 sashan <sashan@openbsd.org>

- pfctl rule optimizer: anchor name vs. anchor path mix up

OK bluhm@


# 5359fb47 03-Aug-2016 krw <krw@openbsd.org>

A couple of "a->blah == a->blah" -> "a->blah == b->blah".

Spotted by the Echelon team with AppChecker static analyzer.

ok sashan@


# 68928c43 21-Jan-2015 deraadt <deraadt@openbsd.org>

Include <netinet/in.h> before <net/pfvar.h>. In a future change when
ports is ready, <net/pfvar.h> will stop including a pile of balony.


# abcbcc4d 13-Sep-2014 doug <doug@openbsd.org>

Replace all queue *_END macro calls except CIRCLEQ_END with NULL.

CIRCLEQ_* is deprecated and not called in the tree. The other queue types
have *_END macros which were added for symmetry with CIRC

Replace all queue *_END macro calls except CIRCLEQ_END with NULL.

CIRCLEQ_* is deprecated and not called in the tree. The other queue types
have *_END macros which were added for symmetry with CIRCLEQ_END. They are
defined as NULL. There's no reason to keep the other *_END macro calls.

ok millert@

show more ...


# 025f5691 22-Nov-2013 deraadt <deraadt@openbsd.org>

Whole bunch of (unsigned char) casts carefully added for ctype calls.
Careful second audit by millert


# 2e450613 19-Oct-2012 henning <henning@openbsd.org>

rtableid must be BREAK instead of MERGE, otherwise the optimizer might
reorder rules incorrectly, i. e.:
pass rtable 2
pass from 10/16 rtable 0
pass from 10.1/16 rtable 1

so with this ruleset

rtableid must be BREAK instead of MERGE, otherwise the optimizer might
reorder rules incorrectly, i. e.:
pass rtable 2
pass from 10/16 rtable 0
pass from 10.1/16 rtable 1

so with this ruleset a packet from 10/16 will end up in rtable 0.
now let's see what pfctl makes out of it, with default optimization:

<brahe@tachi> pfctl $ pfctl -nvf t.conf
pass inet from 10.0.0.0/16 to any flags S/SA rtable 0
pass inet from 10.1.0.0/16 to any flags S/SA rtable 1
pass all flags S/SA rtable 2

OUPS! a packet from 10/16 will end up in rtable 2 now.

found by phessler, fix by your's truly, from EuroBSDcon
ok beck phessler benno mikeb sthen

show more ...


# 4a16887b 19-Dec-2011 mikeb <mikeb@openbsd.org>

unbreak rule optimizer; ok henning, looks


# ad85696e 23-Nov-2011 henning <henning@openbsd.org>

print ports as numbers by default; -P prints names instead
2/2 from Lawrence Teo <lteo at devio dot us>
ok sthen dlg and myself


# cbdc262e 27-Jul-2011 mcbride <mcbride@openbsd.org>

Add support for weighted round-robin in load balancing pools and tables.
Diff from zinke@ with a some minor cleanup.
ok henning claudio deraadt


# 04c69899 07-Jul-2011 mcbride <mcbride@openbsd.org>

Fold pf_test_fragment() into pf_test_rule(), reduce code and fixes
a bunch of bugs with fragment handling not being in sync with the
rest of the ruleset.

Much feedback from mpf, bluhm & markus
Thank

Fold pf_test_fragment() into pf_test_rule(), reduce code and fixes
a bunch of bugs with fragment handling not being in sync with the
rest of the ruleset.

Much feedback from mpf, bluhm & markus
Thanks to Tony Sarendal for help with testing

ok bluhm; various previous versions ok henning, claudio, mpf, markus

show more ...


# bcb11948 03-Jul-2011 zinke <zinke@openbsd.org>

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 9e70289e 06-Apr-2011 claudio <claudio@openbsd.org>

Userland bits to allow PF to filter on the rdomain a packet belongs to.
This allows to write rules like "pass in on rdomain 1".
Tested by phessler@, OK henning@


12