Commit Graph

27 Commits

Author SHA1 Message Date
Ed Schouten
d745c852be Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
2011-11-07 06:44:47 +00:00
Dag-Erling Smørgrav
1ede983cc9 Retire the MALLOC and FREE macros. They are an abomination unto style(9).
MFC after:	3 months
2008-10-23 15:53:51 +00:00
Jung-uk Kim
37b5fe59b5 Make sure BPF program is not bigger than set maximum (net.bpf.maxinsns). 2008-08-29 15:49:40 +00:00
Alexander Motin
193f57e2c0 Prepare hooks direct pointers on setup to avoid heavy ng_findhook() calls
during operarion.
2008-02-04 19:26:53 +00:00
Alexander Motin
f38b370376 Avoid data copying when it is possible.
bpf_filter() is able to work directly on mbuf chain.
2008-01-28 22:37:17 +00:00
Alexander Motin
091193febe Reduce stack usage by 256 bytes per call. It helps to avoid kernel
stack overflow in complicated traffic filtering setups.

There can be minor performance degradation for the MHLEN < len <= 256 case
due to additional buffer allocation, but it is a rare case.

Approved by:	re (rwatson), glebius (mentor)
MFC after:	1 week
2007-07-26 18:15:02 +00:00
Jung-uk Kim
ae2cb97e54 Fix build without BPF_JITTER option. 2005-12-07 21:41:45 +00:00
Jung-uk Kim
848c454cc1 Add BPF Just-In-Time compiler support for ng_bpf(4).
The sysctl is changed from net.bpf.jitter.enable to net.bpf_jitter.enable
and this controls both bpf(4) and ng_bpf(4) now.
2005-12-07 21:30:47 +00:00
Warner Losh
c398230b64 /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
Archie Cobbs
669bb973c4 Avoid calling bpf_filter() with len == 0, which causes a change in semantics
(it treats the buffer pointer as an mbuf pointer) and subsequent panic.

MFC after:	3 days
Reported by:	Tony Hariman <tony@cbn.net.id>
2004-06-23 02:37:10 +00:00
Julian Elischer
f8aae7776f Switch to using C99 sparse initialisers for the type methods array.
Should make no binary difference.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
Reviewed by:	Harti Brandt <harti@freebsd.org>
MFC after:	1 week
2004-05-29 00:51:19 +00:00
Archie Cobbs
f0184ff8e3 Fix GCC warnings caused by initializing a zero length array. In the process,
simply things a bit by getting rid of 'struct ng_parse_struct_info' which
was useless because it only contained one field.

MFC after:	2 weeks
2002-05-31 23:48:03 +00:00
David E. O'Brien
6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
Julian Elischer
d2a57575f1 Fix cut and paste error in a comment.
Submitted by: Peter Wemm <peter@freebsd.org>
2001-01-30 07:58:30 +00:00
Julian Elischer
cdbfe12417 Another brian fix, luckily not in live code. 2001-01-11 15:44:41 +00:00
Julian Elischer
9c8c302fd0 Fix some memory leaks
Add memory leak detection assitance.
2001-01-10 07:13:58 +00:00
Julian Elischer
30400f03aa Part 2 of the netgraph rewrite.
This is mostly cosmetic changes, (though I caught a bug or two while
makeing them)
Reviewed by:	archie@freebsd.org
2001-01-08 05:34:06 +00:00
Julian Elischer
069154d55f Rewrite of netgraph to start getting ready for SMP.
This version is functional and is aproaching solid..
notice I said APROACHING. There are many node types I cannot test
I have tested: echo hole ppp socket vjc iface tee bpf async tty
The rest compile and "Look" right.  More changes to follow.
DEBUGGING is enabled in this code to help if people have problems.
2001-01-06 00:46:47 +00:00
Julian Elischer
589f6ed8ce Divorce the kernel binary ABI version number from the message
format version number. (userland programs should not need to be
recompiled when the netgraph kernel internal ABI is changed.

Also fix modules that don;t handle the fact that a caller may not supply
a return message pointer. (benign at the moment because the calling code
checks, but that will change)
2000-12-18 20:03:32 +00:00
Julian Elischer
859a4d166c Reviewed by: Archie@freebsd.org
This clears out my outstanding netgraph changes.
There is a netgraph change of design in the offing and this is to some
extent a superset of soem of the new functionality and some of the old
functionality that may be removed.

This code works as before, but allows some new features that I want to
work with and evaluate. It is the basis for a version of netgraph
with integral locking for SMP use.

This is running on my test machine with no new problems :-)
2000-12-12 18:52:14 +00:00
David Malone
99cdf4ccb2 Add the use of M_ZERO to netgraph.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
Submitted by:	archie
Approved by:	archie
2000-11-18 15:17:43 +00:00
Julian Elischer
cc3bbd68c5 Since neither archie nor I work at Whistle any more, change our email
addresses to be the more usefu @freebsd.org ones
so we can keep getting bug-reports.
- man pages to follow..
2000-10-24 17:32:45 +00:00
Archie Cobbs
65b9a0da90 Allocate all memory (including within node constructors) with M_NOWAIT
instead of M_WAITOK, to allow for maximum flexibility.
2000-09-21 18:01:23 +00:00
Archie Cobbs
57b57be3ec Take advantage of the new unsigned and hex integer types. 2000-08-10 22:45:54 +00:00
Julian Elischer
a4ec03cfa8 Two simple changes to the kernel internal API for netgraph modules,
to support future work in flow-control and 'packet reject/replace'
processing modes.

reviewed by: phk, archie
2000-04-28 17:09:00 +00:00
Archie Cobbs
ab0d3c94db Change definition of NG_BPF_HOOKPROG_SIZE() so as not to require
a structure pointer, just the number of BPF instructions.
1999-12-06 18:43:32 +00:00
Archie Cobbs
92a3e5521f New netgraph node type, ng_bpf(8). This node type allows you to
apply bpf(4) filters to data travelling through a netgraph network.
1999-12-03 21:21:49 +00:00