summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* remove IP_JUMBO, SO_JUMBO, and RTF_JUMBO.dlg2012-03-171-3/+1
| | | | no objection from mcbride@ krw@ markus@ deraadt@
* Close a race that would corrupt a sockbuf because the code that externalizeskettenis2012-03-141-37/+66
| | | | | | | | | an SCM_RIGHTS message may sleep. Bits and pieces from NetBSD with some simplifications by yours truly. Fixes the "receive 1" panic seen by many. ok guenther@, claudio@
* iPrevent that a socket splicing timeout error in one direction isbluhm2011-08-231-2/+2
| | | | | also added to the other direction. ok mikeb@
* Implement an idle timeout for the socket splicing. A new `sp_idle'mikeb2011-07-041-6/+31
| | | | | | | field of the `splice' structure can be used to specify a period of inactivity after which splicing will be dissolved. ETIMEDOUT error retrieved with a SO_ERROR indicates the idle timeout expiration. With comments from and OK bluhm.
* kqueue attach functions should return an errno or 0, not a plain 1. Fixnicm2011-07-021-2/+2
| | | | | | the obvious cases to return EINVAL and ENXIO. ok tedu deraadt
* recognize SO_RTABLE socket option at the SOL_SOCKET level;mikeb2011-05-021-1/+28
| | | | discussed with and ok claudio
* Put splice cleanup code into a common function sounsplice().bluhm2011-04-191-30/+25
| | | | ok claudio@
* Plug mbuf leaks in SO_PEERCRED by not double allocating mbufs intoclaudio2011-04-041-7/+9
| | | | | the same variable. Leak found with dlg's magic mbuf leakage finder. OK henning@, deraadt@
* If the socket was half closed then don't let userland change theclaudio2011-04-041-3/+13
| | | | | | socketbuffer size of the closed side since on half close the high watermark was set to 0. OK blambert@
* When a process reads from a spliced socket that already got anbluhm2011-03-141-2/+6
| | | | | | | | end-of-file but still has data in the receive buffer, soreceive() should block until all data has been moved. To make kqueue work with socket splicing, it has to report spliced sockets as non-readable. ok deraadt@
* There existed a race when a process was trying to read from a splicedbluhm2011-03-121-1/+8
| | | | | | | | | | socket. soreceive() releases splsoftnet for uiomove(). In that moment, somove() could pull the mbuf from the receive buffer. After that, soreceive removed the mbuf again. The corrupted length accounting resulted in a panic. The fix is to block read calls in soreceive() until splicing has been finished. just commit deraadt@
* When the maximum splice length has been reached, send out the databluhm2011-02-281-2/+2
| | | | | | immediately by unsetting the SS_ISSENDING flag. This prevents a possible 5 seconds delay in socket splicing. ok markus@; commit it deraadt@
* Add socket option SO_SPLICE to splice together two TCP sockets.bluhm2011-01-071-2/+359
| | | | | | | The data received on the source socket will automatically be sent on the drain socket. This allows to write relay daemons with zero data copy. ok markus@
* TCP send and recv buffer scaling.claudio2010-09-241-3/+5
| | | | | | | | | | | | | | | | | Send buffer is scaled by not accounting unacknowledged on the wire data against the buffer limit. Receive buffer scaling is done similar to FreeBSD -- measure the delay * bandwith product and base the buffer on that. The problem is that our RTT measurment is coarse so it overshoots on low delay links. This does not matter that much since the recvbuffer is almost always empty. Add a back pressure mechanism to control the amount of memory assigned to socketbuffers that kicks in when 80% of the cluster pool is used. Increases the download speed from 300kB/s to 4.4MB/s on ftp.eu.openbsd.org. Based on work by markus@ and djm@. OK dlg@, henning@, put it in deraadt@
* Fix the naming of interfaces and variables for rdomains and rtablesguenther2010-07-031-2/+1
| | | | | | | | | | | | and make it possible to bind sockets (including listening sockets!) to rtables and not just rdomains. This changes the name of the system calls, socket option, and ioctl. After building with this you should remove the files /usr/share/man/cat2/[gs]etrdomain.0. Since this removes the existing [gs]etrdomain() system calls, the libc major is bumped. Written by claudio@, criticized^Wcritiqued by me
* remove support for compat_sunos (and m68k4k). ok deraadt guenthertedu2010-07-021-8/+1
|
* SO_PEERCRED should return ENOTCONN when the sockets are not connectedderaadt2010-07-011-2/+2
|
* Add getsockopt SOL_SOCKET SO_PEERCRED support. This behaves similar toderaadt2010-06-301-1/+18
| | | | | | | getpeereid(2), but also supplies the remote pid. This is supplied in a 'struct sockpeercred' (unlike Linux -- they showed how little they know about real unix by calling theirs 'struct ucred'). ok guenther ajacoutot
* Use suser when possible. Suggested by miod@.fgsch2009-10-311-2/+2
| | | | miod@ deraadt@ ok.
* Don't use char arrays for sleep wchans and reuse them.thib2009-08-101-2/+2
| | | | | | just use strings and make things unique. ok claudio@
* Initial support for routing domains. This allows to bind interfaces toclaudio2009-06-051-1/+3
| | | | | | | | | alternate routing table and separate them from other interfaces in distinct routing tables. The same network can now be used in any doamin at the same time without causing conflicts. This diff is mostly mechanical and adds the necessary rdomain checks accross net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6. input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@
* Introduce splsoftassert(), similar to splassert() but for soft interruptmiod2009-03-151-3/+3
| | | | | | levels. This will allow for platforms where soft interrupt levels do not map to real hardware interrupt levels to have soft ipl values overlapping hard ipl values without breaking spl asserts.
* fix PR 6082: do not create more fd's than will fit in the message onotto2009-02-221-3/+5
| | | | the receiving side when passing fd's. ok deraadt@ kettenis@
* Change sbreserve() to return 0 on success, 1 on failure, as god intended.blambert2009-01-131-3/+3
| | | | | | This sort of breaking with traditional and expected behavior annoys me. "yes!" henning@
* Change sb_timeo to unsigned, so that even if some calculation (ie. n * HZ)deraadt2008-10-091-3/+3
| | | | | | | | | becomes a very large number it will not wrap the short into a negative number and screw up timeouts. It will simply become a max of 65535. Since this happens when HZ is cranked to a high number, this will still only take n seconds, or less. Safer than crashing. Prompted by PR 5511 ok guenther
* don't wait for a free mbuf cluster in sosend() and enter the existingreyk2008-08-071-2/+2
| | | | | | | | | | | error handler that was never used before. this fixes a bug that a userland process might hang if the system ran out of mbuf clusters or even other unexpected behaviour in the network drivers. this bug is very old - it is also found in rev 1.1/stevens v2/44lite2/... discussed with many ok markus@ thib@ dlg@
* A bunch of pool_get() + bzero() -> pool_get(..., .. | PR_ZERO)mk2008-06-141-3/+2
| | | | | | | conversions that should shave a few bytes off the kernel. ok henning, krw, jsing, oga, miod, and thib (``even though i usually prefer FOO|BAR''; thanks for looking.
* Deal with the situation when TCP nfs mounts timeout and processesthib2008-05-231-16/+19
| | | | | | | | | | | | | get hung in nfs_reconnect() because they do not have the proper privilages to bind to a socket, by adding a struct proc * argument to sobind() (and the *_usrreq() routines, and finally in{6}_pcbbind) and do the sobind() with proc0 in nfs_connect. OK markus@, blambert@. "go ahead" deraadt@. Fixes an issue reported by bernd@ (Tested by bernd@). Fixes PR5135 too.
* Add SO_BINDANY socket option from BSD/OS.markus2008-05-091-1/+10
| | | | | | | | | The option allows a socket to be bound to addresses which are not local to the machine. In order to receive packets for these addresses SO_BINDANY needs to be combined with matching outgoing pf(4) divert rules, see pf.conf(5). ok beck@
* Make the SO_TIMESTAMP sockopt work. When set, this allows the user tockuethe2008-05-021-1/+3
| | | | | | | | | get a timestamp of when the datagram was accepted (by udp(4), for example) rather than having to take a timestamp with gettimeofday(2) when recv(2) returns - possibly several hundreds of microseconds later. May be of use to those interested in precision network timing schemes or QoS for media applications. Tested on alpha, amd64, i386 and sparc64. manpage suggestions from jmc, ok deraadt
* Remove an obsolete nfs kludge, spotted by Frank Denis (many thanks), also there in NetBSD and FreeBSD trees.chl2007-12-201-2/+2
| | | | | | | | Tested by thib@ who found that it shaved 18min wall clock time of coping a 20G file. Been in snaps for some time "looks ok" markus@ "makes sense" blambert@ ok claudio@ thib@
* exclude control data from the number of bytes returned by FIONREAD ioctl()kurt2007-02-261-1/+2
| | | | | | by adding a sb_datacc count to sockbuf that counts data excluding MT_CONTROL and MT_SONAME mbuf types. w/help from deraadt@. okay deraadt@ claudio@
* Consistently spell FALLTHROUGH to appease lint.jsg2007-02-141-2/+2
| | | | ok kettenis@ cloder@ tom@ henning@
* allow SO_SNDBUF and SO_RECVBUF setsockopts on existing sockets to succeedbeck2006-06-101-5/+3
| | | | | | for any value that is not an increase in size when we are under mbuf pressure, rather than only succeeding when setting the value to the 4k minimum. ok markus@, henning@
* With the exception of two other small uncommited diffs this movesbrad2006-03-041-2/+2
| | | | | | the remainder of the network stack from splimp to splnet. ok miod@
* ansi/deregisterjsg2006-01-051-62/+26
|
* backout until we find a socket state for initderaadt2005-09-161-3/+1
|
* upon shutdown(), if socket is unconnected return ENOTCONN; ok millertderaadt2005-09-101-1/+3
|
* Use SHUT_* values directly in soshutdown() instead of convertingmillert2005-08-111-7/+11
| | | | to FREAD/FWRITE. OK deraadt@
* add a field to struct socket that stores the pid of the process thatdhartmei2005-05-271-1/+2
| | | | created the socket, and populate it. ok bob@, henning@
* Experimental support for opportunitic use of jumbograms where only some hostsmcbride2005-05-271-1/+3
| | | | | | | | | | | | | | on the local network support them. This adds a new socket option, SO_JUMBO, and a new route flag, RTF_JUMBO. If _both_ the socket option is set and the route for the host has RTF_JUMBO set, ip_output will fragment the packet to the largest possible size for the link, ignoring the card's MTU. The semantics of this feature will be evolving rapidly; talk to us if you intend to use it. ok deraadt@ marius@
* enable receive() accounting and use uio_procp for send() accounting, toomarkus2004-11-181-5/+3
| | | | ok deraadt, jared, djm
* add hint for lower layer that a sosend() is in progress (SS_ISSENDING)markus2004-09-161-1/+6
| | | | | inspired by a posting from David Borman and similar changes in net/freebsd ok mcbride
* Call dom_dispose() for any SCM_RIGHTS message that went through themillert2004-07-281-1/+8
| | | | | | | | | read path rather than recv. Previously, if an fd was passed via sendmsg() but was consumed by the receiver via read() the ref count was incremented and never decremented and so the ref count would never reach zero even when there was no long any processes holding the file open (this was especially bad for locked fds). OK markus@ and art@
* also use sbcheckreserve() for setsockopt of SO_SNDBUF and SO_RCVBUFderaadt2004-04-191-4/+12
|
* use NULL for ptrs. parts from Joris Vinktedu2004-04-011-10/+10
|
* remove caddr_t casts. it's just silly to cast something when the functiontedu2003-07-211-4/+4
| | | | takes a void *. convert uiomove to take a void * as well. ok deraadt@
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* knfderaadt2003-02-031-9/+9
|
* Avoid possible wraparound when checking timeout size; mickey@ OKmillert2002-11-271-2/+2
|