summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Lite2 bugfixes merge:ache1999-04-241-3/+3
| | | | | | | so_linger is in seconds, not in 1/HZ range checking in SO_*TIMEO was wrong PR: 11252
* * Change sysctl from using linker_set to construct its tree using SLISTs.dfr1999-02-161-1/+3
| | | | | | | | | | This makes it possible to change the sysctl tree at runtime. * Change KLD to find and register any sysctl nodes contained in the loaded file and to unregister them when the file is unloaded. Reviewed by: Archie Cobbs <archie@whistle.com>, Peter Wemm <peter@netplex.com.au> (well they looked at it anyway)
* Fix the port of the NetBSD 19990120-accept fix. I misread a piece offenner1999-02-021-2/+7
| | | | | | code when examining their fix, which caused my code (in rev 1.52) to: - panic("soaccept: !NOFDREF") - fatal trap 12, with tracebacks going thru soclose and soaccept
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-2/+2
| | | | kernel compile
* Port NetBSD's 19990120-accept bug fix. This works around the race conditionfenner1999-01-251-3/+15
| | | | | | | | | | where select(2) can return that a listening socket has a connected socket queued, the connection is broken, and the user calls accept(2), which then blocks because there are no connections queued. Reviewed by: wollman Obtained from: NetBSD (ftp://ftp.NetBSD.ORG/pub/NetBSD/misc/security/patches/19990120-accept)
* Also consider the space left in the socket buffer when deciding whetherfenner1999-01-201-2/+2
| | | | to set PRUS_MORETOCOME.
* Add a flag, passed to pru_send routines, PRUS_MORETOCOME. Thisfenner1999-01-201-2/+4
| | | | | | | | | flag means that there is more data to be put into the socket buffer. Use it in TCP to reduce the interaction between mbuf sizes and the Nagle algorithm. Based on: "Justin C. Walker" <justin@apple.com>'s description of Apple's fix for this problem.
* KNFize, by bde.eivind1999-01-101-2/+2
|
* Split DIAGNOSTIC -> DIAGNOSTIC, INVARIANTS, and INVARIANT_SUPPORT aseivind1999-01-081-13/+6
| | | | | | | | | discussed on -hackers. Introduce 'KASSERT(assertion, ("panic message", args))' for simple check + panic. Reviewed by: msmith
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticarchie1998-12-071-3/+1
| | | | and local variables, goto labels, and functions declared but not defined.
* Installed the second patch attached to kern/7899 with some changes suggestedtruckman1998-11-111-5/+4
| | | | | | | | | | | | | | | | by bde, a few other tweaks to get the patch to apply cleanly again and some improvements to the comments. This change closes some fairly minor security holes associated with F_SETOWN, fixes a few bugs, and removes some limitations that F_SETOWN had on tty devices. For more details, see the description on the PR. Because this patch increases the size of the proc and pgrp structures, it is necessary to re-install the includes and recompile libkvm, the vinum lkm, fstat, gcore, gdb, ipfilter, ps, top, and w. PR: kern/7899 Reviewed by: bde, elvind
* Bow to tradition and correctly implement the bogus-but-hallowed semanticswollman1998-08-311-5/+6
| | | | | of getsockopt never telling how much it might have copied if only the buffer were big enough.
* Correctly set the return length regardless of the relative size of thewollman1998-08-311-6/+3
| | | | | user's buffer. Simplify the logic a bit. (Can we have a version of min() for size_t?)
* Yow! Completely change the way socket options are handled, eliminatingwollman1998-08-231-97/+148
| | | | | | another specialized mbuf type in the process. Also clean up some of the cruft surrounding IPFW, multicast routing, RSVP, and other ill-explored corners.
* Undo rev 1.41 until we get more details about why it makes some systemsfenner1998-07-181-2/+1
| | | | fail.
* Introduce (fairly hacky) workaround for odd TCP behavior with applicationfenner1998-07-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | writes of size (100,208]+N*MCLBYTES. The bug: sosend() hands each mbuf off to the protocol output routine as soon as it has copied it, in the hopes of increasing parallelism (see http://www.kohala.com/~rstevens/vanj.88jul20.txt ). This works well for TCP as long as the first mbuf handed off is at least the MSS. However, when doing small writes (between MHLEN and MINCLSIZE), the transaction is split into 2 small MBUF's and each is individually handed off to TCP. TCP assumes that the first small mbuf is the whole transaction, so sends a small packet. When the second small mbuf arrives, Nagle prevents TCP from sending it so it must wait for a (potentially delayed) ACK. This sends throughput down the toilet. The workaround: Set the "atomic" flag when we're doing small writes. The "atomic" flag has two meanings: 1. Copy all of the data into a chain of mbufs before handing off to the protocol. 2. Leave room for a datagram header in said mbuf chain. TCP wants the first but doesn't want the second. However, the second simply results in some memory wastage (but is why the workaround is a hack and not a fix). The real fix: The real fix for this problem is to introduce something like a "requested transfer size" variable in the socket->protocol interface. sosend() would then accumulate an mbuf chain until it exceeded the "requested transfer size". TCP could set it to the TCP MSS (note that the current interface causes strange TCP behaviors when the MSS > MCLBYTES; nobody notices because MCLBYTES > ethernet's MTU).
* Convert socket structures to be type-stable and add a version number.wollman1998-05-151-8/+46
| | | | | | | | | | | | | | | | | | | Define a parameter which indicates the maximum number of sockets in a system, and use this to size the zone allocators used for sockets and for certain PCBs. Convert PF_LOCAL PCB structures to be type-stable and add a version number. Define an external format for infomation about socket structures and use it in several places. Define a mechanism to get all PF_LOCAL and PF_INET PCB lists through sysctl(3) without blocking network interrupts for an unreasonable length of time. This probably still has some bugs and/or race conditions, but it seems to work well enough on my machines. It is now possible for `netstat' to get almost all of its information via the sysctl(3) interface rather than reading kmem (changes to follow).
* Moved some #includes from <sys/param.h> nearer to where they are actuallybde1998-03-281-1/+2
| | | | used.
* Make sure that you can only bind a more specific address when it isguido1998-03-011-1/+2
| | | | | done by the same uid. Obtained from: OpenBSD
* Revert sosend() to its behavior from 4.3-Tahoe and before: iffenner1998-02-191-3/+7
| | | | | | | | | | | | | so_error is set, clear it before returning it. The behavior introduced in 4.3-Reno (to not clear so_error) causes potentially transient errors (e.g. ECONNREFUSED if the other end hasn't opened its socket yet) to be permanent on connected datagram sockets that are only used for writing. (soreceive() clears so_error before returning it, as does getsockopt(...,SO_ERROR,...).) Submitted by: Van Jacobson <van@ee.lbl.gov>, via a comment in the vat sources.
* Back out DIAGNOSTIC changes.eivind1998-02-061-3/+1
|
* Turn DIAGNOSTIC into a new-style option.eivind1998-02-041-1/+3
|
* MF22: MSG_EOR bug fix.jkh1997-11-091-3/+9
| | | | Submitted by: wollman
* Last major round (Unless Bruce thinks of somthing :-) of malloc changes.phk1997-10-121-1/+5
| | | | | | | | Distribute all but the most fundamental malloc types. This time I also remembered the trick to making things static: Put "static" in front of them. A couple of finer points by: bde
* While booting diskless we have no proc pointer.phk1997-10-041-2/+3
|
* Extend select backend for sockets to work with a poll interface (morepeter1997-09-141-26/+24
| | | | | | | | detail is passed back and forwards). This mostly came from NetBSD, except that our interfaces have changed a lot and this funciton is in a different part of the kernel. Obtained from: NetBSD
* Removed unused #includes.bde1997-09-021-2/+1
|
* #include <machine/limits.h> explicitly in the few places that it is required.bde1997-08-211-1/+3
|
* Fix all areas of the system (or at least all those in LINT) to avoid storingwollman1997-08-161-22/+16
| | | | | | | | socket addresses in mbufs. (Socket buffers are the one exception.) A number of kernel APIs needed to get fixed in order to make this happen. Also, fix three protocol families which kept PCBs in mbufs to not malloc them instead. Delete some old compatibility cruft while we're at it, and add some new routines in the in_cksum family.
* Don't accept insane values for SO_(SND|RCV)BUF, and the low water marks.peter1997-06-271-4/+27
| | | | | | | | | Specifically, don't allow a value < 1 for any of them (it doesn't make sense), and don't let the low water mark be greater than the corresponding high water mark. Pre-Approved by: wollman Obtained from: NetBSD
* The long-awaited mega-massive-network-code- cleanup. Part I.wollman1997-04-271-26/+57
| | | | | | | | | | | | | | | | | | | | | | | | This commit includes the following changes: 1) Old-style (pr_usrreq()) protocols are no longer supported, the compatibility glue for them is deleted, and the kernel will panic on boot if any are compiled in. 2) Certain protocol entry points are modified to take a process structure, so they they can easily tell whether or not it is possible to sleep, and also to access credentials. 3) SS_PRIV is no more, and with it goes the SO_PRIVSTATE setsockopt() call. Protocols should use the process pointer they are now passed. 4) The PF_LOCAL and PF_ROUTE families have been updated to use the new style, as has the `raw' skeleton family. 5) PF_LOCAL sockets now obey the process's umask when creating a socket in the filesystem. As a result, LINT is now broken. I'm hoping that some enterprising hacker with a bit more time will either make the broken bits work (should be easy for netipx) or dike them out.
* Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.bde1997-03-231-2/+2
| | | | | Fixed everything that depended on getting fcntl.h stuff from the wrong place. Most things don't depend on file.h stuff at all.
* Create a new branch of the kernel MIB, kern.ipc, to storewollman1997-02-241-2/+3
| | | | | | | | | | | all of the configurables and instrumentation related to inter-process communication mechanisms. Some variables, like mbuf statistics, are instrumented here for the first time. For mbuf statistics: also keep track of m_copym() and m_pullup() failures, and provide for the user's inspection the compiled-in values of MSIZE, MHLEN, MCLBYTES, and MINCLSIZE.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Check for error return from uiomove to prevent looping endlessly indg1996-11-291-1/+3
| | | | | | soreceive(). Closes PR#2114. Submitted by: wpaul
* Increase robustness of FreeBSD against high-rate connection attemptpst1996-10-071-1/+2
| | | | | | | denial of service attacks. Reviewed by: bde,wollman,olah Inspired by: vjs@sgi.com
* Modify the kernel to use the new pr_usrreqs interface rather than the oldwollman1996-07-111-36/+18
| | | | | | | | | | | | | | pr_usrreq mechanism which was poorly designed and error-prone. This commit renames pr_usrreq to pr_ousrreq so that old code which depended on it would break in an obvious manner. This commit also implements the new interface for TCP, although the old function is left as an example (#ifdef'ed out). This commit ALSO fixes a longstanding bug in the TCP timer processing (introduced by davidg on 1995/04/12) which caused timer processing on a TCB to always stop after a single timer had expired (because it misinterpreted the return value from tcp_usrreq() to indicate that the TCB had been deleted). Finally, some code related to polling has been deleted from if.c because it is not relevant t -current and doesn't look at all like my current code.
* Make it possible to return more than one piece of control informationwollman1996-05-091-1/+3
| | | | | | | | (PR #1178). Define a new SO_TIMESTAMP socket option for datagram sockets to return packet-arrival timestamps as control information (PR #1179). Submitted by: Louis Mamakos <loiue@TransSys.com>
* Fix for PR #1146: the "next" pointer must be cached before calling soabortdg1996-04-161-4/+8
| | | | since the struct containing it may be freed.
* Changed socket code to use 4.4BSD queue macros. This includes removingdg1996-03-111-10/+23
| | | | | | | | | the obsolete soqinsque and soqremque functions as well as collapsing so_q0len and so_qlen into a single queue length of unaccepted connections. Now the queue of unaccepted & complete connections is checked directly for queued sockets. The new code should be functionally equivilent to the old while being substantially faster - especially in cases where large numbers of connections are often queued for accept (e.g. http).
* Kill XNS.wollman1996-02-131-2/+2
| | | | | While we're at it, fix socreate() to take a process argument. (This was supposed to get committed days ago...)
* Define a new socket option, SO_PRIVSTATE. Getting it returns the statewollman1996-02-071-1/+10
| | | | of the SS_PRIV flag in so_state; setting it always clears same.
* Nuked ambiguous sleep message strings:bde1995-12-141-2/+2
| | | | | | | old: new: netcls[] = "netcls" "soclos" netcon[] = "netcon" "accept", "connec" netio[] = "netio" "sblock", "sbwait"
* Make somaxconn (maximum backlog in a listen(2) request) and sb_maxwollman1995-11-031-4/+8
| | | | | | | | (maximum size of a socket buffer) tunable. Permit callers of listen(2) to specify a negative backlog, which is translated into somaxconn. Previously, a negative backlog was silently translated into 0.
* Remove extra arg from one of the calls to (*pr_usrreq)().bde1995-08-251-3/+2
|
* Remove trailing whitespace.rgrimes1995-05-301-2/+2
|
* getsockopt(s, SOL_SOCKET, SO_SNDTIMEO, ...) would construct the returnedwollman1995-02-161-2/+2
| | | | | | timeval incorrectly, truncating the usec part. Obtained from: Stevens vol. 2 p. 548
* Merge in the socket-level support for Transaction TCP.wollman1995-02-071-4/+21
|
* Use M_NOWAIT instead of M_KERNEL for socket allocations; it is apparantlydg1995-02-061-2/+2
| | | | | | possible for certain socket operations to occur during interrupt context. Submitted by: John Dyson
OpenPOWER on IntegriCloud