History log of /openbsd-current/share/man/man5/pf.conf.5
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.602 15-Apr-2024 jmc

hint that the tcp timeout values can be adjusted collectively via
"set optimization"; from jesper wallin

ok bluhm


# 1.601 15-Apr-2024 jmc

document tcp.tsdiff; from jesper wallin
ok bluhm


Revision tags: OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.600 18-Nov-2022 kn

Improve "once" bits

- use imperative tense in the pf.conf(5) "once" part
- leave printing implementation details to pfctl(8)'s "-s rules" part
- use more markup
- debug mode also prints expired rules

OK jmc sashan


# 1.599 10-Nov-2022 jmc

tweak the "once" text; ok sashan


# 1.598 09-Nov-2022 sashan

simplify expiration of 'once' rules.
let packet to mark 'once' rule as expired. The rule
will be removed by pfctl(8) when rules are updated.

OK kn@


Revision tags: OPENBSD_7_2_BASE
# 1.597 24-Jul-2022 jmc

document limit-item "anchors"; from martin vahlensieck

while here, rework the "set limit" section:

- use a simple list
- add some missing defaults and limit-item

mbuhl helped fill in some of the blanks
ok kn


# 1.596 27-May-2022 jmc

rework the text on mtu and mss, according to some notes from sthen;
ok sthen


# 1.595 09-May-2022 sthen

Mention in the "proto icmp" section that standard stateful rules (i.e. the
default type of PF rule) don't allow ICMP responses unless they match an
existing state - tweak "keep state (sloppy)" to suggest from the first
sentence of the paragraph that it affects more than TCP. ok sashan@ bluhm@


# 1.594 09-May-2022 sashan

pf.conf(5) should mention impact of sloppy state handling on ICMP

OK @bluhm


Revision tags: OPENBSD_7_1_BASE
# 1.593 31-Mar-2022 naddy

man pages: add missing commas between subordinate and main clauses

jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.

ok jmc@


# 1.592 23-Feb-2022 dlg

better help for getting addresses for dgrams received with divert-to.

getsockname is for connected sockets, not all sockets. dgrams need
to use some setsockopt stuff and cmsgs to get packet info like that.

suggested by K R on bugs@


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.600 18-Nov-2022 kn

Improve "once" bits

- use imperative tense in the pf.conf(5) "once" part
- leave printing implementation details to pfctl(8)'s "-s rules" part
- use more markup
- debug mode also prints expired rules

OK jmc sashan


# 1.599 10-Nov-2022 jmc

tweak the "once" text; ok sashan


# 1.598 09-Nov-2022 sashan

simplify expiration of 'once' rules.
let packet to mark 'once' rule as expired. The rule
will be removed by pfctl(8) when rules are updated.

OK kn@


Revision tags: OPENBSD_7_2_BASE
# 1.597 24-Jul-2022 jmc

document limit-item "anchors"; from martin vahlensieck

while here, rework the "set limit" section:

- use a simple list
- add some missing defaults and limit-item

mbuhl helped fill in some of the blanks
ok kn


# 1.596 27-May-2022 jmc

rework the text on mtu and mss, according to some notes from sthen;
ok sthen


# 1.595 09-May-2022 sthen

Mention in the "proto icmp" section that standard stateful rules (i.e. the
default type of PF rule) don't allow ICMP responses unless they match an
existing state - tweak "keep state (sloppy)" to suggest from the first
sentence of the paragraph that it affects more than TCP. ok sashan@ bluhm@


# 1.594 09-May-2022 sashan

pf.conf(5) should mention impact of sloppy state handling on ICMP

OK @bluhm


Revision tags: OPENBSD_7_1_BASE
# 1.593 31-Mar-2022 naddy

man pages: add missing commas between subordinate and main clauses

jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.

ok jmc@


# 1.592 23-Feb-2022 dlg

better help for getting addresses for dgrams received with divert-to.

getsockname is for connected sockets, not all sockets. dgrams need
to use some setsockopt stuff and cmsgs to get packet info like that.

suggested by K R on bugs@


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.599 10-Nov-2022 jmc

tweak the "once" text; ok sashan


# 1.598 09-Nov-2022 sashan

simplify expiration of 'once' rules.
let packet to mark 'once' rule as expired. The rule
will be removed by pfctl(8) when rules are updated.

OK kn@


Revision tags: OPENBSD_7_2_BASE
# 1.597 24-Jul-2022 jmc

document limit-item "anchors"; from martin vahlensieck

while here, rework the "set limit" section:

- use a simple list
- add some missing defaults and limit-item

mbuhl helped fill in some of the blanks
ok kn


# 1.596 27-May-2022 jmc

rework the text on mtu and mss, according to some notes from sthen;
ok sthen


# 1.595 09-May-2022 sthen

Mention in the "proto icmp" section that standard stateful rules (i.e. the
default type of PF rule) don't allow ICMP responses unless they match an
existing state - tweak "keep state (sloppy)" to suggest from the first
sentence of the paragraph that it affects more than TCP. ok sashan@ bluhm@


# 1.594 09-May-2022 sashan

pf.conf(5) should mention impact of sloppy state handling on ICMP

OK @bluhm


Revision tags: OPENBSD_7_1_BASE
# 1.593 31-Mar-2022 naddy

man pages: add missing commas between subordinate and main clauses

jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.

ok jmc@


# 1.592 23-Feb-2022 dlg

better help for getting addresses for dgrams received with divert-to.

getsockname is for connected sockets, not all sockets. dgrams need
to use some setsockopt stuff and cmsgs to get packet info like that.

suggested by K R on bugs@


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.599 10-Nov-2022 jmc

tweak the "once" text; ok sashan


# 1.598 09-Nov-2022 sashan

simplify expiration of 'once' rules.
let packet to mark 'once' rule as expired. The rule
will be removed by pfctl(8) when rules are updated.

OK kn@


Revision tags: OPENBSD_7_2_BASE
# 1.597 24-Jul-2022 jmc

document limit-item "anchors"; from martin vahlensieck

while here, rework the "set limit" section:

- use a simple list
- add some missing defaults and limit-item

mbuhl helped fill in some of the blanks
ok kn


# 1.596 27-May-2022 jmc

rework the text on mtu and mss, according to some notes from sthen;
ok sthen


# 1.595 09-May-2022 sthen

Mention in the "proto icmp" section that standard stateful rules (i.e. the
default type of PF rule) don't allow ICMP responses unless they match an
existing state - tweak "keep state (sloppy)" to suggest from the first
sentence of the paragraph that it affects more than TCP. ok sashan@ bluhm@


# 1.594 09-May-2022 sashan

pf.conf(5) should mention impact of sloppy state handling on ICMP

OK @bluhm


Revision tags: OPENBSD_7_1_BASE
# 1.593 31-Mar-2022 naddy

man pages: add missing commas between subordinate and main clauses

jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.

ok jmc@


# 1.592 23-Feb-2022 dlg

better help for getting addresses for dgrams received with divert-to.

getsockname is for connected sockets, not all sockets. dgrams need
to use some setsockopt stuff and cmsgs to get packet info like that.

suggested by K R on bugs@


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.597 24-Jul-2022 jmc

document limit-item "anchors"; from martin vahlensieck

while here, rework the "set limit" section:

- use a simple list
- add some missing defaults and limit-item

mbuhl helped fill in some of the blanks
ok kn


# 1.596 27-May-2022 jmc

rework the text on mtu and mss, according to some notes from sthen;
ok sthen


# 1.595 09-May-2022 sthen

Mention in the "proto icmp" section that standard stateful rules (i.e. the
default type of PF rule) don't allow ICMP responses unless they match an
existing state - tweak "keep state (sloppy)" to suggest from the first
sentence of the paragraph that it affects more than TCP. ok sashan@ bluhm@


# 1.594 09-May-2022 sashan

pf.conf(5) should mention impact of sloppy state handling on ICMP

OK @bluhm


Revision tags: OPENBSD_7_1_BASE
# 1.593 31-Mar-2022 naddy

man pages: add missing commas between subordinate and main clauses

jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.

ok jmc@


# 1.592 23-Feb-2022 dlg

better help for getting addresses for dgrams received with divert-to.

getsockname is for connected sockets, not all sockets. dgrams need
to use some setsockopt stuff and cmsgs to get packet info like that.

suggested by K R on bugs@


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.596 27-May-2022 jmc

rework the text on mtu and mss, according to some notes from sthen;
ok sthen


# 1.595 09-May-2022 sthen

Mention in the "proto icmp" section that standard stateful rules (i.e. the
default type of PF rule) don't allow ICMP responses unless they match an
existing state - tweak "keep state (sloppy)" to suggest from the first
sentence of the paragraph that it affects more than TCP. ok sashan@ bluhm@


# 1.594 09-May-2022 sashan

pf.conf(5) should mention impact of sloppy state handling on ICMP

OK @bluhm


Revision tags: OPENBSD_7_1_BASE
# 1.593 31-Mar-2022 naddy

man pages: add missing commas between subordinate and main clauses

jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.

ok jmc@


# 1.592 23-Feb-2022 dlg

better help for getting addresses for dgrams received with divert-to.

getsockname is for connected sockets, not all sockets. dgrams need
to use some setsockopt stuff and cmsgs to get packet info like that.

suggested by K R on bugs@


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.595 09-May-2022 sthen

Mention in the "proto icmp" section that standard stateful rules (i.e. the
default type of PF rule) don't allow ICMP responses unless they match an
existing state - tweak "keep state (sloppy)" to suggest from the first
sentence of the paragraph that it affects more than TCP. ok sashan@ bluhm@


# 1.594 09-May-2022 sashan

pf.conf(5) should mention impact of sloppy state handling on ICMP

OK @bluhm


Revision tags: OPENBSD_7_1_BASE
# 1.593 31-Mar-2022 naddy

man pages: add missing commas between subordinate and main clauses

jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.

ok jmc@


# 1.592 23-Feb-2022 dlg

better help for getting addresses for dgrams received with divert-to.

getsockname is for connected sockets, not all sockets. dgrams need
to use some setsockopt stuff and cmsgs to get packet info like that.

suggested by K R on bugs@


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.593 31-Mar-2022 naddy

man pages: add missing commas between subordinate and main clauses

jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.

ok jmc@


# 1.592 23-Feb-2022 dlg

better help for getting addresses for dgrams received with divert-to.

getsockname is for connected sockets, not all sockets. dgrams need
to use some setsockopt stuff and cmsgs to get packet info like that.

suggested by K R on bugs@


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.592 23-Feb-2022 dlg

better help for getting addresses for dgrams received with divert-to.

getsockname is for connected sockets, not all sockets. dgrams need
to use some setsockopt stuff and cmsgs to get packet info like that.

suggested by K R on bugs@


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.591 18-Feb-2022 jsg

Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.590 26-Dec-2021 sashan

make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.589 21-Dec-2021 jmatthew

Multiply the number of states in the example adaptive timeout calculation
by 10 so it works with the numbers in the config, which were previously
multiplied.

ok dlg@


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.588 01-Nov-2021 landry

pf.conf.5: improve reply-to documentation

reply-to uses addresses, not interfaces anymore since
https://marc.info/?l=openbsd-cvs&m=161213948819452&w=2

make it clearer that reply-to allows for symmetric routing enforcement,
eg replying via a specific gateway when having multiple paths.

wording from sthen@, vastly improving my initial suggestion.
ok jmc@ dlg@


Revision tags: OPENBSD_7_0_BASE
# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.587 19-Jul-2021 kn

Markup optional ICMP/ICMP6 codes as such

Only icmp(4)/icmp6(4) types are required for `icmp-type'/`icmp6-type' rules
while codes are optional.

From Martin Vahlensieck < openbsd at academicsolutions dot ch >, thanks!


Revision tags: OPENBSD_6_9_BASE
# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.586 01-Feb-2021 dlg

change route-to so it sends packets to IPs instead of interfaces.

this is a significant (and breaking) reworking of the policy based
routing that pf can do. the intention is to make it as easy as
nat/rdr to use, and more robust when it's operating.

