summaryrefslogtreecommitdiff
path: root/sys/net/if_pfsync.c
AgeCommit message (Collapse)Author
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-02-20Fix kernel builds without bpfilter. Linking is still broken.Damien Bergamini
"Please commit this diff ASAP" brad@
2005-11-04crank pf_state and pf_src_node byte and packet counters to u_in64_t, sinceRyan Thomas McBride
we're breaking pfsync compatibility this cycle anyways. Requested by djm@, ok henning@, 'wheee!' deraadt@
2005-11-01Always sure that we have memory for the 'dst' scrub information, which mayChristopher Pascoe
not have been allocated at the initial state synchronisation time. ok henning@
2005-10-28s/rmatch/chksum_flag/ to clarify what's going on. Pointed out by dhartmei@Ryan Thomas McBride
Oh. and a KNF nit.
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-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-16Synchronise timestamp modulation and scrubbing min ttl information.Christopher Pascoe
ok henning mcbride, looks good frantzen
2005-08-11Remove bogus debug printf().Ryan Thomas McBride
ok ho@
2005-08-03Eliminate another case where pool routines are called without process context.Christopher Pascoe
Instead of purging immediately, let the state be purged at the purge interval. ok henning
2005-08-01Minor whitespace cleanup.Christopher Pascoe
2005-07-12default mtu to no more than ETHERMTU to avoid fragmentation; henning@ okMichael Shalayeff
2005-05-28Add SA replay counter synchronization to pfsync(4). Required for IPsecHakan Olsson
failover gateways. ok mcbride@, "looks good" hshoexer@
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-02-20Avoid use after free when purging states.Ryan Thomas McBride
ok henning@ dhartmei@ claudio@
2005-02-15Fix scoping error which could cause some states with an empty ifname to beAaron Campbell
purged errneously. mpf@ ok
2005-01-20sc->sc_sync_ifp = NULL if we fail to attach the multicast group.Ryan Thomas McBride
ok mpf@
2005-01-20Use syncdev instead of syncif in ifconfig, and modify ioctl struct pfsyncreqRyan Thomas McBride
in kernel code to match. Brings pfsync in line with carp, vlan and pppoe devices. Old syncif and -syncif options still work, will be removed later. ok markus@
2004-12-16Clean up handling of sync_flags.Ryan Thomas McBride
ok pascoe@
2004-12-13Set creation timestamps correctly on states learnt by pfsync that areChristopher Pascoe
more than a second old. ok mcbride@ henning@
2004-12-06At PFSYNC_ACT_CLR:Marco Pfatschbacher
Also purge states with an empty ifname. ok mcbride@
2004-11-16Fix for PR3983Ryan Thomas McBride
- Add a new PFSTATE_STALE flag to uncompressed state updates sent as a result of a stale state being detected, and prevent updates with this flag from generating similar messages. - For the specific case where the state->src in the recieved update is ok but the state.dst is not, take the partial update, then "fail" to let the other peers pick up the better data that we have. From Chris Pascoe. ok dhartmei@
2004-09-17Clean up reference counting wrt state creation and destruction. FixesRyan Thomas McBride
problems with adaptive timeouts, max-states limits, and rules not being freed from memory. Diff from Chris Pascoe. ok henning@ dhartmei@
2004-08-30Increment the states reference counter in the rule attached to the stateRyan Thomas McBride
being inserted, so that the counter does not wrap back when the state is removed. This fixes pfsync setups with adaptive timeouts. From Chris Pascoe ok canacar@ dhartmei@ henning@ deraadt@
2004-08-03Allow a unicast ip address to be specified for pfsync to send it's stateRyan Thomas McBride
updates to; this allows pairs of pfsync firewalls to protect the traffic with IPSec.
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-04Remove the multicast address when we unconfigure the syncif.Ryan Thomas McBride
2004-05-17fix uninitialized var; found by millert@Michael Shalayeff
2004-04-30Unbreak building pfsync without carp. Found by marc@Ryan Thomas McBride
2004-04-28Make carp(4) aware of its physical interface:Ryan Thomas McBride
- If the physical interface goes down or the link goes down, the carp interface goes down as well. - We treat this like the preemption holdoff with pfsync. So if one of the carp interfaces is known to be bad (because the physical interface it's associated with is bad), all the other carp interfaces back off: they won't preempt, and their advskew goes to 240. ok cedric@
2004-04-28point out that pfsync_send_bus and pfsync_sendout must be called in splnet()Philipp Buehler
ok mcbride@
2004-04-25get rid of a complete state tree walk at state expire while in splnet()Philipp Buehler
ok mcbride@ henning@
2004-04-25dont splx across functionsPhilipp Buehler
pointed at by Joris Vink who was baffeled how this should work anyway ok mcbride@ henning@
2004-04-05Prevent stale states (states older than the local version) from overwritingRyan Thomas McBride
the local state. Tricky state comparisons from frantzen@ ok cedric@ dhartmei@ Post-ok addition of code to broadcast an update with the better local version when this happens. Torture tested by beck@
2004-03-28Check variables in incoming packets which can cause problems if they're setRyan Thomas McBride
to arbitrary values. Invalid state->timeout can hit a KASSERT in pf, the other ones should be ok but we check them just to make sure. ok dhartmei@ deraadt@
2004-03-23Hold off for 1 second before beginning bulk transfer. Avoids loopingRyan Thomas McBride
until mono_time.tv_sec advances past the time the bulk transfer request was recieved. ok cedric@ deraadt@
2004-03-22Support for best effort bulk transfers of states when pfsync syncif isRyan Thomas McBride
configured. This this allows pfsync+carp clusters to come up gracefully without killing active connections. pfsync now prevents carp from preempting to become master until the state table has sync'd. ABI change, any application which use struct pf_state must be recompiled. Reminded about this by Christian Gut. Thanks to beck@ cedric@ and dhartmei@ for testing and comments. ok deraadt@
2004-02-20Make pfsync deal with clearing states bound to a group or interface (egRyan Thomas McBride
pfctl -i fxp0 -Fs). Also don't send out individual state deletions if we're sending a clear message, move pfsync_clear_states() inside splnet, and fix if_pfsync.h includes in pf.c and pf_ioctl.c. ok cedric@ dhartmei@
2004-02-10Make pfsync work correctly with IP options on 64-bit alignmentRyan Thomas McBride
sensitive CPUs. Pointed out by deraadt@.
2004-02-08Fix kernel panic which occurs under very high load:Ryan Thomas McBride
- Make sure we calculate the correct maximum size for PFSYNC_ACT_UREQ. - Make pfsync_sendout() return immediately if there is nothing to send.
2004-02-07Use the offset provided to us by m_pulldown(), rather than using size ofRyan Thomas McBride
ip and pfsync headers. This makes us behave correctly if the packet is spread across multiple mbufs (which does not appear to happen in practice).
2004-01-22- Include the value of pf_state.timeout in pfsync messagesRyan Thomas McBride
- Fix the expiry time calculations, for real - Unbreak the collapsing of multiple updates into one And a little KNF for good measure.
2004-01-20the pfsync interface does not have a baudrate, so don't claim 100 MBit/sHenning Brauer
ok mcbride@
2004-01-20Ignore pfsync packets if pf is not running.Ryan Thomas McBride
2004-01-19Update comment; handling PFSYNC_ACT_UPD in pfsync_input() is no longerRyan Thomas McBride
optional.
2004-01-19Clean up creation and expiry timestamp calculations.Ryan Thomas McBride
2003-12-31Many improvements to the handling of interfaces in PF.Cedric Berger
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@
2003-12-28Add a new PFSYNC_ACT_UREQ message type.Ryan Thomas McBride
A pfsync system which recieves a partial update for a state it cannot find can now request a full version of the update, and insert it. pfsync'd firewalls now converge more gracefully if one is missing some states (due to reset, lost insert packets, etc).
2003-12-18resolve compiler warnings, from Pyun YongHyeon, ok cedric@, mcbride@Daniel Hartmeier