summaryrefslogtreecommitdiff
path: root/sys/net/pf_ioctl.c
AgeCommit message (Collapse)Author
2006-07-06allow rules to point to an alternate routing table, and tag packetsHenning Brauer
matching that rule so that the forwarding code later can use the alternate routing table fo lookups (not implemented yet). the tagging is "sticky", every matching rule modifies, just like the regular "tag". ok claudio hshoexer, hacked at r2k6
2006-05-28Enable adaptive timeouts by default, with adaptive.start of 60% of theRyan Thomas McBride
state limit and adaptive.end of 120% of the state limit. Explicitly setting the adaptive timeouts will override the default, and it can be disabled by setting both adaptive.start and adaptive.end to 0. ok henning@
2006-03-04With the exception of two other small uncommited diffs this movesBrad Smith
the remainder of the network stack from splimp to splnet. ok miod@
2006-01-06DIOCNATLOOK was forgotten in the second access control switch. it's aDaniel Hartmeier
read-only operation (looking up one state entry), so allow it when /dev/pf is opened read-only (allows squid to work read-only). from Andrey Matveev.
2006-01-06for DIOCCLRSTATUS (pfctl -Fi), reset 'Enabled for x' time, too. simplifiesDaniel Hartmeier
computations of change rates. unfortunately, I don't remember who suggested this.
2006-01-05bzero after malloc; ok dhartmeiTheo de Raadt
2005-12-10C99 section 6.8.6.4 says "A return statement with an expression shallKenneth R Westerback
not appear in a function whose return type is void." Lint agrees. ok (and C99 spec info) cloder@
2005-10-27Basic support for attaching states from pfsync to the correct rules.Ryan Thomas McBride
Applies only to rules in the main ruleset (not anchors) if the ruleset checksum matches. Necessary to fix the following for pfsync'd states: - per-rule limits on number of states - altq - rule-based settings such as timeouts More work to do re: nat rules, src-nodes, etc. NOTE: This is modifies the pfsync header and version number. Tools which process pfsync packets must be recompiled, and firewalls with different versions will not sync. ok mpf@ henning@ dhartmei@
2005-09-28Improve the safety of pf IOCTLs, taking into account that some paths can sleep.Christopher Pascoe
- Introduces a rw_lock in pfioctl so that we can have concurrent readers but only one process performing updates at a time; - Separates state expiry into "unlink" and "free" parts; anyone can unlink a state/src node from the RB trees at any time, but a state can only be freed whilst the write lock is held; - Converts state_updates into list state_list containing all states, regardless of whether they are "linked" or "unlinked"; - Introduces a new PFTM_UNLINKED state that is used on the "unlinked" states to signal that they can be freed; - Converts pf_purge_expired_state to an "unlink" state routine, which only unlinks the state from the RB trees. Freeing the state/src nodes is left to the purge thread, which runs whilst holding a write lock, such that all "next" references remain valid; - Converts pfsync_bulk_update and DIOCGETSTATES to walk state_list rather than the RB trees; - Converts the purge thread to use the new state_list and perform a partial purge every second, with the target rate a full state table walk every PFTM_INTERVAL seconds. seen by mcbride, henning, dhartmei pre-3.8, but too intrusive for then
2005-09-05in DIOCCHANGERULE, properly initialize table, if used in NAT rule.Daniel Hartmeier
from Boris Polevoy <vapcom at mail dot ru>, ok mcbride@
2005-08-18Malloc temporary buffers in pfioctl rather than having several largeChristopher Pascoe
pf_state buffers on the stack. ok henning mcbride
2005-08-18Rearrange pf_state and pfi_kif so that the parts of the structure neededChristopher Pascoe
to search for a particular entry in the RB trees are at the start of the structure. This permits us to place a much smaller structure on the stack in the interrupt paths that match packets against state entries. ok mcbride
2005-08-12Fill out interface name and state creation time correctly inChristopher Pascoe
DIOCGETSTATE. ok dhartmei mcbride
2005-08-07Do not blindly reset the state count to zero after a clear, as we may notChristopher Pascoe
have purged all states in the case when an interface name was specified. pf_purge_expired_states should decrease the count as appropriate. ok dhartmei
2005-08-07verify ticket in DIOCADDADDR, from Boris Polevoy, ok deraadt@Daniel Hartmeier
2005-08-05make three functions non-static (namespace is no issue, they might getDaniel Hartmeier
inlined), ok art@
2005-08-04instead of static locals, malloc/free. the goal is to reduce stack usage,Daniel Hartmeier
but statics are dangerous in case of concurrency. ok deraadt@
2005-08-02Instead of copying a table structure so we can mask off a bit beforeChristopher Pascoe
"validating" it, pass the bits to be ignored down to the validating function in its allowedflags argument. Saves a 1kB+ stack allocation. ok henning@
2005-08-01Use a string directly rather than making a copy, save on stack space.Christopher Pascoe
Use a static buffer for another large variable, pending further analysis. prodded deraadt
2005-07-31Perform pf state/rule/table expiry in a kernel thread instead of runningChristopher Pascoe
it out of a timeout handler. This means we will have process context, required when using the oldnointr pool allocator. Addresses pr4186, pr4273. ok dhartmei@ henning@ tedu@
2005-07-26Add missing newline to error message.Christopher Pascoe
2005-07-11add missing {} around TAILQ_FOREACH block, found by David HillDaniel Hartmeier
2005-06-30in order for pfvar.h not to conflict with openssl's crypto.h, useNikolay Sturm
PF_MD5_DIGEST_LENGTH instead of including crypto/md5.h ok markus@, henning@, mpf@
2005-06-13make the packet and byte counters on rules and src nodes per direction,Henning Brauer
matches the counters on states now. also fix the counting on scrub rules where we previously did not handle the byte counters at all. extend pfctl -sl output to include the new seperate in/out counters hacked on the ferry from Earls Cove to Saltery Bay ok ryan
2005-05-27Calculate an MD5 checksum over the main pf ruleset.Marco Pfatschbacher
This is the basis for further pfsync improvements, to ensure that pf rules are in sync with the master. "get it in" mcbride@
2005-05-27log two pairs of uid/pid through pflog: the uid/pid of the process thatDaniel Hartmeier
inserted the rule which causes the logging. secondly, the uid/pid of the process in case the logged packet is delivered to/from a local socket. a lookup of the local socket can be forced for logged packets with a new option, 'log (user)'. make tcpdump print the additional information when -e and -v is used. note: this changes the pflog header struct, rebuild all dependancies. ok bob@, henning@.
2005-05-21clean up and rework the interface absraction code big time, rip out multipleHenning Brauer
useless layers of indirection and make the code way cleaner overall. this is just the start, more to come... worked very hard on by Ryan and me in Montreal last week, on the airplane to vancouver and yesterday here in calgary. it hurt. ok ryan theo
2005-05-10In DIOCKILLSTATES: take into account the direction of the state whenJoel Knight
matching source and destination addresses/ports. ok henning@ dhartmei@ mpf@
2005-03-03when tagging, apply the same tag to all packets matching a state entryDaniel Hartmeier
(not just to the initial packet). note: kernel/userland abi change (rebuild pfctl). ok henning@
2005-01-05- Use defines from pfvar.h for timeoutsRyan Thomas McBride
- instead of erroring on an attempt to set hostid to 0, just set it with arc4random() ok henning@ dhartmei@
2004-12-22Introduce 'set skip on <ifspec>' to support a list of interfaces where noDaniel Hartmeier
packet filtering should occur (like loopback, for instance). Code from Max Laier, with minor improvements based on feedback from deraadt@. ok mcbride@, henning@
2004-12-10allow pf to filter on route labelsHenning Brauer
pass in from route dtag keep state queue reallyslow tested by Gabriel Kihlman <gk@stacken.kth.se> and Michael Knudsen <e@molioner.dk> and ryan ok ryan
2004-12-07KNFRyan Thomas McBride
2004-12-05after attaching an overload table, set its active flag. otherwise, theDaniel Hartmeier
table is not visible/accessible when the rule is the only reference (you don't HAVE to reference the table elsewhere).
2004-12-04Add kernel code to keep track of tcp connections which have completedRyan Thomas McBride
the 3-way handshake. Allow limits on both total connections and connection rate, put offenders in a table which can be used in the ruleset, and optionally kill existing states. Rate tracking code from dhartmei@. Adds a second pool for table entries using the default allocator, which allows entries to be added at splsoftnet(). ok deraadt@ dhartmei@
2004-12-01replace finer-grained spl locking in pfioctl() with a single broad lockDaniel Hartmeier
around the entire body. this resolves the (misleading) panics in pf_tag_packet() during heavy ioctl operations (like when using authpf) that occur because softclock can interrupt ioctl on i386 since SMP. patch from camield@. ok mcbride@, henning@ and (presumably ;) bob@
2004-09-21Implement "no scrub" to allow exclusion of specific traffic from scrub rules.Aaron Campbell
First match wins, just like "no {binat,nat,rdr}". henning@, dhartmei@ ok
2004-09-09Copy out anchors with relative paths and wildcards correctly,Daniel Hartmeier
from jaredy@, ok henning@, mcbride@, deraadt@
2004-07-22Add missing check for NULL in DIOCCHANGERULE. This prevents a crash inMathieu Sauve-Frankel
certain rare cases. ok mcbride@ dhartmei@
2004-07-05KNFHenning Brauer
2004-06-21First step towards more sane time handling in the kernel -- this changesThorsten Lockert
things such that code that only need a second-resolution uptime or wall time, and used to get that from time.tv_secs or mono_time.tv_secs now get this from separate time_t globals time_second and time_uptime. ok art@ niklas@ nordin@
2004-06-14Remove DIOCBEGINRULES, DIOCCOMMITRULES, DIOCBEGINALTQS, DIOCCOMMITALTQS,Cedric Berger
DIOCRINABEGIN, DIOCRINACOMMIT ioctls. Use DIOCXBEGIN/DIOCXCOMMIT/DIOCXROLLBACK instead. ok beck@ dhartmei@ henning@
2004-06-10rename struct pf_rule_addr member 'not' to 'neg', as 'not' is a reservedDaniel Hartmeier
keyword in C++. ok henning@, cedric@
2004-05-31thinko, reported by Fernando BragaDaniel Hartmeier
2004-05-21Use '/' instead of ':' as separator for anchor path components. Note thatDaniel Hartmeier
the parser now needs quotes around paths containing separators. ok mcbride@
2004-05-21copy out relative anchor paths correctlyDaniel Hartmeier
2004-05-19Allow recursive anchors (anchors within anchors, up to 64Daniel Hartmeier
levels deep). More work required, but this is already functional. authpf users will need to adjust their anchor calls, but this will change again soon. ok beck@, cedric@, henning@, mcbride@
2004-05-18In DIOCCHANGERULE, move ticket increment above code that might freeDaniel Hartmeier
the ruleset and invalidate the pointer. ok cedric@
2004-05-05Use RFC1323 PAWS timestamps as a logical extension to the conventional TCPMike Frantzen
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@
2004-05-03fix a stupid mistake in my previous commit.Kenjiro Cho
"if (error == 0)" should be "if (error != 0)".