the main reasons for this change are:

- route-to, reply-to, and dup-to do not work with pfsync

this is because the information about where to route-to is stored in
rules, and it is hard to have a ruleset synced between firewalls,
and impossible to have them synced 100% of the time.

- i can make my boxes panic in certain situations using route-to

yeah...

- the configuration and syntax for route-to rules are confusing.

the argument to route-to and co is an interace name with an optional
ip address. there are several problems with this. one is that people
tend to think about routing as sending packets to peers by their
address, not by the interface they're reachable on. another is that
we currently have no way to synchronise interface topology information
between firewalls, so using an interface to say where packets go
means we can't do failover of these states with pfsync. another
is that a change in routing topology means a host may become
reachable over a different interface. tying routing policy to
interfaces gets in the way of failover and load balancing.

this change does the following:

- stores the route info in the state instead of the pf rule

this allows route-to to keep working when the ruleset changes, and
allows route-to info to be sent over pfsync. there's enough spare bits
in pfsync messages that the protocol doesnt break.

the caveat is that route-to becomes tied to pass rules that create
state, like rdr-to and nat-to.

- the argument to route-to etc is a destination ip address

it's not limited to a next-hop address (thought a next-hop can be a
destination address). this allows for the failover and load balancing
referred to above.

- deprecates the address@interface host syntax in pfctl

because routing is done entirely by IPs, the interface is derived from
the route lookup, not pf. any attempt to use the @interface syntax
will fail now in all contexts.

there's enthusiasm from proctor@ jmatthew@ and others
ok sashan@ bluhm@


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.585 07-Dec-2020 sashan

synproxy should be processing incoming SYN packets only.
issue noticed by sthen@. fix discussed with bluhm@ and procter@

OK bluhm@, kn@, procter@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.584 10-Feb-2020 schwarze

briefly mention /etc/examples/ in the FILES section of all the
manual pages that document the corresponding configuration files;
OK jmc@, and general direction discussed with many


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.583 17-Jan-2020 sashan

- pf.conf(5) should clearly state range match operator ':'
does not work for uid/gid.

OK @kn, OK @sthen


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.582 23-Oct-2019 kn

Fix swapped default values of adaptive.start and adaptive.end timeouts

While here, enlist start before end to restore intuitive order.

Spotted by someone on IRC who's name I cannot recall, sorry.
OK sashan


Revision tags: OPENBSD_6_6_BASE
# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.581 30-Aug-2019 jmc

mop up for the pcap.3 rename;
help/ok deraadt


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.580 26-May-2019 naddy

use proper crossreferences


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.579 08-May-2019 sashan

update to PF pfctl(8) and pf.conf(5) manpages
great input by Ingo, Jason and Klemens

OK schwarze@, OK kn@, OK jmc@


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.578 25-Apr-2019 yasuoka

sticky-address is working with source-hash.

ok deraadt


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.577 12-Jul-2018 jmc

syncookies never is the default; from paul de weerd
ok henning


# 1.576 10-Jul-2018 henning

where we were showing "set limit states 10000" make that 100k as well,
and adjust adaptive.start/end as well (just like in the code)


# 1.575 10-Jul-2018 henning

document set delay


Revision tags: OPENBSD_6_3_BASE
# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.574 09-Feb-2018 jmc

a little more adjustment, after discussing with henning;


# 1.573 08-Feb-2018 jmc

tweak previous; ok henning


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.572 08-Feb-2018 henning

give jmc another chance to "fix previous" - document syncookies
(thanks jmc!)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)


# 1.571 13-Nov-2017 jmc

tweak previous;


# 1.570 13-Nov-2017 henning

add a generic packet rate matching filter. allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb


# 1.569 14-Oct-2017 jmc

tweak previous;


# 1.568 13-Oct-2017 mikeb

Integrate the description of flow queues into the main body of text


Revision tags: OPENBSD_6_2_BASE
# 1.567 13-Jul-2017 schwarze

* Clarify that filter rules are evaluated once per packet and interface,
not only once per packet.
* Clarify that the syntax anchor "name" { ... } both loads and
evaluates the anchor, rather than merely loading it.
Triggered by questions from Benedikt Neuffer <bene at usta dot de>.
OK mikeb@


# 1.566 08-Jun-2017 henning

clarify set prio: the second prio given applies to
1) TCP ACKs
2) packets with ToS=lowdelay
and not TCP ACKs that have ToS=lowdelay
confusion discovered during bsdcan pf tutorial


# 1.565 31-May-2017 henning

clarify that translations happen immediately on match rules, not generally
Tony Gong <tony.y.gong at gmail>


# 1.564 31-May-2017 bluhm

Block IPv6 packets in pf(4) that have hop-by-hop options header or
destination options header. Such packets can be passed by adding
"allow-opts" to the rule. So IPv6 options are handled like their
counterpart in IPv4 now.
tested by benno@; OK henning@


# 1.563 22-May-2017 jmc

some tweaks to the QUEUEING section;
from mikeb and myself


# 1.562 19-May-2017 jmc

replace tabs with spaces, for consistency, in the BNF display;
from michal mazurek


# 1.561 18-May-2017 jmc

better describe "!";
from michal mazurek, tweaked a bit by myself


# 1.560 16-May-2017 jmc

tweak the bandwidth description; help/ok mikeb


# 1.559 15-May-2017 jmc

tweak previous; ok mikeb


# 1.558 15-May-2017 mikeb

Document the new flow queue specification

With input and OK sthen


Revision tags: OPENBSD_6_1_BASE
# 1.557 17-Jan-2017 jmc

"hosts" is optional; from matthew martin
ok henning


# 1.556 04-Jan-2017 tb

modfier -> modifier

From Dimitris Papastamos.


# 1.555 02-Jan-2017 jmc

diff from jesper wallin to remove commas in one of the queue examples;
since the comma is optional i chose to remove them because:

- within the block it looks more consistent
- less to type
- the bnf doesn;t even appear to show the commas (not that i can read bnf)
- i prefer it without commas


# 1.554 24-Sep-2016 sthen

Specify "to" addresses in one of the examples that shows use of af-to for
inet6->inet. Without this, local network traffic (including neighbour
discovery etc) will also get translated. From Peter J. Philipp, with a
tweak to break long lines.


# 1.553 13-Sep-2016 jmc

make it clearer that log options require ();
requested by janne johansson

ok henning


Revision tags: OPENBSD_6_0_BASE
# 1.552 14-May-2016 jmc

unhphenate the world: re-order -> reorder
sthen does not object


Revision tags: OPENBSD_5_9_BASE
# 1.551 05-Jan-2016 benno

remove long deprecated "set debug "none|urgent|misc|loud" levels in
pf.conf. Change this before upgrade or pf.conf won't load.
florian@ henning@ phessler@ jung@


# 1.550 03-Nov-2015 sobrado

we need an unbreakable space in O(log2 n).

ok jmc@


# 1.549 26-Oct-2015 schwarze

adjust macro usage to the usual conventions


# 1.548 22-Oct-2015 sobrado

improve indentation in list block.

ok jmc@


# 1.547 30-Sep-2015 sobrado

fix some spelling messes.

ok jmc@


# 1.546 14-Sep-2015 schwarze

Avoid .Ns right after .Pf, it's pointless.
In some cases, do additional cleanup in the immediate vicinity.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.545 16-Feb-2015 jmc

after some discussion with henning, document the various log options as
one section; some text was altered to make it read better;

ok henning


# 1.544 16-Feb-2015 bentley

Don't use greater-equal/less-equal symbols where "<="/">=" are intended.

Also, clean up some usage of predefined strings (which are discouraged by
mandoc_char(7) for portability reasons) and improve spacing in
hostapd.conf(5).

ok schwarze@


# 1.543 12-Feb-2015 henning

a shot at documenting the changed log(matches) semantics


# 1.542 10-Feb-2015 henning

document matching on prio


# 1.541 16-Jan-2015 schwarze

properly handle opening parentheses, correctly quote vertical bars,
and do not use the legacy predefined string \*(Ba


# 1.540 19-Dec-2014 reyk

Support source-hash and random with tables and dynifs; not just pools.
This finally allows to use source-hash for dynamic loadbalancing, eg.
"rdr-to <hosts> source-hash", instead of just round-robin and least-states.

An older pre-siphash version of this diff was tested by many people.

OK tedu@ benno@


# 1.539 23-Oct-2014 kspillner

Add GRAMMAR to list of sections.

ok jmc@, deraadt@ (begrudgingly)


Revision tags: OPENBSD_5_6_BASE
# 1.538 28-May-2014 jmc

tweak previous;


# 1.537 28-May-2014 henning

prio is meaningless when bandwidth shaping is in use, fix example
noticed by Marko Cupa�� <marko.cupac at mimar dot rs>


Revision tags: OPENBSD_5_5_BASE
# 1.536 21-Jan-2014 schwarze

obvious .Pa fixes; found with mandocdb(8)


# 1.535 21-Jan-2014 henning

document how any matches any non-loopback interface, ok benno


# 1.534 20-Jan-2014 henning

document !received-on, ok dlg benno


# 1.533 10-Jan-2014 sobrado

Using random-id is recommended in combination with no-df to ensure
unique IP identifiers.

ok henning@


# 1.532 21-Dec-2013 camield

Document that the "user" socket check is not reliable with wildcard
listeners. Update the example to reflect this.

Deprecate usage of user "unknown" too, same reason.

Noted by Maxim Khitrov on bugs

ok henning, jmc


# 1.531 27-Nov-2013 jmc

document better how priorities work, and fix an example;
diff originally from timo myyra, but tweaked according to henning
(equal prio packets are fifo, not round-robin);

ok henning


# 1.530 12-Oct-2013 jmc

i. e. -> i.e.


# 1.529 12-Oct-2013 sthen

explicitely->explicitly


# 1.528 12-Oct-2013 henning

document new queueing. with lots of help from jmc. glanced over by many,
ok phessler sthen


Revision tags: OPENBSD_5_4_BASE
# 1.527 25-Apr-2013 sobrado

fix range for assigned ports managed by the IANA (see RFC 1700).

ok sthen@


Revision tags: OPENBSD_5_3_BASE
# 1.526 19-Feb-2013 sthen

Make it clear that the default implicit 'pass' rule does not create state,
make sense to deraadt@, ok/wording tweak from mikeb.


# 1.525 16-Jan-2013 henning

move the "set queue" block a bit down so that
a) things are in alphabetical order again
b) the "described below" in the set prio section actually refers to a block
of text below and not above it... ok jsing


# 1.524 16-Jan-2013 henning

for consistency with prio etc, the queue assignment really belongs
into the set block. so make pfctl accept, print and the manpage document
. match set queue foo
instead of
. match queue foo
but keep accepting the old way without the explicit set.
ok bob, man jmc


# 1.523 18-Oct-2012 reyk

Disallow tables and interface address pools for rdr-to, nat-to and
route-to with any other scheduling algorithms than round-robin or
least-states. Before this change, pfctl accepted and loaded invalid
address pools, eg. "rdr-to <table> source-hash", but it is not
supported by the kernel and was silently ignored in operation.

Also clarify the manpage a bit by mentioning that tables are only
valid with round-robin or least-states.

ok zinke@


# 1.522 20-Sep-2012 jmc

remove unneccessary macro;


# 1.521 20-Sep-2012 camield

Lower pf frags limit to not risk running out of mbuf clusters
when dealing with lots of IP fragments.

This sets the default to 25% of the mbuf cluster maximum (hint
from beck). And the example in the manpage is sane now.

ok mikeb henning beck deraadt


Revision tags: OPENBSD_5_2_BASE
# 1.520 10-Jul-2012 jmc

it seems previous was wrong, so move prio/tos out of OPTIONS,
and put them into the main filtering section, at least for now;

ok henning


# 1.519 10-Jul-2012 jmc

move set prio/tos into OPTIONS; ok henning


# 1.518 09-Jul-2012 jmc

one more prio -> set prio; ok henning


