Commit Graph

286 Commits

Author SHA1 Message Date
drochner 31eddb04eb remove unused expression 2011-05-18 12:54:15 +00:00
hauke 51a9336da1 Commit the patch from
<http://mail-index.netbsd.org/current-users/2010/09/12/msg014289.html>,
fixing a "panic: pool 'pfrktable' is IPL_NONE, but called from
interrupt context" that occurred on NetBSD/sparc.
2011-05-11 12:22:34 +00:00
dyoung c2e43be1c5 Reduces the resources demanded by TCP sessions in TIME_WAIT-state using
methods called Vestigial Time-Wait (VTW) and Maximum Segment Lifetime
Truncation (MSLT).

MSLT and VTW were contributed by Coyote Point Systems, Inc.

Even after a TCP session enters the TIME_WAIT state, its corresponding
socket and protocol control blocks (PCBs) stick around until the TCP
Maximum Segment Lifetime (MSL) expires.  On a host whose workload
necessarily creates and closes down many TCP sockets, the sockets & PCBs
for TCP sessions in TIME_WAIT state amount to many megabytes of dead
weight in RAM.

Maximum Segment Lifetimes Truncation (MSLT) assigns each TCP session to
a class based on the nearness of the peer.  Corresponding to each class
is an MSL, and a session uses the MSL of its class.  The classes are
loopback (local host equals remote host), local (local host and remote
host are on the same link/subnet), and remote (local host and remote
host communicate via one or more gateways).  Classes corresponding to
nearer peers have lower MSLs by default: 2 seconds for loopback, 10
seconds for local, 60 seconds for remote.  Loopback and local sessions
expire more quickly when MSLT is used.

Vestigial Time-Wait (VTW) replaces a TIME_WAIT session's PCB/socket
dead weight with a compact representation of the session, called a
"vestigial PCB".  VTW data structures are designed to be very fast and
memory-efficient: for fast insertion and lookup of vestigial PCBs,
the PCBs are stored in a hash table that is designed to minimize the
number of cacheline visits per lookup/insertion.  The memory both
for vestigial PCBs and for elements of the PCB hashtable come from
fixed-size pools, and linked data structures exploit this to conserve
memory by representing references with a narrow index/offset from the
start of a pool instead of a pointer.  When space for new vestigial PCBs
runs out, VTW makes room by discarding old vestigial PCBs, oldest first.
VTW cooperates with MSLT.

It may help to think of VTW as a "FIN cache" by analogy to the SYN
cache.

A 2.8-GHz Pentium 4 running a test workload that creates TIME_WAIT
sessions as fast as it can is approximately 17% idle when VTW is active
versus 0% idle when VTW is inactive.  It has 103 megabytes more free RAM
when VTW is active (approximately 64k vestigial PCBs are created) than
when it is inactive.
2011-05-03 18:28:44 +00:00
jakllsch 405a0ee48c Use %zu for size_t in debugging printf. 2011-03-05 21:51:17 +00:00
plunky eec5ecf4cc avoid #ifdef/#endif inside sprint() argument list, as with USE_FORT=yes
sprint becomes a macro
2011-02-24 18:35:40 +00:00
christos 57228dce84 Add 1 to the port range so the range is inclusive as documented. 2011-02-12 21:23:31 +00:00
christos e8a328b2a2 PR/44070: Avoid zero divide in modulo operations. 2011-02-12 18:14:21 +00:00
drochner 9b0c6e6540 make sure the "overload_tbl" member of "struct pf_rule" copied in
from userland is initialized (it is used by the kernel only)
fixes crash or data injection (CVE-2010-3830), usually by root user only
OpenBSD has rewritten the code to start with a zero'd struct and fills
in needed parts only - to be considered in case a newer pf version
is imported.
2011-01-19 19:58:02 +00:00
rmind c40af51a1a ip_randomid: make mechanism MP-safe and more modular.
OK matt@
2010-11-05 01:35:57 +00:00
mlelstv b707187b9f Fix mbuf corruption when sending ICMP errors for blocked IPv6
packets due to wrong buffer size computations. The corrupted
mbufs could lead to a panic.

Fix computation of link mtu where the link mtu itself is unspecified.

