freebsd-skq/sys/net
Luigi Rizzo 2b25acc158 Remove (almost all) global variables that were used to hold
packet forwarding state ("annotations") during ip processing.
The code is considerably cleaner now.

The variables removed by this change are:

        ip_divert_cookie        used by divert sockets
        ip_fw_fwd_addr          used for transparent ip redirection
        last_pkt                used by dynamic pipes in dummynet

Removal of the first two has been done by carrying the annotations
into volatile structs prepended to the mbuf chains, and adding
appropriate code to add/remove annotations in the routines which
make use of them, i.e. ip_input(), ip_output(), tcp_input(),
bdg_forward(), ether_demux(), ether_output_frame(), div_output().

On passing, remove a bug in divert handling of fragmented packet.
Now it is the fragment at offset 0 which sets the divert status of
the whole packet, whereas formerly it was the last incoming fragment
to decide.

Removal of last_pkt required a change in the interface of ip_fw_chk()
and dummynet_io(). On passing, use the same mechanism for dummynet
annotations and for divert/forward annotations.

option IPFIREWALL_FORWARD is effectively useless, the code to
implement it is very small and is now in by default to avoid the
obfuscation of conditionally compiled code.

NOTES:
 * there is at least one global variable left, sro_fwd, in ip_output().
   I am not sure if/how this can be removed.

 * I have deliberately avoided gratuitous style changes in this commit
   to avoid cluttering the diffs. Minor stule cleanup will likely be
   necessary

 * this commit only focused on the IP layer. I am sure there is a
   number of global variables used in the TCP and maybe UDP stack.

 * despite the number of files touched, there are absolutely no API's
   or data structures changed by this commit (except the interfaces of
   ip_fw_chk() and dummynet_io(), which are internal anyways), so
   an MFC is quite safe and unintrusive (and desirable, given the
   improved readability of the code).

MFC after: 10 days
2002-06-22 11:51:02 +00:00
..
bpf_compat.h
bpf_filter.c
bpf.c Make funsetown() take a 'struct sigio **' so that the locking can 2002-05-06 19:31:28 +00:00
bpf.h Update for libpcap 0.7.1 2002-06-21 05:29:40 +00:00
bpfdesc.h
bridge.c Remove (almost all) global variables that were used to hold 2002-06-22 11:51:02 +00:00
bridge.h
bsd_comp.c
ethernet.h
fddi.h
if_arc.h
if_arcsubr.c Cosmetical change: remove empty line to reduce diffs to RELENG_4 2002-04-14 16:40:11 +00:00
if_arp.h
if_atm.h
if_atmsubr.c
if_disc.c Make discard devices clonable and unloadable. Also, change the 2002-05-25 20:20:35 +00:00
if_dl.h Move ISO88025 source routing information into sockaddr_dl's sdl_data 2002-05-07 22:14:06 +00:00
if_ef.c Fix warning; remove unused arg that was passed through uninitialized. 2002-05-24 06:10:25 +00:00
if_ethersubr.c Remove (almost all) global variables that were used to hold 2002-06-22 11:51:02 +00:00
if_faith.c Move all unit number management cloned interfaces into the cloning 2002-05-25 20:17:04 +00:00
if_fddisubr.c
if_gif.c Move all unit number management cloned interfaces into the cloning 2002-05-25 20:17:04 +00:00
if_gif.h
if_ieee80211.h Add two more IEEE80211 defines for status. 2002-04-11 05:43:10 +00:00
if_iso88025subr.c Move ISO88025 source routing information into sockaddr_dl's sdl_data 2002-05-07 22:14:06 +00:00
if_llc.h
if_loop.c Move all unit number management cloned interfaces into the cloning 2002-05-25 20:17:04 +00:00
if_media.c
if_media.h MFOpenBSD: ibss and ibss-master. 2002-05-07 18:16:39 +00:00
if_mib.c
if_mib.h
if_ppp.c
if_ppp.h
if_pppvar.h
if_sl.c
if_slvar.h
if_sppp.h
if_spppsubr.c Fix a misplaced break statement within a switch that accidentally made 2002-05-10 12:48:09 +00:00
if_stf.c Move all unit number management cloned interfaces into the cloning 2002-05-25 20:17:04 +00:00
if_stf.h just merged cosmetic changes from KAME to ease sync between KAME and FreeBSD. 2002-04-19 04:46:24 +00:00
if_tap.c Make funsetown() take a 'struct sigio **' so that the locking can 2002-05-06 19:31:28 +00:00
if_tap.h
if_tapvar.h
if_tun.c Make funsetown() take a 'struct sigio **' so that the locking can 2002-05-06 19:31:28 +00:00
if_tun.h
if_tunvar.h
if_types.h
if_var.h Minor style nit 2002-05-07 18:11:55 +00:00
if_vlan_var.h
if_vlan.c Move all unit number management cloned interfaces into the cloning 2002-05-25 20:17:04 +00:00
if.c Move all unit number management cloned interfaces into the cloning 2002-05-25 20:17:04 +00:00
if.h Move all unit number management cloned interfaces into the cloning 2002-05-25 20:17:04 +00:00
intrq.c
intrq.h
iso88025.h Fix logic inversion bug. 2002-05-11 06:27:24 +00:00
net_osdep.c just merged cosmetic changes from KAME to ease sync between KAME and FreeBSD. 2002-04-19 04:46:24 +00:00
net_osdep.h just merged cosmetic changes from KAME to ease sync between KAME and FreeBSD. 2002-04-19 04:46:24 +00:00
netisr.h
pfil.c
pfil.h
pfkeyv2.h
ppp_comp.h
ppp_deflate.c
ppp_defs.h
ppp_tty.c
radix.c just merged cosmetic changes from KAME to ease sync between KAME and FreeBSD. 2002-04-19 04:46:24 +00:00
radix.h
raw_cb.c Back out my lats commit of locking down a socket, it conflicts with hsu's work. 2002-05-31 11:52:35 +00:00
raw_cb.h
raw_usrreq.c Back out my lats commit of locking down a socket, it conflicts with hsu's work. 2002-05-31 11:52:35 +00:00
route.c Ensure that packet counts are always reset to 0 when 2002-05-31 04:27:51 +00:00
route.h
rtsock.c Remove so*_locked(), which were backed out by mistake. 2002-06-18 07:42:02 +00:00
slcompress.c
slcompress.h
slip.h
zlib.c
zlib.h Add one copy of crc32() and crc32_tab[] in libkern, and remove it two other 2002-05-29 20:24:09 +00:00