# 1.517 09-Jul-2012 zinke

Enable support for the 'weight' keyword in the 'least-states'
load balancing case, this allows Weighted Least States (WLS).
Everything prepared on c2k11 with help from mcbride@.

This finally makes PF ready for the cloud.

ok henning@ mikeb@ pyr@


# 1.516 09-Jul-2012 henning

fix some of the confusion we have in pf regarding filter criteria vs
options that "write" to the packet by putting the latter in a set { } block.
for now prio and tos, maintain set-tos backwards compat for the moment.
"match set { prio 6, tos lowdelay }"
"match set prio 6"
from a discussion with ryan in tokyo a while ago, ok ryan phessler


# 1.515 29-Jun-2012 jmc

tcp/udp mandatory for "user"; from ti zed
ok henning


# 1.514 24-Apr-2012 jmc

take a stab at documenting when arguments need quoted, and valid macro
characters;

prompted by a diff from robert peichaer org

thanks gilles and henning for feedback
ok deraadt zinke


Revision tags: OPENBSD_5_1_BASE
# 1.513 31-Jan-2012 jmc

tweak previous;


# 1.512 30-Jan-2012 mikeb

document af-to (aka nat64)

the patch was started by todd about a year ago and have been
finally finished by phessler and myself today; discussed with
and tweaks from jmc, ok sthen, henning


# 1.511 16-Jan-2012 bluhm

Fix description for tcp.opening timeout in pf.conf(5).
Issue reported by Felix Rust; ok jmc@


# 1.510 11-Jan-2012 henning

make "self" a bit more visible
from Sebastian Benoit <benoit-lists at fb12.de>, ok/input jmc, reminder/input
deraadt and too much of a trail to mention all of it, thx everybody involved


# 1.509 27-Nov-2011 haesbaert

Manpage bits for the recent changes in vlan(4) prio handling.

ok jmc henning sthen claudio


# 1.508 30-Aug-2011 mikeb

Document a "once" filter option used to create one shot rules.

ok henning, mcbride, jmc


# 1.507 18-Aug-2011 henning

fix overload table BNF
From: william dunand <william.dunand at gmail.com>


# 1.506 16-Aug-2011 mikeb

Sync documentation with code on the matter of max state limit behavior.
When one of the state limits is reached, further packets that would
create state are dropped, until existing states time out. Discussed
with mcbride, ok henning, jmc


Revision tags: OPENBSD_5_0_BASE
# 1.505 08-Aug-2011 mcbride

sync 'set-tos' with 'tos' keyword (DiffServ is supported by both)

ok deraadt


# 1.504 29-Jul-2011 mcbride

Remove requirement to quote 'debug' loglevel for the 'debug' option.

ok henning


# 1.503 27-Jul-2011 jmc

- new sentence, new line
- zap trailing whitespace


# 1.502 27-Jul-2011 mcbride

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


# 1.501 09-Jul-2011 jmc

zap trailing whitespace;


# 1.500 08-Jul-2011 mcbride

Initial description of 'prio' keyword.

ok henning


# 1.499 04-Jul-2011 tedu

jmc found a few more mentions of RIO here


# 1.498 04-Jul-2011 jmc

tweak previous;


# 1.497 04-Jul-2011 henning

bye bye require-order.
i added that button many many many years ago since the order (options, scrub,
nat, filter) was enforced back then, which I hated. now we had that turned
off for ages, and with the scrub and nat rulesets being gone, there is very
little reason to enforce an order at all. so let's get rid of it.
introducing this button was one of my very early commits to openbsd... feels
a bit strange to remove it now :)
ok ryan dlg theo


# 1.496 03-Jul-2011 zinke

bring in least-states load balancing algorithm

ok mcbride@ henning@


# 1.495 23-Jun-2011 sthen

