From owner-cvs-all Sat Jun 22 4:51:11 2002 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E15E237B403; Sat, 22 Jun 2002 04:51:03 -0700 (PDT) Received: (from luigi@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5MBp3x23846; Sat, 22 Jun 2002 04:51:03 -0700 (PDT) (envelope-from luigi) Message-Id: <200206221151.g5MBp3x23846@freefall.freebsd.org> From: Luigi Rizzo Date: Sat, 22 Jun 2002 04:51:03 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/net bridge.c if_ethersubr.c src/sys/netinet ip_divert.c ip_dummynet.c ip_dummynet.h ip_fw.c ip_fw.h ip_input.c ip_output.c ip_var.h tcp_input.c X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG luigi 2002/06/22 04:51:03 PDT Modified files: sys/net bridge.c if_ethersubr.c sys/netinet ip_divert.c ip_dummynet.c ip_dummynet.h ip_fw.c ip_fw.h ip_input.c ip_output.c ip_var.h tcp_input.c Log: 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 Revision Changes Path 1.50 +52 -35 src/sys/net/bridge.c 1.112 +38 -29 src/sys/net/if_ethersubr.c 1.65 +66 -67 src/sys/netinet/ip_divert.c 1.47 +39 -44 src/sys/netinet/ip_dummynet.c 1.20 +18 -22 src/sys/netinet/ip_dummynet.h 1.188 +42 -38 src/sys/netinet/ip_fw.c 1.68 +22 -3 src/sys/netinet/ip_fw.h 1.201 +101 -123 src/sys/netinet/ip_input.c 1.158 +124 -92 src/sys/netinet/ip_output.c 1.61 +1 -2 src/sys/netinet/ip_var.h 1.161 +14 -9 src/sys/netinet/tcp_input.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message