summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.c
Commit message (Collapse)AuthorAgeFilesLines
* Make sure that you can only bind a more specific address when it isguido1998-03-011-1/+7
| | | | | done by the same uid. Obtained from: OpenBSD
* Improved connection establishment performance by doing local port lookups viadg1998-01-271-105/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a hashed port list. In the new scheme, in_pcblookup() goes away and is replaced by a new routine, in_pcblookup_local() for doing the local port check. Note that this implementation is space inefficient in that the PCB struct is now too large to fit into 128 bytes. I might deal with this in the future by using the new zone allocator, but I wanted these changes to be extensively tested in their current form first. Also: 1) Fixed off-by-one errors in the port lookup loops in in_pcbbind(). 2) Got rid of some unneeded rehashing. Adding a new routine, in_pcbinshash() to do the initialial hash insertion. 3) Renamed in_pcblookuphash() to in_pcblookup_hash() for easier readability. 4) Added a new routine, in_pcbremlists() to remove the PCB from the various hash lists. 5) Added/deleted comments where appropriate. 6) Removed unnecessary splnet() locking. In general, the PCB functions should be called at splnet()...there are unfortunately a few exceptions, however. 7) Reorganized a few structs for better cache line behavior. 8) Killed my TCP_ACK_HACK kludge. It may come back in a different form in the future, however. These changes have been tested on wcarchive for more than a month. In tests done here, connection establishment overhead is reduced by more than 50 times, thus getting rid of one of the major networking scalability problems. Still to do: make tcp_fastimo/tcp_slowtimo scale well for systems with a large number of connections. tcp_fastimo is easy; tcp_slowtimo is difficult. WARNING: Anything that knows about inpcb and tcpcb structs will have to be recompiled; at the very least, this includes netstat(1).
* The spl fixes in in_setsockaddr and in_setpeeraddr that were meant todg1997-12-251-11/+17
| | | | | | | | | fix PR#3618 weren't sufficient since malloc() can block - allowing the net interrupts in and leading to the same problem mentioned in the PR (a panic). The order of operations has been changed so that this is no longer a problem. Needs to be brought into the 2.2.x branch. PR: 3618
* Removed unnecessary setting of 'error' -- binding to a privileged portalex1997-12-231-2/+2
| | | | by a non-root user always returns EACCES.
* Removed unused #includes.bde1997-10-281-6/+1
|
* Fix all areas of the system (or at least all those in LINT) to avoid storingwollman1997-08-161-20/+21
| | | | | | | | 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.
* Break apart initialization of s and inp from the declarations integge1997-05-191-5/+9
| | | | | in_setsockaddr and in_setpeeraddr. Suggested by: Justin T. Gibbs <gibbs@plutotech.com>
* Disallow network interrupts while the address is found and copied integge1997-05-191-1/+13
| | | | | | | in_setsockaddr and in_setpeeraddr. Handle the case where the socket was disconnected before the network interrupts were disabled. Reviewed by: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
* The long-awaited mega-massive-network-code- cleanup. Part I.wollman1997-04-271-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Reorganize elements of the inpcb struct to take better advantage ofdg1997-04-031-3/+4
| | | | | | | | cache lines. Removed the struct ip proto since only a couple of chars were actually being used in it. Changed the order of compares in the PCB hash lookup to take advantage of partial cache line fills (on PPro). Discussed-with: wollman
* Don't include <sys/ioctl.h> in the kernel. Stage 1: don't includebde1997-03-241-2/+1
| | | | | it when it is not used. In most cases, the reasons for including it went away when the special ioctl headers became self-sufficient.
* Improved performance of hash algorithm while (hopefully) not reducingdg1997-03-031-7/+7
| | | | | | | | the quality of the hash distribution. This does not fix a problem dealing with poor distribution when using lots of IP aliases and listening on the same port on every one of them...some other day perhaps; fixing that requires significant code changes. The use of xor was inspired by David S. Miller <davem@jenolan.rutgers.edu>
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Convert raw IP from mondo-switch-statement-from-Hell towollman1997-02-181-6/+19
| | | | | | | | | pr_usrreqs. Collapse duplicates with udp_usrreq.c and tcp_usrreq.c (calling the generic routines in uipc_socket2.c and in_pcb.c). Calling sockaddr()_ or peeraddr() on a detached socket now traps, rather than harmlessly returning an error; this should never happen. Allow the raw IP buffer sizes to be controlled via sysctl.
* 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.
* Convert the interface address and IP interface address structureswollman1996-12-131-8/+9
| | | | | | to TAILQs. Fix places which referenced these for no good reason that I can see (the references remain, but were fixed to compile again; they are still questionable).
* Fix braino on my part. When we have three different port ranges (default,peter1996-10-301-2/+5
| | | | | | | "high" and "secure"), we can't use a single variable to track the most recently used port in all three ranges.. :-] This caused the next transient port to be allocated from the start of the range more often than it should.
* Improved in_pcblookuphash() to support wildcarding, and changed relaventdg1996-10-071-27/+48
| | | | | | | | | | callers of it to take advantage of this. This reduces new connection request overhead in the face of a large number of PCBs in the system. Thanks to David Filo <filo@yahoo.com> for suggesting this and providing a sample implementation (which wasn't used, but showed that it could be done). Reviewed by: wollman
* Mark sockets where the kernel chose the port# for.phk1996-08-231-1/+3
| | | | This can be used by netstat to behave more intelligently.
* Add two more portrange sysctls, which control the area of the belowpeter1996-08-121-15/+42
| | | | | | | | IPPORT_RESERVED that is used for selection when bind() is told to allocate a reserved port. Also, implement simple sanity checking for all the addresses set, to make it a little harder for a user/sysadmin to shoot themselves in the feet.
* More closely preserve the original operation of rresvport() when usingpeter1996-05-311-2/+3
| | | | IP_PORTRANGE_LOW.
* Move or add #include <queue.h> in preparation for upcoming struct socketdg1996-03-111-2/+2
| | | | changes.
* Make the default behavior of local port assignment match traditionalpeter1996-02-221-14/+68
| | | | | | | | | | | | | | | | | | | | | | | | | systems (my last change did not mix well with some firewall configurations). As much as I dislike firewalls, this is one thing I I was not prepared to break by default.. :-) Allow the user to nominate one of three ranges of port numbers as candidates for selecting a local address to replace a zero port number. The ranges are selected via a setsockopt(s, IPPROTO_IP, IP_PORTRANGE, &arg) call. The three ranges are: default, high (to bypass firewalls) and low (to get a port below 1024). The default and high port ranges are sysctl settable under sysctl net.inet.ip.portrange.* This code also fixes a potential deadlock if the system accidently ran out of local port addresses. It'd drop into an infinite while loop. The secure port selection (for root) should reduce overheads and increase reliability of rlogin/rlogind/rsh/rshd if they are modified to take advantage of it. Partly suggested by: pst Reviewed by: wollman
* Change the default local address range for IP from 1024 through 5000peter1996-01-191-4/+18
| | | | | | | | | | | | | | to 20000 through 30000. These numbers are used for local IP port numbers when an explicit address is not specified. The values are sysctl modifiable under: net.inet.ip.port_{first|last}_auto These numbers do not overlap with any known server addresses, without going above 32768 which are "negative" on some other implementations. 20000 through 30000 is 2.5 times larger than the old range, but some have suggested even that may not be enough... (gasp!) Setting a low address of 10000 should be plenty.. :-)
* New style sysctl & staticize alot of stuff.phk1995-11-141-3/+6
|
* Second batch of cleanup changes.phk1995-10-291-2/+1
| | | | | This time mostly making a lot of things static and some unused variables here and there.
* Merge 4.4-Lite-2: use M_NOWAIT in in_pcballoc(), and return EACCES ratherwollman1995-09-211-4/+4
| | | | | | than EPERM on illegal attempt to bind a reserved port. Obtained from: 4.4BSD-Lite-2
* Remove trailing whitespace.rgrimes1995-05-301-8/+8
|
* Changed in_pcblookuphash() to not automatically call in_pcblookup() ifdg1995-05-031-15/+5
| | | | | | the lookup fails. Updated callers to deal with this. Call in_pcblookuphash instead of in_pcblookup() in in_pcbconnect; this improves performance of UDP output by about 17% in the standard case.
* Added splnet protections for PCB list manipulations and traversals.dg1995-04-101-2/+24
|
* Implemented PCB hashing. Includes new functions in_pcbinshash, in_pcbrehash,dg1995-04-091-32/+105
| | | | and in_pcblookuphash.
* Add and move declarations to fix all of the warnings from `gcc -Wimplicit'bde1995-03-161-2/+1
| | | | | | (except in netccitt, netiso and netns) and most of the warnings from `gcc -Wnested-externs'. Fix all the bugs found. There were no serious ones.
* pcb allocations are not always done on behalf of a process; it is notdg1995-03-141-2/+2
| | | | okay to wait.
* Move exact match pcb's to the head of the list to improve lookupdg1995-03-021-3/+8
| | | | performance.
* Transaction TCP support now standard. Hack away!wollman1995-02-161-21/+1
|
* T/TCP changes to generic IP code. This is all ifdefed TTCP so shouldwollman1995-02-081-1/+58
| | | | | have no effect on most users for now. (Eventually, once this code is fully tested, the ifdefs will go away.)
* Added $Id$dg1994-08-021-0/+1
|
* The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.rgrimes1994-05-251-7/+7
| | | | | Reviewed by: Rodney W. Grimes Submitted by: John Dyson and David Greenman
* BSD 4.4 Lite Kernel Sourcesrgrimes1994-05-241-0/+497
OpenPOWER on IntegriCloud