Use a common text explaining how the various configuration parsers using
the standard OpenBSD-style parse.y handle continuing lines with backslashes,
paying particular attention to how comments are handled (which can cause
nasty side-effects if you're not expecting it).

Most wording from jmc@, with suggestions from fgsch@, marc@, Richard Toohey,
patrick keshishian and Florian Obser, ok jmc@.


# 1.494 20-May-2011 sthen

Point out that the 'set skip' interfaces are currently only evaluated at
config load time. This may change in future but for now it's better to
document it.


# 1.493 02-May-2011 jmc

update BNF for "set limit"; from Lawrence Teo
ok henning


# 1.492 06-Apr-2011 claudio

Documentation for "on rdomain <number>". OK henning@


# 1.491 05-Apr-2011 jsg

remove mention of fastroute here as well
'you are not allowed to speak until you commit' mikeb@


# 1.490 25-Mar-2011 bluhm

Pf can reassemble IPv6 fragments now.
ok jmc@


Revision tags: OPENBSD_4_9_BASE
# 1.489 01-Feb-2011 jmc

- remove an ambiguity regarding the state description. i used part of a
diff from patrick keshishian on misc for this

- document that packets passed by default, matching neither block nor
pass rules, are effectively created with "no state"; as discovered by tedu

...after much discussion on misc and with henning


# 1.488 23-Jan-2011 henning

bit more on reflection, From: James Jerkins <jjerkins at una.edu>
with tweaks from jmc


# 1.487 20-Jan-2011 sthen

Fix an example using rdr-to where a couple of hosts were exempted from
the redirect; the sample rule used "match" for the general case which
negated the exemptions. From Harald Dunkel.


# 1.486 31-Dec-2010 bluhm

According to pf_scrub_ip6() pf does not support the scrub options
no-df, random-id, set-tos for IPv6 rules. Check this in pfctl and
document it in pf.conf(5).
ok henning@ jmc@


# 1.485 23-Dec-2010 jmc

fix my last (sloppy) fix; from Thomas Pfaff
ok henning


# 1.484 22-Dec-2010 jmc

fix sloppy paste in;


# 1.483 22-Dec-2010 henning

adjust set debug description to reality
From: Thomas Pfaff <tpfaff@tp76.info>


# 1.482 15-Dec-2010 jmc

- clarify the "probability" text; based on a diff from Thomas Pfaff
ok henning

- while here, knock out a bad .Pp


# 1.481 24-Sep-2010 henning

oups. the notes i just added looked like shit because i'm too smart too
actually look at the manpage when changing it. ok jmc


# 1.480 24-Sep-2010 jmc

tweak previous;


# 1.479 24-Sep-2010 henning

for rdr-to and nat-to, mention in which direction they are usually used
and mention the constraints for use in the "unnatural" direction
ok claudio ryan dlg


# 1.478 22-Sep-2010 henning

document hwo to play with matches


# 1.477 20-Aug-2010 henning

sync divert-packet documentation with reality
PR 6448 pjp at centroid dot eu


Revision tags: OPENBSD_4_8_BASE
# 1.476 19-May-2010 sthen

redo the list of "sticky" parameters for match rules;

- include translation options
- include "scrub"
- don't include max-mss etc, which aren't used directly rather they
are written like 'match ... scrub (max-mss xxx)'

ok jmc@ henning@


# 1.475 01-Apr-2010 jsg

Don't mention translation in the require-order blurb as it is now
part of filtering.

ok henning@


# 1.474 18-Mar-2010 jmc

add divert-* to bnf; from Dave Anderson
ok henning


Revision tags: OPENBSD_4_7_BASE
# 1.473 19-Feb-2010 henning

missing "
From: Aivar Jaakson <aivar@cirt.pri.ee>


# 1.472 18-Feb-2010 jmc

missing `]'; from Aivar Jaakson


# 1.471 02-Feb-2010 sthen

Add missing 'in' in sample rdr-to rule. Noted by Steve Williams.


# 1.470 12-Jan-2010 jmc

better word MSS in pf.conf.5, from Lars Nooden;
the changes in pppoe.4 are just to keep things consistent...


# 1.469 12-Jan-2010 mcbride

First pass at removing the 'pf_pool' mechanism for translation and routing
actions. Allow interfaces to be specified in special table entries for
the routing actions. Lists of addresses can now only be done using tables,
which pfctl will generate automatically from the existing syntax.

Functionally, this deprecates the use of multiple tables or dynamic
interfaces in a single nat or rdr rule.

ok henning dlg claudio


# 1.468 24-Dec-2009 deraadt

correct the text for received-on; ok dlg


# 1.467 24-Dec-2009 jmc

tweak previous;


# 1.466 24-Dec-2009 dlg

try to document received-on.


# 1.465 30-Nov-2009 sthen

It doesn't make sense to talk about doing packet tagging "during
nat-to or rdr-to in addition to filter rules".


# 1.464 10-Nov-2009 sthen

adjust one of the examples/descriptions for nat-to; it used to be
'nat pass' and nearest equivalent now is to use 'pass quick...nat-to'
not just 'pass...nat-to'. ok henning@ jmc@


# 1.463 06-Nov-2009 eric

correct values for set reassemble

ok henning@ pyr@


# 1.462 05-Nov-2009 sthen

Adjust the description of network translation to match the code
following the nat-to changes. Reworked slightly from a diff from eric@.
ok henning jmc


# 1.461 14-Oct-2009 jmeltzer

Second example discussing the pass modifier with rdr-to
should actually use the pass modifier.

ok henning jmc


# 1.460 04-Oct-2009 michele

Add (again) support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 1

A lot of discussion have happened since my last commit that resulted
in many changes and improvements.
I would *really* like to thank everyone who took part in the discussion
especially canacar@ who spotted out which are the limitations of this approach.

OpenBSD divert(4) is meant to be compatible with software running on
top of FreeBSD's divert sockets even though they are pretty different and will
become even more with time.

discusses with many, but mainly reyk@ canacar@ deraadt@ dlg@ claudio@ beck@
tested by reyk@ and myself
ok reyk@ claudio@ beck@
manpage help and ok by jmc@


# 1.459 25-Sep-2009 jmc

some clarification of "set reassemble" and "no-df"; help/ok henning


# 1.458 22-Sep-2009 jmc

floating/if-bound may be used per-rule; ok henning


# 1.457 08-Sep-2009 michele

I had not enough oks to commit this diff.
Sorry.


# 1.456 08-Sep-2009 michele

Add support for divert sockets. They allow you to:

- queue packets from pf(4) to a userspace application
- reinject packets from the application into the kernel stack.

The divert socket can be bound to a special "divert port" and will
receive every packet diverted to that port by pf(4).

The pf syntax is pretty simple, e.g.:

pass on em0 inet proto tcp from any to any port 80 divert-packet port 8000

test, bugfix and ok by reyk@
manpage help and ok by jmc@
no objections from many others.


# 1.455 07-Sep-2009 reyk

implement binat-to as a macro-like rule: a rule using the new binat-to
syntax will be expanded by the parser to a nat-to+rdr-to combination
to be loaded into the kernel. this simplifies the migration from old
binat rules and is less error-prone.

feedback from many, manpage bits from jmc@
ok henning@


# 1.454 07-Sep-2009 jmc

remove the trans-anchors bnf entry too; ok sthen henning


# 1.453 07-Sep-2009 jmc

remove *-anchor bits from BNF; ok sthen


# 1.452 03-Sep-2009 jmc

the recent changes to translation make the ordering of this document
slightly redundant: move the packet filtering section to the top,
and make translation a subsection;

ok henning


# 1.451 02-Sep-2009 henning

match in pass is bullshit (conversion error from nat pass), spotted by phessler


# 1.450 02-Sep-2009 reyk

all the new *-to options are part of the "filteropts" section at the
end of a pf rule (nat-to, divert-to, rdr-to, ...). take the
historical chance to upgrade the grammar and move the route options to
the filteropts section as well.

for example,
pass in on em0 route-to (em1 192.168.1.1) from 10.1.1.1
becomes
pass in on em0 from 10.1.1.1 route-to (em1 192.168.1.1)

many people like this including pyr@ mk@ kettenis@ todd@ and others
ok henning@


# 1.449 01-Sep-2009 henning

document new pf. mostly from igor, input and bnf by me


# 1.448 28-Jul-2009 claudio

Recommit rev. 1.446 it is again possible to use DSCP names in tos and settos
statements.


# 1.447 27-Jul-2009 deraadt

Please don't commit documentation for changes which don't compile in
the tree. Surely you were involved and noticed that the tree was being
broken.


# 1.446 27-Jul-2009 sthen

List the additional TOS values and DiffServ Code Points now recognised
by pfctl(8).


# 1.445 19-Jul-2009 sobrado

take out a few .Ar macros from the examples.

pointed out by jmc@


# 1.444 18-Jul-2009 sobrado

use a better layout to improve readability.

ok henning@


Revision tags: OPENBSD_4_6_BASE
# 1.443 30-May-2009 jmc

correct the bnf for return-rst, and describe the optional ttl parameter
for it;

started by a mail from Laurent Ghigonis
ok fgsch henning


# 1.442 01-May-2009 jmc

use printf instead of echo for one of the anchor examples - this allows it
to work for users of csh and /bin/echo;


# 1.441 27-Apr-2009 jmc

now that require-order is no longer on by default, we can relax the ordering
of this page a little; instead of talking about statement types, just provide
a brief overview of the page;


# 1.440 27-Apr-2009 jmc

- use .Dl for short displays
- .Nm does not require args


# 1.439 27-Apr-2009 jmc

- restructure the ANCHORS section
- no need to escape quotes within displays


# 1.438 26-Apr-2009 sthen

switch the require-order default to "no". regression tests still pass.
ok henning@ deraadt@


# 1.437 24-Apr-2009 jmc

tweak ANCHORS;


# 1.436 24-Apr-2009 jmc

reduce the verbosity of the two examples sections, and provide some
indent;

ok henning


# 1.435 24-Apr-2009 jmc

rearrange/merge the various sections to impose some structure on this page;
ok henning


# 1.434 22-Apr-2009 jmc

tweaks for the final sections;


# 1.433 21-Apr-2009 jmc

final sort;


# 1.432 21-Apr-2009 jmc

tweak NORMALIZATION;


# 1.431 21-Apr-2009 jmc

simplify "log (user)"; help/ok henning


# 1.430 21-Apr-2009 jmc

tweak PARAMETERS;


# 1.429 21-Apr-2009 jmc

sort PARAMETERS; also split the list in two, to make it more manageable;
ok henning deraadt


# 1.428 20-Apr-2009 sthen

Don't talk about a "scrub reassemble tcp" rule, talk about "reassemble
tcp" parameter. ok henning@


# 1.427 17-Apr-2009 jmc

tweak PACKET FILTERING;


# 1.426 16-Apr-2009 jmc

tweak TRANSLATION;


# 1.425 15-Apr-2009 jmc

comment out the RIO stuff until such a time as it is enabled; ok henning


# 1.424 15-Apr-2009 sobrado

code and Backus-Naur Form specification rules must fit on 80-column displays;
while here, remove a few superfluous line breaks in examples.

ok henning@, jmc@


# 1.423 15-Apr-2009 jmc

tweak QUEUEING;


# 1.422 15-Apr-2009 jmc

sort QUEUEING, and a little list tweaking;


# 1.421 14-Apr-2009 jmc

tweak TABLES;


# 1.420 14-Apr-2009 jmc

tweak OPTIONS; also there is no need to given an example of every "set"
argument, so remove any examples that were not particularly illustrative;

ok henning


# 1.419 13-Apr-2009 jmc

sort OPTIONS;


# 1.418 10-Apr-2009 jmc

tweak TABLES;


# 1.417 10-Apr-2009 jmc

some improvements for the PACKET FILTERING section;
feedback (i.e. much tearing of hair) and ok henning


# 1.416 07-Apr-2009 henning

bnf-tweaks


# 1.415 07-Apr-2009 henning

don't we all love BNF? make it lie less


# 1.414 07-Apr-2009 henning

nits


# 1.413 07-Apr-2009 jmc

catch up with recent changes (scrub, match, ...); still a ways to go
ok henning


# 1.412 07-Apr-2009 henning

fragment reassembly on by default


# 1.411 07-Apr-2009 henning

bit more precise


# 1.410 06-Apr-2009 sobrado

rewrite the description for the recently added "match" action.

ok henning@


# 1.409 06-Apr-2009 sthen

no more normalization statements, remove it from require-order description.
ok henning


# 1.408 06-Apr-2009 sobrado

documentation changes related with the monster pf diff from basel;
we are mostly documenting that fragment reassembly has nothing to do
with scrubbing anymore; there is room for a lot of improvements yet.

"commit it and we work on it in-tree. it is certainly well,
better than what there is now" henning@


# 1.407 06-Apr-2009 henning

1) scrub rules are completely gone.
2) packet reassembly: only one method remains, full reassembly. crop
and drop-ovl are gone.
. set reassemble yes|no [no-df]
if no-df is given fragments (and only fragments!) with the df bit set
have it cleared before entering the fragment cache, and thus the
reassembled packet doesn't have df set either. it does NOT touch
non-fragmented packets.
3) regular rules can have scrub options.
. pass scrub(no-df, min-ttl 64, max-mss 1400, set-tos lowdelay)
. match scrub(reassemble tcp, random-id)
of course all options are optional. the individual options still do
what they used to do on scrub rules, but everything is stateful now.
4) match rules
"match" is a new action, just like pass and block are, and can be used
like they do. opposed to pass or block, they do NOT change the
pass/block state of a packet. i. e.
. pass
. match
passes the packet, and
. block
. match
blocks it.
Every time (!) a match rule matches, i. e. not only when it is the
last matching rule, the following actions are set:
-queue assignment. can be overwritten later, the last rule that set a
queue wins. note how this is different from the last matching rule
wins, if the last matching rule has no queue assignments and the
second last matching rule was a match rule with queue assignments,
these assignments are taken.
-rtable assignments. works the same as queue assignments.
-set-tos, min-ttl, max-mss, no-df, random-id, reassemble tcp, all work
like the above
-logging. every matching rule causes the packet to be logged. this
means a single packet can get logged more than once (think multiple log
interfaces with different receivers, like pflogd and spamlogd)
.
almost entirely hacked at n2k9 in basel, could not be committed close to
release. this really should have been multiple diffs, but splitting them
now is not feasible any more. input from mcbride and dlg, and frantzen
about the fragment handling.
speedup around 7% for the common case, the more the more scrub rules
were in use.
manpage not up to date, being worked on.


Revision tags: OPENBSD_4_5_BASE
# 1.406 31-Jan-2009 sobrado

write point-to-point in a consistent way.

jmc@ has provided a complete list of manual pages to be fixed,
and suggested using uppercase (i.e., Point-to-Point) when discussing
the protocol, and lowercase (point-to-point) otherwise.

ok jmc@


# 1.405 02-Oct-2008 henning

document state-defaults option


# 1.404 11-Sep-2008 brad

Mbit/s -> Mbps

pointed out by jmc@


# 1.403 10-Sep-2008 henning

pflow related stuff, reminded by jmc


Revision tags: OPENBSD_4_4_BASE
# 1.402 11-Jun-2008 jmc

tweak previous;


# 1.401 10-Jun-2008 mcbride

Make counters on table addresses optional and disabled by default.
Use the 'counters' table option in pf.conf if you actually need them.
If enabled, memory is not allocated until packets match an address.

This saves about 40% memory if counters are not being used, and paves the way
for some more significant cleanups coming soon.

ok henning mpf deraadt


# 1.400 10-Jun-2008 jmc

another wee correction; ok henning


# 1.399 10-Jun-2008 jmc

tweak previous;


# 1.398 10-Jun-2008 henning

theo and ryan and I like to scare people


# 1.397 19-May-2008 markus

add divert-to/divert-reply; ok henning, pyr


# 1.396 07-May-2008 markus

scrub allows tagged, too


# 1.395 07-May-2008 markus

allow setting TOS with scrub; ok mcbride, claudio


# 1.394 19-Mar-2008 deraadt

demonstrate "include" in the bnf; weerd@weirdnet.nl


Revision tags: OPENBSD_4_3_BASE
# 1.393 11-Feb-2008 jmc

do not describe `/' as solidus; from Allen (freebsd pr120484);


# 1.392 01-Feb-2008 jmc

no more /usr/share/pf;


# 1.391 01-Feb-2008 mcbride

Document the ability to use filteropts on anchors.


# 1.390 21-Nov-2007 ray

Fix grammar, pointed out by Jim Razmus and RW.

OK jmc.


# 1.389 09-Nov-2007 jmc

when "max <number>" is exceeded, packets are not dropped - rather they
fail to match;

from Doichin Dokov
diff from henning and myself


# 1.388 14-Oct-2007 deraadt

include in bnf, wanted by jmc


# 1.387 13-Oct-2007 deraadt

support an include directive; file of course must also be "secure" like
the main configuration file; ok henning


# 1.386 30-Sep-2007 henning

while rdr'ing port spamd to portsmtpis perfectly valid, it is at least
a bit confuzzling, so swap.
From: Olli Hauer <ohauer@gmx.de>


# 1.385 27-Sep-2007 mpf

Mention "set loginterface <ifgroup>"


# 1.384 30-Aug-2007 dhartmei

document address ranges, with help from jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.383 17-Jul-2007 jmc

typo; from Stephan A. Rickauer


# 1.382 26-Jun-2007 jmc

checkd -> checked; from Nicholas Marriott


# 1.381 08-Jun-2007 henning

make it clearer where ifgroups can be used
From: Stuart Henderson <stu@spacehopper.org>


# 1.380 31-May-2007 jmc

convert to new .Dd format;


# 1.379 08-May-2007 mcbride

Document the fact that 'allow-opts' applies to IPv6 now as well.

ok jmc@ dhartmei@ henning@ deraadt@ claudio@


# 1.378 14-Apr-2007 jmc

set timeout source-track -> set timeout src.track; from Jason Testart
and a missing full stop...


# 1.377 21-Mar-2007 mcbride

Basic ruleset optimization is now the default.

Use 'set ruleset-optimization none' or the -o none argument
to prevent pfctl from optimizing the ruleset before loading it.


Revision tags: OPENBSD_4_1_BASE
# 1.376 01-Dec-2006 camield

Correct the explanation of NAT evaluation order. binat is always first,
then rdr on inbound packets or nat on outbound packets. This is _not_
necessarily the same order in which the rules are defined in the ruleset.

ok jmc dhartmei henning


# 1.375 29-Nov-2006 jmc

stateles -> stateless; from stuart henderson


# 1.374 28-Nov-2006 jmc

bad space;


# 1.373 28-Nov-2006 henning

mention rtable shitz now that it is enabled in the forwarding path


# 1.372 09-Nov-2006 jmc

desireable -> desirable;


# 1.371 01-Nov-2006 jmc

tweaks;


# 1.370 31-Oct-2006 mcbride

Document set ruleset-optimization [ none | basic | profile ].


# 1.369 28-Oct-2006 mcbride

Document inline anchor loading with { } delimited blocks.


# 1.368 26-Oct-2006 jmc

tweak;


# 1.367 26-Oct-2006 jmc

tweaks; ok henning


# 1.366 26-Oct-2006 mcbride

eep! unbreak.


# 1.365 26-Oct-2006 mcbride

Document hostid.

pointed out by Pierre-Yves Ritschard.


# 1.364 25-Oct-2006 henning

document how ot send logs to alternate pflog interfaces


# 1.363 23-Oct-2006 jmc

remove trailing space;


# 1.362 22-Oct-2006 mcbride

Move the stateful content up to the FILTERING section and flesh it out
somewhat to reflect the default 'keep state' behaviour of pf.conf.

prodding by theo, ok jmc@


# 1.361 11-Oct-2006 jmc

fix mark up mistake;


# 1.360 11-Oct-2006 mcbride

Document 'anchor "foo" quick'.


# 1.359 06-Oct-2006 jmc

these fixes got lost somehow;


# 1.358 06-Oct-2006 jmc

missing fixes for STATEFUL INSPECTION;


# 1.357 06-Oct-2006 jmc

kill trailing whitespace;


# 1.356 06-Oct-2006 mcbride

Document the fact that 'flags S/SA keep state' is now the implicit default,
as well as 'no state' and 'flags any' options.

ok jmc@


Revision tags: OPENBSD_4_0_BASE
# 1.355 12-Sep-2006 jmc

for apps which use interface groups, point to the section of
ifconfig(8) where they are explained;

ok mcbride mpf henning


# 1.354 31-Aug-2006 jmc

knock out the cpp/m4 stuff from MACROS; after discussion with many...


# 1.353 22-Aug-2006 dhartmei

back out -r1.497 (support for "tagged {}" lists), it broke "tagged" support
for nat rules. sorry, existing functionality trumps syntactic sugar. feel
free to resubmit a complete patch. closes PR 5207.


# 1.352 02-Aug-2006 dhartmei

in the BNF section, note that a comma is optional, closes PR 5191


# 1.351 25-Jul-2006 jmc

document "tos": pointed out by maxim bourmistrov
diff from jared r r spiegel

ok dhartmei


# 1.350 09-Jul-2006 mcbride

The timeout value is called src.track, not source-track.


# 1.349 18-Jun-2006 hshoexer

typo: queu -> queue

ok claudio@


# 1.348 28-May-2006 jmc

put previous in the correct place; ok mcbride


# 1.347 28-May-2006 mcbride

Adaptive timeouts are now on by default.


# 1.346 14-May-2006 deraadt

interface bandwidths can change; ok henning


# 1.345 01-May-2006 jmc

update the "tagged" line; ok dhartmei


# 1.344 01-May-2006 dhartmei

add support for "tagged {}" lists, from Pierre-Yves Ritschard


# 1.343 30-Apr-2006 jmc

- replace <> with .Aq
- replace OpenBSD with .Ox

from wiz@netbsd


# 1.342 14-Mar-2006 djm

implement a Unicast Reverse Path Forwarding (uRPF) check for pf(4)
which optionally verifies that a packet is received on the interface
that holds the route back to the packet's source address. This makes
it an automatic ingress filter, but only when routing is fully
symmetric.

bugfix feedback claudio@; ok claudio@ and dhartmei@


Revision tags: OPENBSD_3_9_BASE
# 1.341 20-Feb-2006 camield

new ftp-proxy

ok jmc markus


# 1.340 18-Jan-2006 joel

Document the "tables" and "table-entries" limit options.

ok jmc@ mcbride@


# 1.339 17-Nov-2005 joel

document "log (user)"

wording help and ok jmc@


# 1.338 16-Sep-2005 dhartmei

in the bnf section, clarify that "fastroute" takes no arguments. also fix
the literal parentheses around the "route/reply/dup-to" arguments.
from Karl O. Pinc, discussed with jmc@ and otto@


Revision tags: OPENBSD_3_8_BASE
# 1.337 06-Aug-2005 jmc

replace port number 8025 w/ symbolic `spamd';
ok krw@ deraadt@

diff from ray lai;


# 1.336 05-Aug-2005 dhartmei

document "set skip on" in the BNF grammar, from David Krause


# 1.335 14-Jun-2005 henning

the need to use stateful rules for tagging is gone


# 1.334 05-Jun-2005 jmc

(lightly) document carp(4) in reference to state table;

suggested by alexey e. suslikov;
better wording + ok joel@


# 1.333 03-Jun-2005 jmc

add an ipv6 example;

from alex kirk;
ok dhartmei@, unless i have badly misunderstood him;


# 1.332 02-Jun-2005 dhartmei

In the BNF section, remove one spurious "proto" and add one missing |.
Found by Magne Andreassen.


# 1.331 27-May-2005 dhartmei

s/log-all/log (all)/


# 1.330 26-May-2005 dhartmei

support 'log' and 'log-all' in 'nat/rdr/binat pass' rules. original patch
from camield@. use #defines PF_LOG, PF_LOGALL instead of magic constants.
ok frantzen@, camield@


# 1.329 26-May-2005 henning

sync with reality


# 1.328 23-May-2005 dhartmei

the BNF production is called "load-anchor", found by Magne Andreassen


# 1.327 18-May-2005 david

max-src-states typo; ok henning@


Revision tags: OPENBSD_3_7_BASE
# 1.326 01-Mar-2005 jmc

occurance -> occurrence;


# 1.325 27-Feb-2005 dhartmei

support 'tagged' in translation rules, non-delayed tag lookup
ok henning@, deraadt@


# 1.324 25-Feb-2005 joel

Mention that if a cbq/hfsc queue definition doesn't specify 'bandwidth'
that it defauls to 100% of the parent queue. Fix examples to match.

ok dhartmei@


# 1.323 24-Feb-2005 joel

Document the 'source-track' stateful tracking option. Heavy influence
from dhartmei and henning.

ok dhartmei@ henning@ jmc@ jaredy@


# 1.322 01-Jan-2005 pascoe

Fix some parse errors in example rules

ok henning@ dhartmei@


# 1.321 23-Dec-2004 jaredy

document icmp type/code text abbreviations recognized by pfctl

prodded by John Ladwig <jladwig@mango.lioness.net>

ok deraadt jmc


# 1.320 22-Dec-2004 dhartmei

Introduce 'set skip on <ifspec>' to support a list of interfaces where no
packet filtering should occur (like loopback, for instance).
Code from Max Laier, with minor improvements based on feedback from
deraadt@. ok mcbride@, henning@


# 1.319 22-Dec-2004 david

spacing


# 1.318 21-Dec-2004 mjc

update to indicate that return-rst generates packets
on bridges. Spotted by Simon Kirby.
proper caps from jmc@

ok dhartmei@


# 1.317 19-Dec-2004 jmc

route <label> rewording from otto@;
ok dhartmei@;


# 1.316 18-Dec-2004 mcbride

Better wording.


# 1.315 17-Dec-2004 henning

Michael Knudsen <e@molioner.dk> says:
"I think you messed something up when you committed this."
and he is right, I lost a word. Dang! And Thanks :)


# 1.314 12-Dec-2004 jmc

grammar and a little whitespace;


# 1.313 10-Dec-2004 henning

document matching on route labels
From: Michael Knudsen <e@molioner.dk>
jaredy ok


# 1.312 08-Dec-2004 dhartmei

and the example needs 'proto tcp' if it specifies a port, also from mpech@


# 1.311 08-Dec-2004 dhartmei

overload (not overflow) <table>, at least that's what the parser knows.
found by mpech@


# 1.310 07-Dec-2004 dhartmei

and don't lose the documentation for 'flush global'


# 1.309 07-Dec-2004 deraadt

tree does not compile, spotted by dlg (not obvious how to fix)
----
Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.308 07-Dec-2004 mcbride

Change the default for 'overload <table> flush' to flush only states from the
offending source created by the rule. 'flush global' flushes all states
originating from the offending source. ABI change, requires kernel and pfctl
to be in sync.

ok deraadt@ henning@ dhartmei@


# 1.307 04-Dec-2004 mcbride

Cleanup and remove a cut-n-pasto. From jmc@


# 1.306 04-Dec-2004 mcbride

Document 'max-src-conn', 'max-src-conn-rate', 'overflow <bad> flush'.


# 1.305 16-Nov-2004 mpf

Add "probability" to BNF
ok henning, markus


# 1.304 08-Nov-2004 aaron

Document "no scrub"; from jmc@, tweaked by me. dhartmei@ ok


# 1.303 28-Oct-2004 mcbride

s/timeout modulation/timestamp modulation/

ok frantzen@


# 1.302 18-Oct-2004 mcbride

'random-id' no longer applies only to outgoing packets.


# 1.301 21-Sep-2004 aaron

Implement "no scrub" to allow exclusion of specific traffic from scrub rules.
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok


Revision tags: OPENBSD_3_6_BASE
# 1.300 10-Sep-2004 jaredy

mention parent (..) anchors,
mention wildcard (*) anchors,
and mention quotes around anchor names.

ok dhartmei henning jmc


# 1.299 25-Aug-2004 jaredy

update w.r.t. recursive anchors
and fix an mdoc list display (from jmc)

ok dhartmei henning jmc


# 1.298 23-Aug-2004 jmc

differentiate between cbq and hfsc;

problem found by marc@; this diff based on a patch from sven at
sandcat dot nl; ok henning@;


# 1.297 09-May-2004 dhartmei

route-to -> reply-to in one case where it was swapped, from
Christopher Pascoe


# 1.296 05-May-2004 frantzen

Use RFC1323 PAWS timestamps as a logical extension to the conventional TCP
sequence numbers by taking advantage of the maximum 1KHz clock as an upperbound
on the timestamp. Typically gains 10 to 18 bits of additional security against
blind data insertion attacks. More if the TS Echo wasn't optional :-(
Enabled with: scrub on !lo0 all reassemble tcp
ok dhartmei@. documentation help from jmc@


# 1.295 24-Apr-2004 cedric

Add "probability xxx" rule modifier. ok deraadt@


# 1.294 04-Apr-2004 jmc

- fix an .El in the wrong place
- add a .Pp
- kill a stray space
- new sentence, new line

from Joel Knight;


# 1.293 31-Mar-2004 dhartmei

vender -> vendor, from John Bajana-Bacalle


Revision tags: OPENBSD_3_5_BASE
# 1.292 24-Feb-2004 mcbride

'source-track' not 'source-tracking'


# 1.291 04-Feb-2004 jmc

upper case ip;


# 1.290 04-Feb-2004 mcbride

Document 'set limit src-nodes'


# 1.289 06-Jan-2004 cedric

group-locked -> group-bound, from J. Knight


# 1.288 31-Dec-2003 jmc

typos;


# 1.287 31-Dec-2003 cedric

Many improvements to the handling of interfaces in PF.

1) PF should do the right thing when unplugging/replugging or cloning/
destroying NICs.

2) Rules can be loaded in the kernel for not-yet-existing devices
(USB, PCMCIA, Cardbus). For example, it is valid to write:
"pass in on kue0" before kue USB is plugged in.

3) It is possible to write rules that apply to group of interfaces
(drivers), like "pass in on ppp all"

4) There is a new ":peer" modifier that completes the ":broadcast"
and ":network" modifiers.

5) There is a new ":0" modifier that will filter out interface aliases.
Can also be applied to DNS names to restore original PF behaviour.

6) The dynamic interface syntax (foo) has been vastly improved, and
now support multiple addresses, v4 and v6 addresses, and all userland
modifiers, like "pass in from (fxp0:network)"

7) Scrub rules now support the !if syntax.

8) States can be bound to the specific interface that created them or
to a group of interfaces for example:

- pass all keep state (if-bound)
- pass all keep state (group-bound)
- pass all keep state (floating)

9) The default value when only keep state is given can be selected by
using the "set state-policy" statement.

10) "pfctl -ss" will now print the interface scope of the state.

This diff change the pf_state structure slighltly, so you should
recompile your userland tools (pfctl, authpf, pflogd, tcpdump...)

Tested on i386, sparc, sparc64 by Ryan
Tested on macppc, sparc64 by Daniel

ok deraadt@ mcbride@


# 1.286 15-Dec-2003 jmc

- kill whitespace at EOL
- new sentence, new line
- kill blank line
- missing .El
- missing escape
- ip -> IP
- greate -> create


# 1.285 15-Dec-2003 mcbride

Add support to track stateful connections by source ip. This allows us
to:
- Ensure that clients get a consistent IP mapping with load-balanced
translation/routing rules
- Limit the number of simultaneous connections a client can make
- Limit the number of clients which can connect through a rule

ok dhartmei@ deraadt@


# 1.284 29-Nov-2003 dhartmei

allow ':' (range including boundaries) to be used whereever '><' (range
excluding boundaries) is legal. already supported by kernel, requires only
removal of three error messages. ok henning@


# 1.283 24-Nov-2003 henning

fix load anchor BNF.
from Joel Knight


# 1.282 18-Nov-2003 dhartmei

more literal confusion, "(" ")" vs. ( )
the parentheses are required when using two queue arguments, and
optional when using one.


# 1.281 18-Nov-2003 dhartmei

un-quote "return" where it's meant to reference a bnf production
and not a literal.


# 1.280 14-Nov-2003 henning

update BNF for set debug too, again catched by mpech@


# 1.279 14-Nov-2003 henning

document "set debug"

ok jmc@ cedric@


# 1.278 08-Nov-2003 mcbride

Add 'no-sync' state option to prevent state transition messages for states
created by this rule from appearing on the pfsync(4) interface. e.g.

pass in proto tcp to self flags S/SA keep state (no-sync)

ok cedric@ henning@ dhartmei@


# 1.277 07-Nov-2003 mcbride

Add some missing mentions of 'synproxy state'

ok jmc@


# 1.276 06-Nov-2003 henning

document that label macros can now be used in tags as well
with help from and ok jmc@


# 1.275 30-Oct-2003 jmc

double word, from Tom Cosgrove;


# 1.274 24-Oct-2003 henning

consistently use $ext_if / $int_if in the examples
from jared r r spiegel <jrrs@ice-nine.org>
ok canacar@ jmc@


# 1.273 07-Oct-2003 deraadt

typo; ish


# 1.272 07-Oct-2003 henning

filename needs to be quoted...
ok mcbride@ jmc@


Revision tags: OPENBSD_3_4_BASE
# 1.271 02-Sep-2003 jmc

escape punctuation;
ok deraadt@


# 1.270 28-Aug-2003 jmc

tweak;
ok frantzen@


# 1.269 26-Aug-2003 dhartmei

mention that synproxy state takes the same options as keep/modulate state,
add synproxy to BNF. from mpech@. ok mpech@, henning@


# 1.268 24-Aug-2003 cedric

Tables can now be used in round-robin pools.
ok henning@


# 1.267 22-Aug-2003 david

pf spelling police
ok dhartmei@ jmc@


# 1.266 22-Aug-2003 frantzen

- roff indent fix from Max Laier. thanks!
- fix an example that became wrong when I switched from p0f v1 fingerprints
to p0f v2


# 1.265 22-Aug-2003 david

spelling


# 1.264 21-Aug-2003 frantzen

document passive OS fingerprinting


# 1.263 07-Jul-2003 jmc

fix a macro and remove a whitespace at EOL;
ok henning@


# 1.262 07-Jul-2003 henning

clarification in nat pass, pointed out by theo


# 1.261 07-Jul-2003 henning

I'm pretty sure the formatting cleanup & clarifications here that Joel Knight
did in negotiation with jmc@ included some dancing with dead chicken ritual

from Joel Knight
ok jmc@


# 1.260 04-Jul-2003 henning

nat pass
ok jmc@


# 1.259 17-Jun-2003 david

add adaptive, interval, and frag timeouts to pf.conf and BNF
ok henning@ dhartmei@


# 1.258 12-Jun-2003 henning

qlimit referenced twice from queueopts, PR 3312


# 1.257 11-Jun-2003 henning

ref table-rule from line, PR 3311


# 1.256 11-Jun-2003 pb

document that is is unsupported to use return-rst/icmp or synproxy
on bridging firewalls

henning@ ok, spelling fixes from jmc@


# 1.255 10-Jun-2003 deraadt

fix grammer regarding queues; noted by jlouis@mongers.org


# 1.254 07-Jun-2003 henning

update BNF to show that tagging is also possible on rdr/nat/binat


# 1.253 07-Jun-2003 henning

second part of the diff from Joel Knight that was sitting in my inbox for
far too long:
better tag documentation.

help and ok jmc@


# 1.252 07-Jun-2003 henning

update BNF to include "! tagged"


# 1.251 07-Jun-2003 henning

document "load anchor from file"
mostly from Joel Knight
help and ok jmc@


# 1.250 03-Jun-2003 henning

make crystal clear that NAT happens before filtering and what that
means for the filter rules.
from Joel Knight again

ok cedric@, silence everybody else


# 1.249 02-Jun-2003 david

revert to previous BNF formatting; requested by deraadt@
ok deraadt@ dhartmei@
CVSt e---------------------------------------------------------------------


# 1.248 30-May-2003 henning

the secgtion is called QUEUEING, not QUEUE RULES, so point people to
QUEUEING and not QUEUE RULES...

found by Joel Knight


# 1.247 23-May-2003 jmc

consistently uppercase abbreviations;
ok henning@


# 1.246 17-May-2003 henning

tweak; 10x jmc


# 1.245 17-May-2003 david

tweak
ok dhartmei@


# 1.244 17-May-2003 david

spelling fix


# 1.243 17-May-2003 henning

tweak


# 1.242 17-May-2003 david

document tags
ok henning@


# 1.241 16-May-2003 jmc

tweak;
ok dhartmei@


# 1.240 16-May-2003 dhartmei

TCP SYN proxy. Instead of 'keep state' or 'modulate state', one can use
'synproxy state' for TCP connections. pf will complete the TCP handshake
with the active endpoint before passing any packets to the passive end-
point, preventing spoofed SYN floods from reaching the passive endpoint.

No additional memory requirements, no cookies needed, random initial
sequence numbers, uses the existing sequence number modulators to translate
packets after the handshakes.

ok frantzen@


# 1.239 16-May-2003 jmc

removed unnecessary macros:
- don't need .Pp before/after .Sh
- don't need .Ns before punctuation

ok krw@ millert@ david@


# 1.238 15-May-2003 jmc

tweak;
ok frantzen@


# 1.237 15-May-2003 frantzen

document scrub opt "reassemble tcp"


# 1.236 12-May-2003 dhartmei

Use an example that acutally makes some sense.


# 1.235 12-May-2003 dhartmei

Adaptive timeout value scaling. Allows to reduce timeout values as the
number of state table entries grows, so entries time out faster before
the table fills up. Works both globally and per-rule. ok frantzen@


# 1.234 11-May-2003 frantzen

document the dynamic min-ttl TCP scrub behavior


# 1.233 10-May-2003 dhartmei

'return' now causes an ICMP unreachable for non-TCP/UDP/ICMP protocols.


# 1.232 10-May-2003 pb

uppercase all non-literals in BNF.. might make some stuff more clear ;)

commitski henning@


# 1.231 10-May-2003 pb

quote non-alphabetic literals

'over the desk' oks..


# 1.230 10-May-2003 henning

BNF for load anchor stuff


# 1.229 06-May-2003 henning

fix formatting in the BNF


# 1.228 01-May-2003 henning

BNF update for label on antispoof


# 1.227 29-Apr-2003 henning

document hfsc
mostly from Berk D. Demir <bdd at ieee.org> with tweaks by me
some nits and ok jmc@


# 1.226 29-Apr-2003 dhartmei

port 8081 -> 8021 for ftp-proxy in the examples, so it matches pf.conf
and inetd.conf defaults


# 1.225 25-Apr-2003 jmc

added two missing .El macros;

ok henning@


# 1.224 19-Apr-2003 henning

BNF update for hfsc


# 1.223 19-Apr-2003 henning

mention hfsc.
this needs more work.


# 1.222 05-Apr-2003 henning

document queue .. on $interface

ok jmc@


# 1.221 01-Apr-2003 pb

'flags X' is not valid (BNF lied)

henning@ ok


# 1.220 01-Apr-2003 pb

anchors in BNF
(from loki at niteshade . net)


Revision tags: OPENBSD_3_3_BASE
# 1.219 22-Mar-2003 david

Cleanup for release:

remove some unneeded escaping of spaces "\ "
indent by 6 spaces in a few places to match the rest of the file
fix a few lines that were improperly wrapped or not wrapped to the next line
update sample rule expansion to match current state of pfctl output
fix spacing in a few places
fix a small typo found by jmc@
updated a few example rules so that they parse with current pfctl

ok henning@ jmc@


# 1.218 20-Mar-2003 david

replace some .Pp inside .Bd -literal block with empty line
remove an uneeded .Pp
kill whitespace at eol

ok jmc@


# 1.217 13-Mar-2003 henning

and bandwidth is bits per second


# 1.216 13-Mar-2003 deraadt

bits not bytes; fk@spoiled.org


# 1.215 12-Mar-2003 henning

fair amount of clarifications, extensions, and corrections
from joel knight <enabled at myrealbox.com>, some tweaks by me, some by jmc@

ok dhartmei@ mcbride@ cedric@


# 1.214 10-Mar-2003 jmc

small changes to mike's random-id section;
ok frantzen@


# 1.213 10-Mar-2003 deraadt

use Pa for paths more


# 1.212 10-Mar-2003 deraadt

few minor tweaks


# 1.211 10-Mar-2003 jmc

removal of .Ic for examples.
this was messing the postscript output.


# 1.210 09-Mar-2003 frantzen

- document that scrub 'no-df' is sometimes necessary for "certain" OS's NFS
- suggest 'random-id' with 'no-df' since "certain" OSes set ip->ip_id to zero
ok deraadt@ henning@


# 1.209 06-Mar-2003 david

date should be written formally: .Dd Month day, year
also fixes a few misspellings of the month
ok henning@ jmc@


# 1.208 04-Mar-2003 dhartmei

Add a paragraph explaining possible unwanted side-effects of redirecting
to the loopback address.


# 1.207 04-Mar-2003 deraadt

more oops


# 1.206 04-Mar-2003 deraadt

oops


# 1.205 04-Mar-2003 deraadt

wrap Ic in Xo/Xc until fixed


# 1.204 04-Mar-2003 frantzen

leave my cave to clarify the caveats of state modulation
mdoc incantations from jmc@
ok henning@ deraadt@


# 1.203 04-Mar-2003 deraadt

show example of string concat in macro assign


# 1.202 04-Mar-2003 henning

fix .Bl width, pt out by theo


# 1.201 04-Mar-2003 dhartmei

Fix limit BNF part, since we don't quote token literals, use limit-item,
and limit-list is already a list (due to the recursive definition) which
can also consist of just one entry, so no need for {}.
Found by Maik Kuendig


# 1.200 04-Mar-2003 pb

update BNF for 'queue ( q_def, q_pri )' and similar in filteropts

ok henning@


# 1.199 04-Mar-2003 dhartmei

other.single was missing in the BNF section, from Maik Kuendig


# 1.198 04-Mar-2003 henning

format nicer


# 1.197 04-Mar-2003 henning

lies


# 1.196 04-Mar-2003 henning

make the label example actually work... (missing quotes)


# 1.195 04-Mar-2003 henning

fix .Bl width in translation section


# 1.194 04-Mar-2003 henning

fix width in set block-policy list


# 1.193 04-Mar-2003 henning

pfctl -T create is no more


# 1.192 04-Mar-2003 henning

remove lies about queueing and finally take into account that we have more
than one scheduler, explain a bit more how that works etc etc
english(4) police passed in persona jmc@, ok pb@


# 1.191 03-Mar-2003 deraadt

we mean: macros are not expanded inside quotes


# 1.190 02-Mar-2003 henning

cbq control keyword is gone


# 1.189 02-Mar-2003 dhartmei

The (optional) priority queue is also used for TCP ACKs without data
payload now.


# 1.188 28-Feb-2003 henning

note that default and control queue must not be identical


# 1.187 21-Feb-2003 henning

typo; Mr. Manpagebeauty Krause. Thanks!


# 1.186 18-Feb-2003 pb

add PRIQ scheduler to BNF

henning@ ok


# 1.185 14-Feb-2003 henning

more krause tweaks


# 1.184 13-Feb-2003 henning

be consistent when listing the different rule type for order requirement

krause


# 1.183 13-Feb-2003 henning

grammar; krause

ok jmc@


# 1.182 13-Feb-2003 henning

new sentence, new line


# 1.181 13-Feb-2003 jmc

typos;

setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com


# 1.180 12-Feb-2003 mcbride

Fix BNF for rdr and nat to match merge of rdr and nat parsing.


# 1.179 10-Feb-2003 jmc

queuing -> queueing for consistency

from openbsd@davidkrause.com via henning@


# 1.178 10-Feb-2003 dhartmei

Add random-id to BNF syntax, clean up superflous []
Reported by Dries Schellekens


# 1.177 08-Feb-2003 dhartmei

Add scrub option 'random-id', which replaces IP IDs with random values
for outgoing packets that are not fragmented (after reassembly), to
compensate for predictable IDs generated by some hosts, and defeat
fingerprinting and NAT detection as described in the Bellovin paper
http://www.research.att.com/~smb/papers/fnat.pdf. ok theo@


# 1.176 03-Feb-2003 mpech

Add blank space inside '.Xr Ic'.
Spotted by xvenient@free.fr via henning@.

millert@


# 1.175 02-Feb-2003 henning

typo in anchor section
From: Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.174 02-Feb-2003 henning

nicer indentation in the queue example
inspired by a mail to tech@ from
Eduardo Augusto Alvarenga <eduardo at thrx.dyndns.org>


# 1.173 01-Feb-2003 mcbride

The network interface is not mandatory for translation rules.

ok dhartmei@


# 1.172 30-Jan-2003 henning

document :network and :broadcast modifiers
help jmc@


# 1.171 25-Jan-2003 cedric

Make pf.conf reflect all changes that occured in the last 2 weeks.


# 1.170 25-Jan-2003 jmc

s -> z; thanks naddy@

ok deraadt@


# 1.169 24-Jan-2003 jmc

Changed: - Am. Eng. -> Br. Eng.
eg. normalization -> normalisation
- examples/commands in white bold face
- .Pa macros -> .Ar
- ordered SEE ALSO
- removed double quotes from GRAMMAR section
- some grammar typos

ok deraadt@


# 1.168 23-Jan-2003 mcbride

- rework Tables section in the introduction (pointed out by Theo)
- Macros and Tables can appear anywhere in pf.conf
- Since tables are no longer just a rule option, move the section up
appropriately.

ok dhartmei@


# 1.167 23-Jan-2003 mcbride

Cleanup of TABLES section.

Help with english language jmc@

ok dhartmei@ cedric@


# 1.166 21-Jan-2003 jmc

typos;
ok deraadt@


# 1.165 15-Jan-2003 henning

at least mention the PRIQ scheduler.
more to come...


# 1.164 10-Jan-2003 cedric

Tipo in tabledef grammar. Found by Rukh <openbsd@rukh.net>


# 1.163 09-Jan-2003 cedric

Add support for active/inactive tablesets in the kernel.
Add table definition/initialisation construct in pfctl parser.
Add and fix documentation for pf.4 and pf.conf.5.
Tested on i386 and sparc64 by myself, macppc by Daniel.
ok dhartmei@


# 1.162 30-Dec-2002 mcbride

Match changes to pfctl and /etc/protocols. ipv6-icmp-type becomes icmp6-type;
"proto ipv6-icmp" still works, but prefer icmp6, since we have icmp6(4),
not ipv6-icmp(4).

ok dhartmei@ henning@


# 1.161 30-Dec-2002 dhartmei

Remove stray 'hosts' on the nat-rule production in BNF, found by
Benjamin M.A. Robson.


# 1.160 28-Dec-2002 mcbride

More direct explanation of where the port number and protocol number to name
mappings come from.

ok dhartmei@ henning@


# 1.159 24-Dec-2002 mcbride

More cleanup.

- s/Em/Pa/ where appropriate
- get rid of references to spews and Tomcat
- more simplification by removal of direction
- timeout values are no longer a pfctl(8) thing

yes! henning@


# 1.158 23-Dec-2002 henning

do not mention optimization default, as "set optimization default" is not
parseable. "normal" is exactly the same, so use that.
good catch by David Krause (again).


# 1.157 23-Dec-2002 mcbride

Fix typo, pointed out by Dries Schellekens


# 1.156 23-Dec-2002 mcbride

A nudge towards reality:
- direction is now optional
- better way of specifying drop return rules
- wrap some lines which are too long.

ok dhartmei@ henning@


# 1.155 22-Dec-2002 henning

consistency; grange@


# 1.154 18-Dec-2002 deraadt

how the heck did such a stupid mistake end up in here


# 1.153 16-Dec-2002 henning

nat after queue, good catch by marc@


# 1.152 13-Dec-2002 henning

minor glitch in the queue example


# 1.151 13-Dec-2002 henning

document extended queue syntax
help theo


# 1.150 10-Dec-2002 margarida

More nitpicking.
Correct placement of .Pp.
(Europeans do use nroff -mandoc)

deraadt@ henning@ ok


# 1.149 10-Dec-2002 margarida

More coherency: rule set(s) -> ruleset(s)

deraadt@ henning@ ok


# 1.148 09-Dec-2002 deraadt

show user & group correctly


# 1.147 09-Dec-2002 deraadt

ARRHGHGHGHGHGHGH


# 1.146 09-Dec-2002 henning

document the "all" keyword; Theo


# 1.145 09-Dec-2002 deraadt

two powerful words the germans should know: which and such


# 1.144 08-Dec-2002 henning

"flags X" is long dead, the /Y is mandantory now.
fix BNF and remove a now bogus comment
noticed during discussion with gustavo


# 1.143 08-Dec-2002 henning

typo; gustavo


# 1.142 08-Dec-2002 deraadt

scheduler keyword dies


# 1.141 08-Dec-2002 deraadt

BNF improvement: show that queue options are now flexible


# 1.140 07-Dec-2002 dhartmei

Support parameters in anchor rules. Allows conditional evaluation, like:

anchor spews inet proto tcp from any to any port smtp

ok deraadt


# 1.139 07-Dec-2002 deraadt

repair BNF to show that filter-opts can now be flexibly ordered a
pass/block line


# 1.138 06-Dec-2002 dhartmei

Introduce anchors and named rule sets, allowing to load additional rule
sets with pfctl and evaluate them from the main rule set using a new type
of rule (which will support conditional evaluation soon). Makes
maintenance of sub-rulesets simpler for pfctl and daemons.

Idea and ok deraadt@


# 1.137 05-Dec-2002 henning

typos; Dries Schellenkens, Thanks!


# 1.136 05-Dec-2002 deraadt

more tweaking. things above STATEFUL INSPECTION are now ok


# 1.135 03-Dec-2002 henning

add back clarification about percentage bandwidth spec; was accidently
removed; negotiated with harding@


# 1.134 03-Dec-2002 deraadt

merge tweaks from harding


# 1.133 02-Dec-2002 henning

explain bandwidth specs better and cope with the last changes


# 1.132 01-Dec-2002 henning

little clarification about the valid priority numbers


# 1.131 28-Nov-2002 henning

+qlimit
+tbrsize


# 1.130 27-Nov-2002 deraadt

more tweaking


# 1.129 27-Nov-2002 deraadt

move even closer to where we want to be


# 1.128 26-Nov-2002 deraadt

more tweaks


# 1.127 26-Nov-2002 deraadt

tiny spacing nit


# 1.126 26-Nov-2002 mcbride

Fix various nits:
- references to ip(4) et. al.
- Remove extra whitespace
- Finish some uncompleted sentences
- s/traffic shaping/bandwidth control/

ok deraadt@, frantzen@


# 1.125 26-Nov-2002 henning

fancier queue example


# 1.124 26-Nov-2002 henning

fix queue example


# 1.123 26-Nov-2002 deraadt

more cleanup


# 1.122 26-Nov-2002 deraadt

more cleanup, and nat parts from mcbride


# 1.121 25-Nov-2002 deraadt

another pass, sigh


# 1.120 25-Nov-2002 henning

fix queue example


# 1.119 25-Nov-2002 deraadt

more crap tuning


# 1.118 25-Nov-2002 deraadt

I am sick of this thing. It does not follow the rules of manual pages.
Reoganize it, start to use the proper commands that one uses when writing
man pages, and damn well do not continue to make this a "different for
the hell of it" game. One writes manual pages by reading the source of
others; if you cannot do it that way, stay the hell away.


# 1.117 24-Nov-2002 henning

consistency; s/nat/translation/ a few times

ok pb@ mcbride@


# 1.116 24-Nov-2002 pb

we "now" have /usr/share/pf
short descr about the items

henning "go ahead, schnellschnellschnell"


# 1.115 24-Nov-2002 pb

reflect new ordering requirements (..nat, queue, filter)


# 1.114 24-Nov-2002 pb

RIO is not yet in GENERIC

henning@, kjc@ ok


# 1.113 23-Nov-2002 mcbride

document "nat pools" changes

syntax may still change somewhat

ok dhartmei@ henning@


# 1.112 20-Nov-2002 pb

BNF update:
o catch up with queuespec change (no 'queue' in altq_rule)
o there cant be a lonely number for bandwidth
o s/k/K/ for queue_rule also

henning@ ok


# 1.111 20-Nov-2002 pb

Xr altq bu-bye

henning@ ok


# 1.110 19-Nov-2002 deraadt

talk about pass and block and queue


# 1.109 19-Nov-2002 pb

.Sh QUEUE RULES

more to come..

previous fixes from various ppl included:
ok henning@, mcbride@


# 1.108 19-Nov-2002 pb

"fix" .Nd, "they do not need to know"

request by deraadt@


# 1.107 19-Nov-2002 henning

kb -> Kb


# 1.106 19-Nov-2002 pb

first catch up with altq merge:
-Nd: catch on man -k altq/queue
-Xr
-BNF: should leave enough place/logic for more then cbq

henning@ "commit" ok


# 1.105 13-Nov-2002 dhartmei

Add label macro $if, as we support {} list expansion for interfaces now.
From David Gwynne. ok henning@, camield@


# 1.104 08-Nov-2002 mpech

Time to cleanup:
o) start new sentence on a new line;
o) wrap long lines;
o) don't use .Pp before/after .Sh, .Ss;
o) OpenBSD -> .Ox;
o) typos;
o) close .Rs;
o) use space between arguments in tag, for example:
.Xr blabla ) .

miod@ ok


# 1.103 06-Nov-2002 henning

2x spelling, Jolan Luff, Thanks!


# 1.102 04-Nov-2002 dhartmei

state-opt = "max" seconds -> number, it limits the number of states not
time. ok henning@, pb@


# 1.101 31-Oct-2002 pb

document 'set require-order (yes|no)'
mini-BNF fix

henning@ ok


# 1.100 31-Oct-2002 henning

spelling; Jolan Luff, thanks!


# 1.99 27-Oct-2002 pb

Remove 'flags X' syntax, if people make heavy use of X/FOOBAR, they
chould use macros, e.g.
tcpinit="S/SAFR"
pass in ... flags $tcpinit


# 1.98 14-Oct-2002 deraadt

.Cm inside .Bd -literal screws up


# 1.97 14-Oct-2002 henning

grammar & formatting
From: Jolan Luff <jolan@cryptonomicon.org>, who is no i386 wheenie ;-)
Thanks!


# 1.96 14-Oct-2002 henning

document binat netblocks
from ryan


# 1.95 14-Oct-2002 henning

your -> one's
From: Gregory Steuck <greg@nest.cx>
Thanks!


# 1.94 13-Oct-2002 henning

talk about lo0 issues
from Gregory Steuck greg at nest dot cx


# 1.93 09-Oct-2002 henning

document the extended return-icmp syntax, block return, block drop and set
block-policy.

from ryan

ok dhartmei@


# 1.92 07-Oct-2002 dhartmei

Add 'reply-to' to filter rules, similar to route-to, but applying to
replies (packets that flow in the opposite direction of the packet that
created state), used for symmetric routing enforcement.
Document how route-to and reply-to work in context of stateful filtering.


# 1.91 05-Oct-2002 dhartmei

Allow filtering based on IP header's tos field.


# 1.90 04-Oct-2002 henning

new sentence, new line
pointed out by Dries Schellekens, Thanks!


Revision tags: OPENBSD_3_2_BASE
# 1.89 30-Sep-2002 frantzen

document fragcache
comments jasoni@, deraadt@. ok henning@ and deraadt@
i'm sure at least one man page nazi will find something in it though


# 1.88 28-Sep-2002 deraadt

better word; ish


# 1.87 26-Sep-2002 henning

document extended antispoof
some help nick@ and frantzen@
ok theo


# 1.86 18-Sep-2002 henning

not good; back to old version


# 1.85 18-Sep-2002 henning

nicer english, use Packet Filter instead of packet filter
work by nick@ and a bit nitpicking by me

ok pb@


# 1.84 15-Sep-2002 henning

consistency


# 1.83 15-Sep-2002 henning

don't forget to mention options in the always famous "Rules must be in order"


# 1.82 12-Sep-2002 henning

explain antispoof
most work by nick@


# 1.81 12-Sep-2002 henning

BNF for antispoof


# 1.80 12-Sep-2002 henning

nicer


# 1.79 06-Sep-2002 henning

yes, you can specify the address family in nat/rdr/binat rules.
noticed through a misc@ mail by Paul de Weerd


# 1.78 10-Aug-2002 pb

move section parameters more upwards, include section quick and logging
as a subsection (style changes later)

ok henning@, frantzen@


# 1.77 08-Aug-2002 pb

remove explanations of external programs (pfctl/tcpdump)

ok henning@, dhartmei@, frantzen@


# 1.76 04-Aug-2002 pb

.SH -> .Sh NAT EXAMPELS


# 1.75 30-Jul-2002 pb

BNF is now in sync with reality:
- commas are optional in lists

ok henning@, dhartmei@


# 1.74 30-Jul-2002 pb

BNF catchup and consolidation of interface name handling:

ok henning@, dhartmei@


# 1.73 30-Jul-2002 pb

Merge filter and nat BNF for simplification:
- top of reduction is now 'line', better to add more keywords later on
- reorder, group
- remove double productions

ok dhartmei@, henning@


# 1.72 30-Jul-2002 pb

BNF catchup to reality:
- set loginterface none
- add "self" to hosts

ok henning@


# 1.71 30-Jul-2002 pb

typo/pasto in route-to/dup-to syntax
ok henning@


# 1.70 30-Jul-2002 pb

.Sh GRAMMAR moves to bottom, it's a reference and not readable
for the casual user in first place

ok henning@


# 1.69 30-Jul-2002 pb

65335->65535 typo
henning ok@


# 1.68 30-Jul-2002 pb

backout, this will go in in little pieces
as advised by theo and henning


# 1.67 29-Jul-2002 pb

o complete restructuring
o BNF has been fixed and should represent -current as close as possible
o theo: commit this, and then let us get started fixing it.


# 1.66 21-Jul-2002 deraadt

fix route-to also


# 1.65 05-Jul-2002 henning

document "set loginterface none"


# 1.64 04-Jul-2002 henning

document setting options in pf.conf
ok dhartmei@


# 1.63 01-Jul-2002 dhartmei

Language improvements and line wrapping fixes, from Moritz Jodeit


# 1.62 24-Jun-2002 dhartmei

Fix more example rules


# 1.61 20-Jun-2002 dhartmei

Use 'inet' in translation rules where required, add example for proxy
port selection. From jolan at enteract dot com


# 1.60 20-Jun-2002 mpech

typo from form@.


# 1.59 20-Jun-2002 mpech

Spotted by form@, mdoc things from mpech@:
o) wrap long lines;
o) start new sentence on a new line;
o) 41952 -> 49151;
o) add 'flags S/SA' in "FILTER EXAMPLES";
o) remove blank lines before .Ed;

dhartmei@, henning@


# 1.58 16-Jun-2002 henning

merge nat.conf.5
most work by Chris Kuethe, some changes by me.
ok dhartmei@, pb@


# 1.57 14-Jun-2002 todd

spelling; from Brian Poole <raj@cerias.purdue.edu>


# 1.56 08-Jun-2002 dhartmei

.Xr pf.conf 5 . -> pfctl 8, from Dries Schellekens


# 1.55 08-Jun-2002 henning

no macro concatenation


# 1.54 08-Jun-2002 dhartmei

'(' -> "(" in BNF, from Dries Schellekens


# 1.53 08-Jun-2002 henning

document macro concatenation
ok dhartmei@


# 1.52 08-Jun-2002 dhartmei

Make state timeouts configurable per rule, like

pass in from any to any port www keep state (tcp.established 60)

ok frantzen@


# 1.51 08-Jun-2002 henning

document $proto, $nr in rule labels
add example
ok dhartmei@


# 1.50 07-Jun-2002 pb

add the possibility to configure a TTL while return-rst

ok dhartmei@, ipv6 part itojun@ ok


# 1.49 07-Jun-2002 dhartmei

Add "(max <number>)" option for "keep/modulate state" to limit the number
of concurrent connections a rule can create. ok frantzen@


# 1.48 07-Jun-2002 henning

document $srcaddr/$srcport/$dstaddr/$dstport in rule labels
ok dhartmei@


# 1.47 01-Jun-2002 hugh

Document ECN support, with input from dhartmei@.


# 1.46 12-May-2002 dhartmei

Explain that user/group 'unknown' can only be used with operators = and !=
and refuse other constructs in the parser. Also note that 'user >= 0' does
not match forwarded packets with unknown user ID.


# 1.45 12-May-2002 dhartmei

Add gid based filtering, reduce to one (effective) uid, rename parser
keywords to 'user' and 'group'.


# 1.44 09-May-2002 jasoni

Add a max-mss option to the scrub rule which will enforce a maximum mss
by lowering it to the given value.
- ok dhartmei@, provos@


# 1.43 09-May-2002 dhartmei

Introduce user based filtering. Rules can specify ruid and euid (real and
effective user ID) much like ports. The user of a packet is either the
user that opens an outgoing connection, the one that listens on a socket,
or 'unknown' if the firewall is not a connection endpoint (for forwarded
connections). Socket uid lookup code from jwk@bug.it.


# 1.42 08-May-2002 jasoni

move route grammar to a more logical place, suggested by malachi@vaned.net
- ok dhartmei@


# 1.41 30-Apr-2002 mpech

typo: form -> from. From form@


# 1.40 24-Apr-2002 dhartmei

Add dynamic (in-kernel) interface name -> address translation. Instead of
using just the interface name instead of an address and reloading the rule
set whenever the interface changes its address, the interface name can be
put in parentheses, and the kernel will keep track of changes and update
rules. There is no additional cost for evaluating rules (per packet),
the cost occurs when an interface changes address (and the rules are
traversed and updated where necessary).


# 1.39 23-Apr-2002 dhartmei

Allow explicit filtering of fragments when they are not reassembled.
Document fragment handling in the man page. Short version: if you're
scrubbing everything (as is recommended, in general), nothing changes.
If you want to deal with fragments manually, read the man page.
ok frantzen.


# 1.38 17-Apr-2002 dhartmei

50'000 -> 50000 (50,000 is equally wrong ;), from David Krause


Revision tags: OPENBSD_3_1_BASE
# 1.37 28-Mar-2002 mickey

looko; from Dries Schellekens <gwyllion@ace.ulyssis.org>


# 1.36 27-Mar-2002 mickey

implement a "no-route" keyword.
usage semantics are analogous w/ "any", meaning is
"any ip address for which there is no route in the
current routing table", could be used in both from and to.
typical usage would be (assuming symmetrical routing):
block in from no-route to any
also doc "any" in the pf.conf.5, include in regress, etc.
tested by me on i386 and sparc.
dhartmei@ and frantzen@ ok


# 1.35 17-Mar-2002 dhartmei

Add references to FILES and SEE ALSO sections. From David Krause.


# 1.34 07-Mar-2002 dhartmei

Add interface-list to BNF, re-indent and wrap. Found by Attila Nagy.


# 1.33 23-Feb-2002 dhartmei

Mention that normalization happens before filtering, and that the position
of scrub rules (in relation to pass/block rules) is not relevant.


# 1.32 19-Feb-2002 dhartmei

Add a BNF production for address (interface name, host name, or numeric).
In the examples, change "port = x" -> "port x", since it's shorter and
valid.


# 1.31 15-Feb-2002 dhartmei

Correct BNF, unary port operators are optional and default to =,
"pass ... to any port = ssh" and "pass ... to any port ssh" are
equivalent.


# 1.30 27-Jan-2002 frantzen

clarify the caveats of state modulation a wee bit


# 1.29 09-Jan-2002 dhartmei

Add labels to rules. These are arbitrary names (not to be confused with
tags that will be used to tag packets later on). Add pfctl -z to clear
per-rule counters. Add pfctl -s labels to output per-rule counters in
terse format and only for rules that have labels. Suggested by
Henning Brauer.


# 1.28 07-Dec-2001 beck

add example for ftp-proxy data connections, to reduce some of the questions
on misc@. ok dhartmei@


# 1.27 26-Nov-2001 jasoni

add bnf and some documentation on fastroute/route-to/dup-to


# 1.26 24-Oct-2001 dhartmei

"minium" -> "minimum", ok deraadt@


Revision tags: OPENBSD_3_0_BASE
# 1.25 15-Oct-2001 dhartmei

Add 'allow-opts' to rules. Packets with IP options will be blocked by
default now, and can be allowed per rule. ok deraadt@


# 1.24 11-Oct-2001 dhartmei

Remove URL, the FAQ links to it.


# 1.23 11-Oct-2001 dhartmei

List possible flags (FIN, SYN, RST, PUSH, ACK, URG), suggested
by Todd Fries.


# 1.22 09-Oct-2001 dhartmei

man page corrections, from Brian J. Kifiak


# 1.21 07-Oct-2001 dhartmei

Add interface name to address translation to pfctl, document it and add
a regress test. Translation is done on rule set load-time only, so the
rule sets must be reloaded when an interface address changes.
parse.y patch from Cedric Berger. Similar patch from Jonathon Fletcher.
Thanks to both.


# 1.20 05-Oct-2001 mpech

Powered by @mantoya:
o) start new sentence on a new line;
o) minor mdoc fixes;
millert@ ok

Tip of the day: www.mpechismazohist.com


# 1.19 01-Oct-2001 dhartmei

Clean up example rule set. Use \ to wrap lines, use macro for interface name,
scrub in all.


# 1.18 01-Oct-2001 dhartmei

It's keep state and modulate state, not keep-state/modulate-state.


# 1.17 28-Sep-2001 dhartmei

Support underscores in macro names and document it in the man page.


# 1.16 25-Sep-2001 dhartmei

Update examples (af is required for proto icmp).


# 1.15 15-Sep-2001 jakob

describe pflogd usage; canacar@eee.metu.edu.tr, ok deraadt@


# 1.14 15-Sep-2001 frantzen

IPv6 support from Ryan McBride (mcbride@countersiege.com)


# 1.13 28-Aug-2001 dhartmei

Mention macro definition/expansion with an example.


# 1.12 25-Aug-2001 frantzen

PF ISN randomization. Or in trekkie techno-babble, ISN phase modulation.


# 1.11 19-Aug-2001 dhartmei

Parameter list expansion, documentation and examples.


# 1.10 31-Jul-2001 wilfried

allow to test that flags are unset, ok dhartmei@, mickey@


# 1.9 22-Jul-2001 krw

Fix times vs timed typo. Closes PR #1952.


# 1.8 20-Jul-2001 markus

fix example: you need 'proto' if you specify ports


# 1.7 20-Jul-2001 deraadt

first cut at a cleanup


# 1.6 17-Jul-2001 provos

talk about normalization


# 1.5 16-Jul-2001 dhartmei

improvements by mpech@. thank you.


# 1.4 16-Jul-2001 dhartmei

add some substance. formatting probably sub-standard. help appreciated.


# 1.3 10-Jul-2001 dhartmei

some .Pp removed, according to mpech@


# 1.2 09-Jul-2001 marc

Add missing closing paren


# 1.1 08-Jul-2001 dhartmei

first draft of pf.conf man page (just BNF grammar and example yet)