OPNsense - FreeBSD source
Find a file
Robert Watson 623dce13c6 Update TCP for infrastructural changes to the socket/pcb refcount model,
pru_abort(), pru_detach(), and in_pcbdetach():

- Universally support and enforce the invariant that so_pcb is
  never NULL, converting dozens of unnecessary NULL checks into
  assertions, and eliminating dozens of unnecessary error handling
  cases in protocol code.

- In some cases, eliminate unnecessary pcbinfo locking, as it is no
  longer required to ensure so_pcb != NULL.  For example, the receive
  code no longer requires the pcbinfo lock, and the send code only
  requires it if building a new connection on an otherwise unconnected
  socket triggered via sendto() with an address.  This should
  significnatly reduce tcbinfo lock contention in the receive and send
  cases.

- In order to support the invariant that so_pcb != NULL, it is now
  necessary for the TCP code to not discard the tcpcb any time a
  connection is dropped, but instead leave the tcpcb until the socket
  is shutdown.  This case is handled by setting INP_DROPPED, to
  substitute for using a NULL so_pcb to indicate that the connection
  has been dropped.  This requires the inpcb lock, but not the pcbinfo
  lock.

- Unlike all other protocols in the tree, TCP may need to retain access
  to the socket after the file descriptor has been closed.  Set
  SS_PROTOREF in tcp_detach() in order to prevent the socket from being
  freed, and add a flag, INP_SOCKREF, so that the TCP code knows whether
  or not it needs to free the socket when the connection finally does
  close.  The typical case where this occurs is if close() is called on
  a TCP socket before all sent data in the send socket buffer has been
  transmitted or acknowledged.  If INP_SOCKREF is found when the
  connection is dropped, we release the inpcb, tcpcb, and socket instead
  of flagging INP_DROPPED.

- Abort and detach protocol switch methods no longer return failures,
  nor attempt to free sockets, as the socket layer does this.

- Annotate the existence of a long-standing race in the TCP timer code,
  in which timers are stopped but not drained when the socket is freed,
  as waiting for drain may lead to deadlocks, or have to occur in a
  context where waiting is not permitted.  This race has been handled
  by testing to see if the tcpcb pointer in the inpcb is NULL (and vice
  versa), which is not normally permitted, but may be true of a inpcb
  and tcpcb have been freed.  Add a counter to test how often this race
  has actually occurred, and a large comment for each instance where
  we compare potentially freed memory with NULL.  This will have to be
  fixed in the near future, but requires is to further address how to
  handle the timer shutdown shutdown issue.

- Several TCP calls no longer potentially free the passed inpcb/tcpcb,
  so no longer need to return a pointer to indicate whether the argument
  passed in is still valid.

- Un-macroize debugging and locking setup for various protocol switch
  methods for TCP, as it lead to more obscurity, and as locking becomes
  more customized to the methods, offers less benefit.

- Assert copyright on tcp_usrreq.c due to significant modifications that
  have been made as part of this work.

These changes significantly modify the memory management and connection
logic of our TCP implementation, and are (as such) High Risk Changes,
and likely to contain serious bugs.  Please report problems to the
current@ mailing list ASAP, ideally with simple test cases, and
optionally, packet traces.

MFC after:	3 months
2006-04-01 16:36:36 +00:00
bin Change the -S and -t options to override each other so that the last one 2006-03-24 17:09:03 +00:00
contrib Document authpf's requirement for a mounted fdescfs(5). 2006-03-28 15:26:16 +00:00
crypto Fix utmp. There is some clever logic in configure.ac which attempts to 2006-03-23 21:31:42 +00:00
etc Remove redundant ike rc.d script, since we do not have an IPsec IKE 2006-03-28 18:28:33 +00:00
games Reimplementation of world/kernel build options. For details, see: 2006-03-17 18:54:44 +00:00
gnu remove these vestiges of gdbserver.. It hasn't built in a long time, and 2006-03-31 00:37:42 +00:00
include Expose res_update and friends again. At least, ports/mail/spamilter 2006-03-30 20:15:53 +00:00
kerberos5 Reimplementation of world/kernel build options. For details, see: 2006-03-17 18:54:44 +00:00
lib fix indent. 2006-04-01 15:53:39 +00:00
libexec *thwack*! all the world's not i386. 2006-03-29 12:29:01 +00:00
release Autogenerate hardware notes for mfi(4). 2006-03-29 21:10:45 +00:00
rescue *sigh* 2006-03-27 12:56:29 +00:00
sbin Make WITHOUT_DYNAMICROOT=foo work again: remember to reference 2006-04-01 16:34:45 +00:00
secure Add port-tun.c. 2006-03-22 20:42:05 +00:00
share Convert the SYNOPSIS section to look like the ones used in other driver 2006-04-01 11:21:00 +00:00
sys Update TCP for infrastructural changes to the socket/pcb refcount model, 2006-04-01 16:36:36 +00:00
tools Reflect progress in process title. 2006-03-27 10:29:12 +00:00
usr.bin Don't call audit_logout() if pwd is NULL, as audit_logout() attempts to 2006-03-28 15:30:42 +00:00
usr.sbin Currently, if writing out a log entry fails, we unlink that log entry from our 2006-03-30 21:04:52 +00:00
COPYRIGHT Happy new year, a little late 2006-01-15 22:06:10 +00:00
LOCKS Document commit constraints for RELENG_6_*. 2006-01-13 06:51:43 +00:00
MAINTAINERS Add OpenBSM and src/sys/security/audit to the maintainer list. 2006-03-04 14:24:32 +00:00
Makefile Add the new "showconfig" target that displays build configuration. 2006-03-18 14:30:23 +00:00
Makefile.inc1 Sort bootstrap-tools entries. 2006-03-31 14:10:35 +00:00
ObsoleteFiles.inc Remove redundant ike rc.d script, since we do not have an IPsec IKE 2006-03-28 18:28:33 +00:00
README Add a note explaining what the rescue/ directory is for. 2006-03-01 20:14:55 +00:00
UPDATING Document new world older for world/kernel build options. 2006-03-21 10:10:05 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The
``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html