freebsd-nq/sys/conf
Luigi Rizzo 9758b77ff1 The new ipfw code.
This code makes use of variable-size kernel representation of rules
(exactly the same concept of BPF instructions, as used in the BSDI's
firewall), which makes firewall operation a lot faster, and the
code more readable and easier to extend and debug.

The interface with the rest of the system is unchanged, as witnessed
by this commit. The only extra kernel files that I am touching
are if_fw.h and ip_dummynet.c, which is quite tied to ipfw. In
userland I only had to touch those programs which manipulate the
internal representation of firewall rules).

The code is almost entirely new (and I believe I have written the
vast majority of those sections which were taken from the former
ip_fw.c), so rather than modifying the old ip_fw.c I decided to
create a new file, sys/netinet/ip_fw2.c .  Same for the user
interface, which is in sbin/ipfw/ipfw2.c (it still compiles to
/sbin/ipfw).  The old files are still there, and will be removed
in due time.

I have not renamed the header file because it would have required
touching a one-line change to a number of kernel files.

In terms of user interface, the new "ipfw" is supposed to accepts
the old syntax for ipfw rules (and produce the same output with
"ipfw show". Only a couple of the old options (out of some 30 of
them) has not been implemented, but they will be soon.

On the other hand, the new code has some very powerful extensions.
First, you can put "or" connectives between match fields (and soon
also between options), and write things like

ipfw add allow ip from { 1.2.3.4/27 or 5.6.7.8/30 } 10-23,25,1024-3000 to any

This should make rulesets slightly more compact (and lines longer!),
by condensing 2 or more of the old rules into single ones.

Also, as an example of how easy the rules can be extended, I have
implemented an 'address set' match pattern, where you can specify
an IP address in a format like this:

        10.20.30.0/26{18,44,33,22,9}

which will match the set of hosts listed in braces belonging to the
subnet 10.20.30.0/26 . The match is done using a bitmap, so it is
essentially a constant time operation requiring a handful of CPU
instructions (and a very small amount of memmory -- for a full /24
subnet, the instruction only consumes 40 bytes).

Again, in this commit I have focused on functionality and tried
to minimize changes to the other parts of the system. Some performance
improvement can be achieved with minor changes to the interface of
ip_fw_chk_t. This will be done later when this code is settled.

The code is meant to compile unmodified on RELENG_4 (once the
PACKET_TAG_* changes have been merged), for this reason
you will see #ifdef __FreeBSD_version in a couple of places.
This should minimize errors when (hopefully soon) it will be time
to do the MFC.
2002-06-27 23:02:18 +00:00
..
defines
files The new ipfw code. 2002-06-27 23:02:18 +00:00
files.alpha ${MACHINE_ARCH}dump.c -> dump_machdep.c. 2002-05-13 02:40:21 +00:00
files.i386 Remote pci.h/NPCI usage from i4b code. 2002-06-13 06:04:28 +00:00
files.ia64 ${MACHINE_ARCH}dump.c -> dump_machdep.c. 2002-05-13 02:40:21 +00:00
files.pc98 Remote pci.h/NPCI usage from i4b code. 2002-06-13 06:04:28 +00:00
files.powerpc Build the fpu support routines. 2002-05-13 07:53:22 +00:00
files.sparc64 Allow one to configure `sio'. 2002-06-18 01:14:54 +00:00
kern.mk For now, make the .ifdef GCC3 case default. We should change -Wno-format 2002-05-24 01:02:45 +00:00
kern.post.mk Fixed broken ``make -jX install''. 2002-05-23 07:25:01 +00:00
kern.pre.mk Removed a duplicate -ffreestanding. It's already set in bsd.kern.mk. 2002-06-16 10:42:05 +00:00
kmod_syms.awk Respect setting of NM to allow cross-building. 2002-04-19 09:04:53 +00:00
kmod.mk Use OBJDIR instead of CURDIR. This unbreaks loading modules through 2002-06-17 20:01:06 +00:00
ldscript.alpha Use the kernbase symbol exported from locore.o instead of hardcoded magic 2001-09-20 09:19:38 +00:00
ldscript.amd64 Remove hard coded magic load address. Now to change the load address, 2001-09-18 01:12:43 +00:00
ldscript.i386 Remove hard coded magic load address. Now to change the load address, 2001-09-18 01:12:43 +00:00
ldscript.ia64 Put symbols at the start and end of the unwind section so that we can 2001-10-29 11:40:14 +00:00
ldscript.powerpc Page align the data segment. 2001-10-08 10:43:34 +00:00
ldscript.sparc64 Add kernbase symbol and use it instead of magic numbers in the 2001-09-21 05:43:38 +00:00
majors Grab a major number for OpenFirmware disk devices. 2002-04-15 10:41:47 +00:00
Makefile.alpha Commit some infrastructure for turning on -Werror for kernel compiles. 2002-02-20 23:35:56 +00:00
Makefile.i386 Commit some infrastructure for turning on -Werror for kernel compiles. 2002-02-20 23:35:56 +00:00
Makefile.ia64 Remove CWARNFLAGS and add GCC3. We handle GCC3.x specific flags 2002-05-19 03:41:48 +00:00
Makefile.pc98 Commit some infrastructure for turning on -Werror for kernel compiles. 2002-02-20 23:35:56 +00:00
Makefile.powerpc Remove the setting of 'FMT'. We now do ELF by default, so only bother 2002-03-24 17:45:46 +00:00
Makefile.sparc64 Remove a hack for using an external compiler if cross compiling. 2002-05-26 15:55:28 +00:00
makeLINT.sed Join the pissing contest: generate LINT with a single sed(1) command. 2002-05-02 16:34:47 +00:00
newvers.sh setlocale(3) has been fixed to match POSIX standard: 2001-03-02 16:52:14 +00:00
NOTES At long last, commit the zero copy sockets code. 2002-06-26 03:37:47 +00:00
options At long last, commit the zero copy sockets code. 2002-06-26 03:37:47 +00:00
options.alpha More s/file system/filesystem/g 2002-05-16 21:28:32 +00:00
options.i386 Make the speed used by gdb over serial settable in the kernel configuration. 2002-06-18 21:30:37 +00:00
options.ia64 Make the speed used by gdb over serial settable in the kernel configuration. 2002-06-18 21:30:37 +00:00
options.pc98 Make the speed used by gdb over serial settable in the kernel configuration. 2002-06-18 21:30:37 +00:00
options.powerpc Add a cosmetic comment. 2001-08-02 23:54:23 +00:00
options.sparc64 Add a DEBUGGER_ON_POWERFAIL option. This makes the power button on ultra 10s 2002-03-13 05:58:45 +00:00
systags.sh $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00