summaryrefslogtreecommitdiff
path: root/sbin/pfctl/pfctl.c
AgeCommit message (Collapse)Author
2010-10-01Add the -R id option to pfctl that allows to show only a specified ruleReyk Floeter
by numeric ID in combination with the "-s rules" or "-s labels" options. For example, this allows you to dump the statistics of a specified rule only (pfctl -sr -v -R 0). ok henning@
2010-09-02remove trailing spaces and tabs; no binary change.Igor Sobrado
written with help from henning@, who suggested ensuring that there are no changes in the digests for object files, thanks! ok henning@
2010-08-11Fix a logic problem which could in theory cause pfctlJonathan Gray
to recursively print anchors with wildcards when not requested via the command line but in practice only applied to automatically generated inline anchors (which don't have wildcards) or when recursion was requested. Found by the clang static analyser and behaviour explained by mcbride@ ok henning@ mcbride@
2010-07-03Fix a couple of problems with printing of anchors, in particular recursiveRyan Thomas McBride
printing, both of inline anchors and when requested explicitly with a '*' in the anchor. - Correct recursive printing of wildcard anchors (recurse into child anchors rather than rules, which don't exist) - Print multi-part anchor paths correctly (pr6065) - Fix comments and prevent users from specifying multi-component names for inline anchors. tested by phessler ok henning
2010-07-01Fix 'pfctl -a anchor -Fa' segfault introduced in r1.298.Stefan Sperling
ok mcbride
2010-06-28Clean up iterface stats handling:Ryan Thomas McBride
- 'make -Fi' reset ALL the interface statistics can be restricted with -i ifname - 'make -Fa -i ifname' fail (it's meaningless) - get rid of a silly little struct that's only used for one thing ok henning
2010-06-25remove -m (merge).Henning Brauer
it is violating the transactional model we have and made stronger in pf, it is broken in some cases and since some options are passed to the kernel while some are userland only and affect how the rules are parsed it is complete bullshit anyway - obviously, changing options that affect ruleset parsing without reloading and thus reparsing the ruleset cannot work. so stop pretending it could and cut the crap. ok dlg krw deraadt
2010-04-02Use a dedicated variable to prevent attempting to open multipleStuart Henderson
ALTQ transactions when anchors are loaded. Fixes pfctl when using 'load anchor ... from' as seen by beck@ and Toni Mueller, which stopped working after r1.295 removed loadopt (which was overloaded to do this job as well as indicate command- line flags). ok henning@
2010-03-23remove -A, -O, -R and -T loadHenning Brauer
the partial loading of a ruleset (leaving ancors aside) is wrong and conflicts with the general idea of how pf works. last not least it breaks with the optimizer generating tables automagically. ok deraadt sthen krw manpage jmc
2010-01-18Convert pf debug logging to using log()/addlog(), a single standardisedRyan Thomas McBride
definition of DPFPRINTF(), and log priorities from syslog.h. Old debug levels will still work for now, but will eventually be phased out. discussed with henning, ok dlg
2010-01-13fix some leaks found by parfaitJonathan Gray
ok mcbride@ henning@
2010-01-12First pass at removing the 'pf_pool' mechanism for translation and routingRyan Thomas McBride
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
2009-12-10plug some memory leaks; found by parfait, ok henningTheo de Raadt
2009-11-22cleanup after the NAT changes. we used to have multiple rulesets (scrub,Henning Brauer
NAT, filter). now we only have one. no need for an array any more. simplifies the code quite a bit. in the process fix the abuse of PF_RULESET_* by (surprise, isn't it) the table code. written at the filesystem hackathon in stockholm, committed from the hardware hackathon in portugal. ok gcc and jsing
2009-10-28Add a dedicated pf pool for route options as suggested by henning,Jonathan Gray
which unbreaks ie route-to after the recent pf changes. With much help debugging and pointing out of missing bits from claudio@ ok claudio@ "looks good" henning@
2009-09-29sort usage();Jason McIntyre
2009-09-28add -S and -L options to store and load the pf state table from a file.David Gwynne
inspired by the short reboot times on an rb600a provided by stephan rickauer. testing and bugfixing by sthen@ ok mcbride@ sthen@
2009-09-03remove -N from usage();Jason McIntyre
2009-09-01the diff theo calls me insanae for:Henning Brauer
rewrite of the NAT code, basically. nat and rdr become actions on regular rules, seperate nat/rdr/binat rules do not exist any more. match in on $intf rdr-to 1.2.3.4 match out on $intf nat-to 5.6.7.8 the code is capable of doing nat and rdr in any direction, but we prevent this in pfctl for now, there are implications that need to be documented better. the address rewrite happens inline, subsequent rules will see the already changed addresses. nat / rdr can be applied multiple times as well. match in on $intf rdr-to 1.2.3.4 match in on $intf to 1.2.3.4 rdr-to 5.6.7.8 help and ok dlg sthen claudio, reyk tested too
2009-08-21remove the ``;'' at the end of INDENT() macro definition usingAlexandre Ratchov
the ``do { ... } while (0)'' construct. ok henning, from Frederic Culuot <frederic _at_ culot.org>
2009-07-09repair -xHenning Brauer
since all this stuff is transactional now we need to wrap that into DIOCXBEGIN/COMMIT. bad henning forgot to commit this chunk at c2k9
2009-04-16Really turn fragment reassembly on by default. pfctl must handle thisDavid Krause
since the DIOCSETREASS ioctl is called on every ruleset load and was overriding the initial setting in pfattach(). Fix setting of the global no-df bitmask as well. ok henning@
2009-04-061) scrub rules are completely gone.Henning Brauer
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.
2009-02-23back out last commit since it breaks a few regress tests -- this will beTheo de Raadt
looked at post-release -- out of time for these kinds of problems david@ says: pfopt6 and f91.ok; pfopt6 change looks ok, but pf91 is of concern.
2009-02-16fix pfctl -v printing of anchors, from camield@. Closes user/6065Stuart Henderson
2008-08-31avoid line wrap in usage() output;Jason McIntyre
2008-07-24check sysctl return valueHenning Brauer
From: Gleydson Soares <gsoares@gmail.com>, ryan ok
2008-05-27Fix count of states flushed, broken when the psnk_af hack was removed in ↵Ryan Thomas McBride
pf_ioctl.c r1.196.
2008-05-09Add support to kill states by rule label or state id.Marco Pfatschbacher
Fix printing of the state id in pfctl -ss -vv. Remove the psnk_af hack to return the number of killed states. OK markus, beck. "I like it" henning, deraadt. Manpage help from jmc.
2008-05-06Add a counter to record how many states have been created by a rule.Marco Pfatschbacher
It shows up in pfctl verbose mode and in the 7th field of the labels output. Also remove the label printing for scrub rules, as they do not support labels. OK dhartmei@ (on an earlier version), henning@, mcbride@
2008-02-13Use HW_PHYSMEM64.Mark Kettenis
ok henning@
2007-11-27typos; ok jmc@Martynas Venckus
sys/dev/pci/pciide.c from naddy@
2007-10-24HW_PHYSMEM is unsignedPeter Stromberg
yuck & ok henning@
2007-10-15specifying int instead of just unsigned is better styleTheo de Raadt
2007-10-13in all these programs using the same pfctl-derived parse.y, re-unify theTheo de Raadt
yylex implementation and the code which interacts with yylex. this also brings the future potential for include support to all of the parsers. in the future please do not silly modifications to one of these files without checking if you are de-unifying the code. checked by developers in all these areas.
2007-06-30allow states instead of just state for -s and -F for consistency's sake.Henning Brauer
since only the first letter matters in the end and state still matches states since we do strncmp this does not change xisting behaviour and just allows plural states to be used as well. pt out by Tom Van Looy <tom@ctors.net>
2007-05-31Cope with new ioctl interface (use pfsync_state instead of pf_state)Ryan Thomas McBride
ok henning@ toby@ pyr@
2007-04-21"o" in optiopt_list is superfluous now tooHenning Brauer
2007-04-21fix -o handling. syntax is now -o none|basic|profile. -o without argumentHenning Brauer
is invalid now, it doesn't serve any purpose any more anyway since that is the default. ok mcbride
2007-04-20no whitespace allowed between -o and its argument, so update doc/usage()Jason McIntyre
to reflect this; whilst there i had to wrap -t in Xo/Xc to stop line split, and i zapped some extra whitespace in usage(); fixes user/5441 from sthen
2007-03-21Enable basic ruleset optimization by default.Ryan Thomas McBride
ok deraadt henning
2007-03-01be more careful with mixing &/| with &&/||, ok ottoTheo de Raadt
2007-02-23if machine has more than 100MB of physmem, default the max table entriesTheo de Raadt
to 200,000 instead of the conservative 100,000; ok dhartmei beck tested by ckuethe
2007-02-09pfctl_clear_rule_counters() is not needed any moreHenning Brauer
2007-02-09use DIOCGETRULE ioctl & action set to PF_GET_CLR_CNTR to clear countersHenning Brauer
with -z instead of DIOCCLRRULECTRS. Unbreaks -z with anchors and makes the read & reset operation atomic. innstrument pfctl_show_rules() to clear counters while reading rules and add a new output format for it, showing nothing, if only resetting counters without actually displaying them is requested. minor cleanups on the way. ok dhartmei & agreement from theo and ryan
2007-01-18implement -T expire.Henning Brauer
"pfctl -t tablename -T expire 3600" would expire all entries in the given table that are older than 3600 seconds. ok dhartmei, manpage help & ok jmc
2006-11-20-K argument to kill source tracking nodes explicitly, behaves like theRyan Thomas McBride
-k argument for killing states; From Berk D. Demir <bdd@mindcast.org> ok dhartmei henning
2006-11-07Only try to recursively print rules if they are actually anchors.Ryan Thomas McBride
2006-11-07Unbreak authpf by handling non-inline anchors separately from the { } anchorsRyan Thomas McBride
as pf_find_or_create_ruleset() will mangle relative anchor names and wildcards. Also fixes some nits with nesting and printing inline anchors. ok deraadt@
2006-11-05Don't open a transaction for a ruleset unless it's a brace ruleset thatRyan Thomas McBride
contains rules. Fixes DIOCXCOMMIT: Device busy when multiple anchors with the same name are specified. reported by ckuethe@ and mkb@crypt.org.ru