Limit ICMP error packets for IPv6 to MMTU as required by RFC4443. This
also avoids dropped errors when the length exceeds the link mtu.
2010-09-05 12:36:46 +00:00
pgoyette d591fa52b1 Revert previous - changes here are irrelevant to NetBSD
Need more caffeine.
2010-08-11 11:57:36 +00:00
pgoyette 99d809cb2e Keep condvar wmesg's within 8-char limit. 2010-08-11 11:40:51 +00:00
plunky 08432b7b14 handle STDC and GNUC inline semantic differences by providing and
using an EXTERN_INLINE definition for functions that are defined as
inline but provide an externally callable reference.

(these are externally called in ipftest)
2010-06-01 08:53:20 +00:00
degroote ca38e323d1 Add support for pfs(8)
pfs(8) is a tool similar to ipfs(8) but for pf(4). It allows the admin to
dump internal configuration of pf, and restore at a latter point, after a
maintenance reboot for example, in a transparent way for user.

This work has been done mostly during my GSoC 2009

No objections on tech-net@
2010-05-07 17:41:57 +00:00
darrenr c8b0eee463 clean up compile time warnings to due caddr_t and empty statements 2010-04-17 22:04:00 +00:00
darrenr 9355c196fd New file for 4.1.34 that is in src/dist/ipf but not src/sys/dist/ipf/netinet 2010-04-17 21:36:56 +00:00
darrenr 46fa5e0711 Commit IPFilter 4.1.34 to HEAD 2010-04-17 21:00:08 +00:00
ahoka 8f356e922b Do not unload pf when enabled, not even manually. 2010-04-13 13:08:16 +00:00
ahoka 3bca1c92ed change module class to driver. 2010-04-13 11:53:18 +00:00
ahoka b9e768f315 Do not auto unload pf if it's enabled. 2010-04-13 01:02:43 +00:00
ahoka f6a8ba3d97 - Make the pf and pflog driver able to detach.
- Add code for module support.

Original patch from Jared McNeill
2010-04-12 13:57:38 +00:00
skrll ea3fb23f81 Spello in comment. 2010-04-12 06:56:19 +00:00
joerg 58e867556f Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
2010-04-05 07:19:28 +00:00
minskim 6f5cce7306 Fix a typo introduced by the bpf linkage change. 2010-01-23 01:17:23 +00:00
pooka 10fe49d72c Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client.  This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached.  However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff.  ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
2010-01-19 22:06:18 +00:00
elad 579013ded4 Replace uidinfo.h with kauth.h, should fix problems observed by tron@. 2009-12-30 19:47:15 +00:00
elad 67a179c338 Use the right member to store gid in the non-NetBSD case.
Pointed out by uebayasi@ and cegger@, thanks!
2009-12-30 16:49:02 +00:00
elad cd2e2d5571 Get uid/gid from the socket's credentials. 2009-12-30 07:00:01 +00:00
dsl 835104494b If pfi_address_add() has to extend the buffer, copy the data in the
right direction!
Fixes PR/41939.
2009-12-06 16:46:11 +00:00
mbalmer 0ae57f90dd more s/the the/the/ 2009-11-22 19:09:15 +00:00
elad 52bc2f0e12 Attach the listener in the correct "attach" function.
Should fix issues reported by Anon Ymous.
2009-10-05 03:44:01 +00:00
elad 6991fd9ea2 Move firewall/NAT policy back to respective subsystems (pf, ipf).
Note: the ipf code contains a lot of ifdefs, some of them for NetBSD
versions that are no longer maintained. It won't make the code more
readable, but we should consider removing them.
2009-10-03 00:37:01 +00:00
degroote 2d48ac808c Import pfsync support from OpenBSD 4.2
Pfsync interface exposes change in the pf(4) over a pseudo-interface, and can
be used to synchronise different pf.

This work was part of my 2009 GSoC

No objection on tech-net@
2009-09-14 10:36:48 +00:00
cegger e470472c02 build fix: caddr_t -> void * 2009-08-19 13:07:59 +00:00
darrenr aa4e57639b Update head to version 4.1.33 from vendor branch 2009-08-19 08:35:30 +00:00
jmcneill a8fec90e57 acpica has been moved to src/sys/external/intel-public/acpica 2009-08-18 16:44:10 +00:00
cegger f7b6b09d0b Apply fix from upstream:
http://git.moblin.org/cgit.cgi/acpica/commit/?id=26a2eea9f4a18acb0ba2a92070d945d9835df948

