summaryrefslogtreecommitdiffstats
path: root/sys/netipx/spx_usrreq.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove IPX support.glebius2014-03-141-1793/+0
| | | | | | | | | | | IPX was a network transport protocol in Novell's NetWare network operating system from late 80s and then 90s. The NetWare itself switched to TCP/IP as default transport in 1998. Later, in this century the Novell Open Enterprise Server became successor of Novell NetWare. The last release that claimed to still support IPX was OES 2 in 2007. Routing equipment vendors (e.g. Cisco) discontinued support for IPX in 2011. Thus, IPX won't be supported in FreeBSD 11.0-RELEASE.
* Mechanically substitute flags from historic mbuf allocator withglebius2012-12-051-5/+5
| | | | | | | | | malloc(9) flags within sys. Exceptions: - sys/contrib not touched - sys/mbuf.h edited manually
* Implement socket delivery MAC checks for IPX/SPX.rwatson2009-06-201-0/+5
| | | | | Obtained from: TrustedBSD Project MFC after: 3 days
* Rework SPX segment reassembly, which was originally based on our TCPrwatson2009-06-201-1/+1
| | | | | | | | | | reassembly but failed to be modernized over time: - Use queue(9). - Specifically allocate queue entries of type M_SPXREASSQ to point at member mbufs, rather than casting mbuf data to 'spx_q'. - Maintain the mbuf pointer as part of the queue entry so that we can later free the mbuf without using dtom().
* Invoke the MAC Framework's mac_socket_create_mbuf() entry point whenrwatson2009-06-201-0/+6
| | | | | | generating IPX output for SPX sockets. Obtained from: TrustedBSD Project
* Add missing call to ipx_pcbdetach() during SPX socket tear-down: notrwatson2009-05-251-0/+1
| | | | | | | harmful in practice if running without INVARIANTS, but will panic with KASSERT enabled when SPX sockets are closed. MFC after: 3 days
* Eliminate use of dtom() in spx_output() by fixing up tracking of therwatson2009-05-251-7/+10
| | | | | | containing mbuf for 'si' in local variable 'm'. MFC after: 1 month
* Prefer NULL to 0 for pointer assignments.rwatson2009-05-251-2/+2
| | | | MFC after: 1 month
* Rather than store a skeleton IPX header in an mbuf hung off the SPXrwatson2009-05-251-10/+13
| | | | | | | | | | PCB, simply embed it in the PCB, avoiding additional memory overhead, memory allocation overhead, and removing one of the few remaining uses of dtom() in the network stack. Restore misplaced spx_ctlinput() from an earlier commit. MFC after: 1 month
* Pull SPX reassembly queue init and flush into spx_reass.c.rwatson2009-05-251-11/+3
| | | | MFC after: 1 month
* Prefer m_nextpkt to m_act when iterating mbuf queues.rwatson2009-05-251-1/+1
| | | | MFC after: 1 month
* Complete move of SPX reassembly from spx_usrreq.c to spx_reass.c.rwatson2009-05-251-352/+3
| | | | MFC after: 1 month
* Make the SPX code use its own copies of insque()/remque().ed2009-04-261-3/+22
| | | | | | Instead of using the antique insque()/remque() functions from sys/queue.h, make this code use its own versions. Eventually the code should just use the regular TAILQ/LIST macros.
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).des2008-10-231-4/+4
| | | | MFC after: 3 months
* Rather than m_free(dtom(si)) in spx_reass(), return (1) which causes therwatson2008-05-291-6/+3
| | | | | | caller to free the mbuf without using dtom(). MFC after: 3 days
* Correct minor comment typos, make white space use before block commentsrwatson2008-05-291-6/+19
| | | | | | more consistent. MFC after: 3 days
* Avoid unnecessary one use of dtom(9) in spx_input().rwatson2008-05-261-1/+1
| | | | MFC after: 3 days
* 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
* Change semantics of socket close and detach. Add a new protocol switchrwatson2006-07-211-8/+29
| | | | | | | | | | | | | | | | | | | 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
* 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
* In spx_output(), use M_DONTWAIT instead of M_TRYWAIT, as we hold therwatson2006-03-271-5/+6
| | | | | | | | ipxpcb mutex. Contrary to the comment, even in 4.x this was unsafe, as parallel use of the socket by another process would result in pcb corruption if the mbuf allocation slept. MFC after: 1 month
* In spx_input(), change a '&&' to a '||', as the spx trace code is ablerwatson2006-03-271-1/+1
| | | | | | to handle a NULL 'cb' here. MFC after: 1 month
* In spx_accept, assert ipxp != NULL, not == NULL.rwatson2006-03-261-1/+1
| | | | MFC after: 1 month
* In various SPX protocol entry points from the socket layer, checkrwatson2006-03-261-7/+53
| | | | | | | | IPXP_DROPPED before continuing, and return EINVAL or ECONNRESET if it is flagged. It's unclear why each situation should be one or the other, but it is copied from netinet which has the same bugs. MFC after: 1 month
* Add a new ipxpcb flag, IPXP_SPX, which is set on ipxpcb's to mark themrwatson2006-03-261-9/+14
| | | | | | | | | | as belonging to SPX. This replaces the implicit assumption that the cb pointer for non-SPX pcb's will be NULL. This isn't required in TCP/IP as different pcb lists are maintained for different IP protocols; IPX stores all pcbs on the same global ipxpcb_list. Foot provided by: gnn MFC after: 1 month
* Restore original formulation of SPX segment queue draining during SPXrwatson2006-03-261-1/+3
| | | | | | PCB detach. MFC after: 1 month
* Rework IPX/SPX socket and pcb reference model:rwatson2006-03-251-68/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Restructure spx_attach() to properly free memory in the event that onerwatson2006-03-251-21/+32
| | | | | | | | | | of its allocations fails. Allocate the ipxp last so as to avoid having to free it if another allocation goes wrong. Normalize retrieval of ipxp and cb from socket in spx_sp_attach(), and add assertions. MFC after: 1 month
* Don't bother restoring host byte order of mbuf fields when we're justrwatson2006-03-251-3/+0
| | | | | | about to free the mbuf in the spx_input() error path. MFC after: 1 month
* In spx_ctloutput(), acquire the ipxp lock around read operations,rwatson2006-03-251-15/+25
| | | | | | | | especially reads of spx header structures, which will now be cached in the stack until they can be copied out after releasing the lock. Panic if a bad socket option direction is passed in by the caller. MFC after: 1 month
* Slight style reformatting of spx_timers() comments; panic if anrwatson2006-03-251-10/+12
| | | | | | unrecognized timer is passed into the function. MFC after: 1 month
* Clean up and style(9) SPX code prior to significant functional changesrwatson2006-03-241-213/+253
| | | | | | | | | | | | | | being committed: - Wrap comments more evenly on right border. - Clean up braces. Also, along similar lines: - Assert some pointers are non-NULL before dereferencing them. - Remove one assertion that looks, on face value, poor. MFC after: 1 month
* Protect spx_iss using its own mutex, spx_mtx, rather than piggy-backingrwatson2006-03-241-1/+11
| | | | | | | on the global IPX mutex, which is not held at all necessary strategic points. MFC after: 1 month
* Move definition of spxrexmtthresh to top of file with other globalrwatson2006-03-241-2/+1
| | | | | | variables. MFC after: 1 month
* Canonicalize, update copyright.rwatson2006-03-241-102/+52
| | | | | | | Remove 'register'. Use ANSI prototypes, not K&R. MFC after: 1 month
* Move spx_savesi from being a global variable to an automatically allocatedrwatson2006-03-231-1/+1
| | | | | | | | variable on the spx_input() stack. It's not very large, and this will avoid parallelism issues when spx_input() runs in more than one thread at a time. MFC after: 1 month
* Admit to ourselves that we don't actually implement pr_ctlinput() forrwatson2006-03-231-23/+1
| | | | | | IPX or SPX, as the code in the implementing functions is essentially a no-op. Replace with a comment indicating we don't implement these currently.
* In spx_attach() and spx_detach(), there is no need to check whether therwatson2006-01-141-4/+0
| | | | | | | | | ipxpcb is NULL or not: in attach it will be, and on detach it won't be. If for any reason these invariants don't hold true, panicking is a good idea. Noticed by: Coverity Prevent analysis tool MFC after: 3 days
* Retire MT_HEADER mbuf type and change its users to use MT_DATA.andre2005-11-021-3/+3
| | | | | | | | | | | | Having an additional MT_HEADER mbuf type is superfluous and redundant as nothing depends on it. It only adds a layer of confusion. The distinction between header mbuf's and data mbuf's is solely done through the m->m_flags M_PKTHDR flag. Non-native code is not changed in this commit. For compatibility MT_HEADER is mapped to MT_DATA. Sponsored by: TCP/IP Optimization Fundraise 2005
* Push the assignment of a new or updated so_qlimit from solisten()rwatson2005-10-301-3/+4
| | | | | | | | | | | | | | following the protocol pru_listen() call to solisten_proto(), so that it occurs under the socket lock acquisition that also sets SO_ACCEPTCONN. This requires passing the new backlog parameter to the protocol, which also allows the protocol to be aware of changes in queue limit should it wish to do something about the new queue limit. This continues a move towards the socket layer acting as a library for the protocol. Bump __FreeBSD_version due to a change in the in-kernel protocol interface. This change has been tested with IPv4 and UNIX domain sockets, but not other protocols.
* In the current world order, solisten() implements the state transition ofrwatson2005-02-211-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a socket from a regular socket to a listening socket able to accept new connections. As part of this state transition, solisten() calls into the protocol to update protocol-layer state. There were several bugs in this implementation that could result in a race wherein a TCP SYN received in the interval between the protocol state transition and the shortly following socket layer transition would result in a panic in the TCP code, as the socket would be in the TCPS_LISTEN state, but the socket would not have the SO_ACCEPTCONN flag set. This change does the following: - Pushes the socket state transition from the socket layer solisten() to to socket "library" routines called from the protocol. This permits the socket routines to be called while holding the protocol mutexes, preventing a race exposing the incomplete socket state transition to TCP after the TCP state transition has completed. The check for a socket layer state transition is performed by solisten_proto_check(), and the actual transition is performed by solisten_proto(). - Holds the socket lock for the duration of the socket state test and set, and over the protocol layer state transition, which is now possible as the socket lock is acquired by the protocol layer, rather than vice versa. This prevents additional state related races in the socket layer. This permits the dual transition of socket layer and protocol layer state to occur while holding locks for both layers, making the two changes atomic with respect to one another. Similar changes are likely require elsewhere in the socket/protocol code. Reported by: Peter Holm <peter@holm.cc> Review and fixes from: emax, Antoine Brodin <antoine.brodin@laposte.net> Philosophical head nod: gnn
* Use the IPX PCB list mutex and IPX PCB mutexes to lock down the SPXrwatson2005-01-091-38/+108
| | | | | | | | | | | | | | | | | | | | | | | | portion of IPX/SPX: - Protect IPX PCB lists with the IPX PCB list mutex, in particular when calling PCB and PCB list manipulation routines in ipx_pcb.c. - Protect both IPX PCB state and SPX PCB state using the IPX PCB mutex. - Generally annotate locking, as well as adding liberal use of lock assertions to document locking requirements. - Where possible, use unlocked reads when reading integer or smaller sized socket options on SPX sockets. - De-spl throughout. Notes: - spx_input() expects both the list mutex and PCB mutex to be held on entry, but will release both on return. Because sonewconn() is called from spx_input(), it may actually drop one PCB lock and acquire another during generation of a new connection, meaning the caller is not in a position to unlock the PCB mutex. MFC after: 3 weeks
* Clean up return handling for a number of SPX-related routines thatrwatson2005-01-091-22/+29
| | | | | | | | | | | | | | | | were derived from more complex TCP versions of the same: - spx_close(), spx_disconnect(), spx_drop(), and spx_usrclosed() all always free's the spxpcb invalidating the argument, so a return value is not required to indicate if it has. - Annotate that the cb arguments to each of these functions is invalidated via a comment. - When tearing down a pcb due to sonewconn() having failed, mark the cb as NULL; later, when deciding whether to store trace information due to SO_DEBUG, check that cb is not NULL before dereferencing or a NULL pointer dereference may occur. MFC after: 3 weeks
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Acquire the socket buffer receive lock in spx_rcvoob() to permitrwatson2005-01-021-0/+3
| | | | multiple reads of receive buffer state to be performed atomically.
* Increase the coverage scope of the receive socket buffer lock inrwatson2005-01-021-10/+9
| | | | | | spx_reass() to increase atomicity across multiple operations on the socket buffer when iterating over the SPX fragment reassembly list for the ipxpcb, as well a to reduce the number of locking operations.
* Explicitly lock the send socket buffer in spx_reass() to cover the droprwatson2005-01-021-2/+3
| | | | | | | | record loop for ACK'd data, rather than relying on lokcing in sbdroprecord() and sowwakeup(), reducing the number of lock operations as well as eliminating a possible race against the head of the send buffer mbuf chain. Use the _locked variants of sbdroprecord() and sowwakeup().
* Use KASSERT() in preference to if()panic().rwatson2005-01-021-4/+1
|
* Trim trailing whitespace.rwatson2005-01-021-13/+13
|
OpenPOWER on IntegriCloud