freebsd-nq/sbin
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
..
adjkerntz
atacontrol mdoc(7) police: tidy up the markup. 2002-05-29 16:14:00 +00:00
atm Use a larger data type to prevent counters wrapping so quickly. 2002-06-07 05:29:13 +00:00
badsect This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
bsdlabel Oops, unbreak parsing of the `type' field in getasciilabel(). I had 2002-06-05 08:11:28 +00:00
camcontrol Fix syntax errors (labels with no statement). 2002-05-30 21:38:58 +00:00
ccdconfig
clri This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
comcontrol
conscontrol
cxconfig
dhclient
disklabel Oops, unbreak parsing of the `type' field in getasciilabel(). I had 2002-06-05 08:11:28 +00:00
dmesg
dump This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
dumpfs This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
dumpon
fdisk mdoc(7) police: tidy up the markup and some wording. 2002-05-30 09:41:33 +00:00
fdisk_pc98
ffsinfo mdoc(7) police: nits. 2002-05-29 16:47:55 +00:00
fsck
fsck_ffs Remove the kernel file-size limit for UFS2, so that only the limit 2002-06-26 18:34:51 +00:00
fsck_msdosfs
fsdb This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
fsirand This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
growfs This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
ifconfig Add eui64 option which fills interface index (lowermost 64bit of 2002-06-15 15:35:24 +00:00
init
ip6fw Fix typos (s/IP6FILREWALL_VERBOSE/IPV6FIREWALL_VERBOSE/, s/netinet/netinet6/). 2002-05-30 07:01:58 +00:00
ipf
ipfs
ipfstat
ipfw The new ipfw code. 2002-06-27 23:02:18 +00:00
ipmon
ipnat
kldconfig
kldload Add 'utility' in a place that it was missing. 2002-06-05 23:39:56 +00:00
kldstat
kldunload
ldconfig
md5
mdconfig
mdmfs
mknod
mount
mount_cd9660
mount_ext2fs
mount_hpfs
mount_msdosfs
mount_nfs
mount_ntfs
mount_nullfs
mount_nwfs mdoc(7) police: nits. 2002-05-29 16:47:55 +00:00
mount_portalfs
mount_smbfs
mount_std
mount_udf Convert UDF to nmount. 2002-06-15 22:40:13 +00:00
mount_umapfs
mount_unionfs nmount'ify unionfs further by using separate options instead 2002-06-15 22:48:14 +00:00
mountd Remove old pre-TIRPC code for getting transport handles. The code that 2002-06-25 22:55:53 +00:00
natd
newfs Get rid of paranoia that zeros the boot block area as this has 2002-06-22 22:44:09 +00:00
newfs_msdos
nfsd Fix spelling nit in error message. 2002-06-05 01:06:33 +00:00
nfsiod mdoc(7) police: nits. 2002-05-29 16:47:55 +00:00
nologin
nos-tun
ping
ping6
quotacheck This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
rcorder This commit was generated by cvs2svn to compensate for changes in r98567, 2002-06-21 15:56:16 +00:00
reboot mdoc(7) police: nits. 2002-05-29 16:47:55 +00:00
restore This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
route Don't have -prefixlen 128 on host routes. 2002-06-08 19:49:22 +00:00
routed
rtsol
savecore Fix breakage caused by allocating the I/O buffer. There was a 2002-06-02 19:20:37 +00:00
setkey
shutdown
slattach
spppcontrol
startslip
swapon
sysctl
tunefs Don't say that an umounted filesystem is required for -n. An unmounted 2002-06-21 09:57:34 +00:00
umount
vinum Correct default location of history file. 2002-06-23 01:32:00 +00:00
Makefile This commit adds basic support for the UFS2 filesystem. The UFS2 2002-06-21 06:18:05 +00:00
Makefile.inc