I uncovered the bug by having the console flooded with:

ACPI Error (evgpe-0896): No handler or method for GPE[ 0], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ 1], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ 2], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ 4], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ 5], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ 6], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ 7], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ 8], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ 9], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ A], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ B], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ C], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ D], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ E], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[ F], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[10], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[11], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[12], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[13], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[14], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[15], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[16], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[17], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[18], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[19], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[1A], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[1B], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[1C], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[1D], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[1E], disabling event [20080321]
ACPI Error (evgpe-0896): No handler or method for GPE[1F], disabling event [20080321]

and with breaking into ddb:

ACPI Error (evgpe-0899): No handler or method for GPE[ 0], disabling event [20080321]
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8020c1fd cs e030 rflags 296 cr2  0 cpl 8 rsp ffffffff80f32c98
Stopped in pid 0.1 (system) at  netbsd:breakpoint+0x5:  leave
breakpoint() at netbsd:breakpoint+0x5
AcpiEvGpeDispatch() at netbsd:AcpiEvGpeDispatch+0x9f
AcpiEvGpeDetect() at netbsd:AcpiEvGpeDetect+0x136
AcpiEvSciXruptHandler() at netbsd:AcpiEvSciXruptHandler+0x46
Xresume_xenev6() at netbsd:Xresume_xenev6+0x55

With this merged fix console is no longer flooded and I get in dmesg:

ACPI Exception (evevent-0165): AE_BAD_ADDRESS, Unable to initialize fixed events [20080321]
acpi0: unable to enable ACPI: AE_BAD_ADDRESS

Upstream fix pointed out by jmcneill@, merged fix ok'd by joerg@.
2009-08-17 15:36:10 +00:00
minskim 3c24e51c76 Remove LKM code from pf. 2009-07-28 18:15:26 +00:00
minskim 8221d4ac16 Reduce diff with OpenBSD. No functional change. 2009-06-16 05:15:41 +00:00
kefren 1130fba7b6 Don't call callout_stop() without callout_init()
Fixes PR/41364
2009-05-08 05:18:34 +00:00
tsutsui 12de89c17b Fix harmless merge botch. 2009-04-19 18:08:56 +00:00
tsutsui 2380352549 Pull a fix for ipnat from upstream as per info from darrenr@:
2031730 4.1.31 Nat drops fragmented packets after the first
 http://ipfilter.cvs.sourceforge.net/viewvc/ipfilter/ipfilter/ip_nat.c#rev1.2.2.48

Fixes problems on UDP NFS with ipnat as mentioned in PR kern/38773 and
PR kern/41074.  Tested on several slow NFS clients and an i386 server
running ipnat.

Should be pulled up to 5.0.
2009-04-18 11:19:09 +00:00
christos ae0fe2262f Fix http://www.securityfocus.com/archive/1/502634, from OpenBSD.
XXX: should be pulled up to 5.x
2009-04-13 22:29:11 +00:00
dsl 02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
jmcneill 37c6542e1a Fix build on ia64, from kiyohara@kk.iij4u.or.jp 2009-03-14 13:51:23 +00:00
jmcneill 72d5239ba1 PR# port-i386/40676: ACPI Exception AE_AML_NO_OPERAND when booting on VAIO P
Fix to allow zero-length ASL field declarations:

  http://bugzilla.kernel.org/show_bug.cgi?id=10606
2009-02-17 23:34:19 +00:00
bouyer a95c0eef3a When IPFilter 4.1.29 has been imported, the mbuf argument to nd6_output()
has been changed from m0 to *mpp. But as *mpp has been set to NULL just
before the call, we end up calling ether_output() with a NULL mbuf,
leading to a NULL pointer dereference. Revert back to using m0 here.

The issue show up when using 'return-rst' or 'return-icmp' in ipf6.conf.
Problem discovered and fix tested on ftp.fr.netbsd.org.
2009-02-12 12:12:39 +00:00
cegger e6e72079ad make this compile 2009-01-11 10:25:29 +00:00
cegger dcf705893e use M_ZERO on malloc() and remove subsequent bzero(). 2008-12-19 18:49:37 +00:00
cegger 9c1c1ad122 pass M_NOWAIT instead of M_DONTWAIT to malloc. 2008-12-19 14:07:37 +00:00