summaryrefslogtreecommitdiffstats
path: root/sys/netipx/ipx_usrreq.c
Commit message (Collapse)AuthorAgeFilesLines
* Implement socket delivery MAC checks for IPX/SPX.rwatson2009-06-201-0/+6
| | | | | Obtained from: TrustedBSD Project MFC after: 3 days
* Invoke the MAC Framework's mac_socket_create_mbuf() entry point whenrwatson2009-06-201-0/+5
| | | | | | generating IPX output for raw and datagram IPX sockets. Obtained from: TrustedBSD Project
* Add missing "goto set_head" for SO_IPX_CHECKSUM; otherwise we fall throughrwatson2008-12-111-0/+1
| | | | | | | | to the SO_HEADERS_ON_OUTPUT case and set that instead. MFC after: 1 week Found with: Coverity Prevent(tm) Coverity ID: 3988
* Begin the sysctl descriptions with a capital letter.trhodes2008-07-251-2/+2
| | | | Make some slight wording tweaks.
* Document a few sysctls.trhodes2008-07-201-2/+2
| | | | Reviewed by: rwatson
* Remove IPX over IP tunneling support, which allows IPX routing over IPrwatson2007-06-131-6/+0
| | | | | | | | | | tunnels, and was not MPSAFE. The code can be easily restored in the event that someone with an IPX over IP tunnel configuration can work with me to test patches. This removes one of five remaining consumers of NET_NEEDS_GIANT. Approved by: re (kensmith)
* Use ANSI C function declarations throughout netipx.rwatson2007-05-111-56/+23
| | | | Remove 'register' use.
* Reduce network stack oddness: implement .pru_sockaddr and .pru_peeraddrrwatson2007-05-111-2/+2
| | | | | | | | protocol entry points using functions named proto_getsockaddr and proto_getpeeraddr rather than proto_setsockaddr and proto_setpeeraddr. While it's true that sockaddrs are allocated and set, the net effect is to retrieve (get) the socket address or peer address from a socket, not set it, so align names to that intent.
* Factor out UCB and my copyrights from copyrights of Mike Mitchell;rwatson2007-01-081-1/+27
| | | | | | | the former use a three-clause BSD license (per UCB authorization letter), whereas he uses a four-clause BSD license. MFC after: 3 days
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-2/+8
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Change semantics of socket close and detach. Add a new protocol switchrwatson2006-07-211-7/+14
| | | | | | | | | | | | | | | | | | | function, pru_close, to notify protocols that the file descriptor or other consumer of a socket is closing the socket. pru_abort is now a notification of close also, and no longer detaches. pru_detach is no longer used to notify of close, and will be called during socket tear-down by sofree() when all references to a socket evaporate after an earlier call to abort or close the socket. This means detach is now an unconditional teardown of a socket, whereas previously sockets could persist after detach of the protocol retained a reference. This faciliates sharing mutexes between layers of the network stack as the mutex is required during the checking and removal of references at the head of sofree(). With this change, pru_detach can now assume that the mutex will no longer be required by the socket layer after completion, whereas before this was not necessarily true. Reviewed by: gnn
* Make this compile without INVARIANTS.cognet2006-04-111-0/+2
|
* Chance protocol switch method pru_detach() so that it returns voidrwatson2006-04-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | rather than an error. Detaches do not "fail", they other occur or the protocol flags SS_PROTOREF to take ownership of the socket. soclose() no longer looks at so_pcb to see if it's NULL, relying entirely on the protocol to decide whether it's time to free the socket or not using SS_PROTOREF. so_pcb is now entirely owned and managed by the protocol code. Likewise, no longer test so_pcb in other socket functions, such as soreceive(), which have no business digging into protocol internals. Protocol detach routines no longer try to free the socket on detach, this is performed in the socket code if the protocol permits it. In rts_detach(), no longer test for rp != NULL in detach, and likewise in other protocols that don't permit a NULL so_pcb, reduce the incidence of testing for it during detach. netinet and netinet6 are not fully updated to this change, which will be in an upcoming commit. In their current state they may leak memory or panic. MFC after: 3 months
* Change protocol switch pru_abort() API so that it returns void ratherrwatson2006-04-011-6/+2
| | | | | | | | | | | | | | than an int, as an error here is not meaningful. Modify soabort() to unconditionally free the socket on the return of pru_abort(), and modify most protocols to no longer conditionally free the socket, since the caller will do this. This commit likely leaves parts of netinet and netinet6 in a situation where they may panic or leak memory, as they have not are not fully updated by this commit. This will be corrected shortly in followup commits to these components. MFC after: 3 months
* Rework IPX/SPX socket and pcb reference model:rwatson2006-03-251-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | - Introduce invariant that all IPX/SPX sockets will have valid so_pcb pointers to ipxpcb structures, and that for SPX, the control block pointer will always be valid. Don't attempt to free the socket or pcb at various odd points, such as disconnect. - Add a new ipxpcb flag, IPXP_DROPPED, which will be set in place of freeing PCB's so that this invariant can be maintained. This flag is now checked instead of a NULL check in various socket protocol calls. - Introduce many assertions that this invariant holds. - Various pieces of code, such as the SPX timer code, no longer needs to jump through hoops in case it frees a PCB while running. - Break out ipx_pcbfree() from ipx_pcbdetach(). Likewise spx_pcbdetach(). - Comment on some SMP-related limitations to the SPX code. - Update copyrights. MFC after: 1 month
* Protect ipx_pexseq with the IPX PCB list mutex.rwatson2005-01-091-2/+11
| | | | | | | | When processing socket options against IPX PCBs, generally protect PCB fields using the IPX PCB mutex. Where possible, use unlocked reads on integer values to avoid locking overhead. MFC after: 3 weeks
* Acquire or assert the IPX PCB list lock or IPX PCB lock during variousrwatson2005-01-091-33/+72
| | | | | | | | | | protocol methods relating to IPX. Conditionally acquire the PCB list lock in the send operation only if the socket requires binding in order to use the requested address. Remove spl's generally no longer required during these accesses. MFC after: 3 weeks
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Garbage collect unused ipx_abort().rwatson2005-01-031-12/+2
| | | | | | Spell NULL right in a KASSERT() panic message. MFC after: 1 week
* Restructure ipx_input() return code to match similar code in netinet,rwatson2005-01-021-8/+6
| | | | avoiding a goto.
* Eliminate XXX comments regarding allocation failures when retrievingrwatson2005-01-021-2/+2
| | | | | | the peer address by using M_WAITOK in ipx_setpeeraddr() to prevent allocation failure. The socket reference used to reach these calls will prevent the ipxpcb from being released prematurely.
* Use KASSERT() in preference to if()panic().rwatson2005-01-021-2/+1
|
* Trim trailing whitespace.rwatson2005-01-021-6/+6
|
* Marginally reformat copyright statements to remove an excess ','.rwatson2004-12-311-1/+1
|
* Convert netipx to use queue(9) doubly-linked lists instead of home-brewrwatson2004-12-301-2/+3
| | | | linked lists for ipxpcb's.
* Initialize struct pr_userreqs in new/sparse style and fill in commonphk2004-11-081-10/+22
| | | | | | default elements in net_init_domain(). This makes it possible to grep these structures and see any bogosities.
* Push acquisition of the accept mutex out of sofree() into the callerrwatson2004-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (sorele()/sotryfree()): - This permits the caller to acquire the accept mutex before the socket mutex, avoiding sofree() having to drop the socket mutex and re-order, which could lead to races permitting more than one thread to enter sofree() after a socket is ready to be free'd. - This also covers clearing of the so_pcb weak socket reference from the protocol to the socket, preventing races in clearing and evaluation of the reference such that sofree() might be called more than once on the same socket. This appears to close a race I was able to easily trigger by repeatedly opening and resetting TCP connections to a host, in which the tcp_close() code called as a result of the RST raced with the close() of the accepted socket in the user process resulting in simultaneous attempts to de-allocate the same socket. The new locking increases the overhead for operations that may potentially free the socket, so we will want to revise the synchronization strategy here as we normalize the reference counting model for sockets. The use of the accept mutex in freeing of sockets that are not listen sockets is primarily motivated by the potential need to remove the socket from the incomplete connection queue on its parent (listen) socket, so cleaning up the reference model here may allow us to substantially weaken the synchronization requirements. RELENG_5_3 candidate. MFC after: 3 days Reviewed by: dwhite Discussed with: gnn, dwhite, green Reported by: Marc UBM Bocklet <ubm at u-boot-man dot de> Reported by: Vlad <marchenko at gmail dot com>
* Extend coverage of SOCK_LOCK(so) to include so_count, the socketrwatson2004-06-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | reference count: - Assert SOCK_LOCK(so) macros that directly manipulate so_count: soref(), sorele(). - Assert SOCK_LOCK(so) in macros/functions that rely on the state of so_count: sofree(), sotryfree(). - Acquire SOCK_LOCK(so) before calling these functions or macros in various contexts in the stack, both at the socket and protocol layers. - In some cases, perform soisdisconnected() before sotryfree(), as this could result in frobbing of a non-present socket if sotryfree() actually frees the socket. - Note that sofree()/sotryfree() will release the socket lock even if they don't free the socket. Submitted by: sam Sponsored by: FreeBSD Foundation Obtained from: BSD/OS
* Introduce a MAC label reference in 'struct inpcb', which cachesrwatson2003-11-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | the MAC label referenced from 'struct socket' in the IPv4 and IPv6-based protocols. This permits MAC labels to be checked during network delivery operations without dereferencing inp->inp_socket to get to so->so_label, which will eventually avoid our having to grab the socket lock during delivery at the network layer. This change introduces 'struct inpcb' as a labeled object to the MAC Framework, along with the normal circus of entry points: initialization, creation from socket, destruction, as well as a delivery access control check. For most policies, the inpcb label will simply be a cache of the socket label, so a new protocol switch method is introduced, pr_sosetlabel() to notify protocols that the socket layer label has been updated so that the cache can be updated while holding appropriate locks. Most protocols implement this using pru_sosetlabel_null(), but IPv4/IPv6 protocols using inpcbs use the the worker function in_pcbsosetlabel(), which calls into the MAC Framework to perform a cache update. Biba, LOMAC, and MLS implement these entry points, as do the stub policy, and test policy. Reviewed by: sam, bms Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Use __FBSDID().obrien2003-06-111-2/+3
|
* Remove unimplemented IP-in-IPX encapsulation support (options IPTUNNEL).tjr2003-03-081-7/+0
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-2/+2
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-2/+2
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.tanimura2002-05-311-27/+4
| | | | Requested by: hsu
* Lock down a socket, milestone 1.tanimura2002-05-201-4/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a socket buffer. The mutex in the receive buffer also protects the data in struct socket. o Determine the lock strategy for each members in struct socket. o Lock down the following members: - so_count - so_options - so_linger - so_state o Remove *_locked() socket APIs. Make the following socket APIs touching the members above now require a locked socket: - sodisconnect() - soisconnected() - soisconnecting() - soisdisconnected() - soisdisconnecting() - sofree() - soref() - sorele() - sorwakeup() - sotryfree() - sowakeup() - sowwakeup() Reviewed by: alfred
* Revert the change of #includes in sys/filedesc.h and sys/socketvar.h.tanimura2002-04-301-3/+6
| | | | | | | | | | Requested by: bde Since locking sigio_lock is usually followed by calling pgsigio(), move the declaration of sigio_lock and the definitions of SIGIO_*() to sys/signalvar.h. While I am here, sort include files alphabetically, where possible.
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-1/+1
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* Give struct socket structures a ref counting interface similar todillon2001-11-171-1/+1
| | | | | | | vnodes. This will hopefully serve as a base from which we can expand the MP code. We currently do not attempt to obtain any mutex or SX locks, but the door is open to add them when we nail down exactly how that part of it is going to work.
* KSE Milestone 2julian2001-09-121-21/+21
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Mechanical change to use <sys/queue.h> macro API instead ofphk2001-02-041-2/+2
| | | | | | | fondling implementation details. Created with: sed(1) Reviewed by: md5(1)
* Move suser() and suser_xxx() prototypes and a related #define fromphk2000-10-291-1/+0
| | | | | | | | | <sys/proc.h> to <sys/systm.h>. Correctly document the #includes needed in the manpage. Add one now needed #include of <sys/systm.h>. Remove the consequent 48 unused #includes of <sys/proc.h>.
* M_PREPEND-related cleanups (unregisterifying struct mbuf *s).green1999-12-191-1/+1
|
* Get rid of the old XNS checksum code and implement it the IPX way.jhay1999-08-281-4/+9
| | | | | PR: 13374 Submitted by: Boris Popov <bp@butya.kz>
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Suser() simplification:phk1999-04-271-2/+2
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* Make it possible to use lo0 as an internal IPX network. This is usefulljhay1999-02-061-3/+2
| | | | | | for mars_nwe server and nwfs. PR: 9871 Submitted by: Boris Popov <bp@butya.kz>
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticarchie1998-12-071-2/+1
| | | | and local variables, goto labels, and functions declared but not defined.
* Yow! Completely change the way socket options are handled, eliminatingwollman1998-08-231-52/+39
| | | | | | another specialized mbuf type in the process. Also clean up some of the cruft surrounding IPFW, multicast routing, RSVP, and other ill-explored corners.
* Staticize.eivind1998-02-091-3/+3
|
* Throw options IPX, IPXIP and IPTUNNEL into opt_ipx.h.eivind1997-12-151-3/+7
| | | | | | | | The #ifdef IPXIP in netipx/ipx_if.h is OK (used from ipx_usrreq.c and ifconfig.c only). I also fixed a typo IPXTUNNEL -> IPTUNNEL (and #ifdef'ed out the code inside, as it never could have compiled - doh.)
OpenPOWER on IntegriCloud