diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-03-25 17:28:42 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-03-25 17:28:42 +0000 |
commit | 1cfd88a69729e158fe5ff02e63458690749fc413 (patch) | |
tree | b7d264b4afb5b95b38d654f6039ddb85f9abca77 /sys/netipx/ipx_pcb.c | |
parent | f594b5f37bad3af3a3ecddfae898048e07a57bc1 (diff) | |
download | FreeBSD-src-1cfd88a69729e158fe5ff02e63458690749fc413.zip FreeBSD-src-1cfd88a69729e158fe5ff02e63458690749fc413.tar.gz |
Rework IPX/SPX socket and pcb reference model:
- 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
Diffstat (limited to 'sys/netipx/ipx_pcb.c')
-rw-r--r-- | sys/netipx/ipx_pcb.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/netipx/ipx_pcb.c b/sys/netipx/ipx_pcb.c index 7b29d12..e2d9f5c 100644 --- a/sys/netipx/ipx_pcb.c +++ b/sys/netipx/ipx_pcb.c @@ -274,8 +274,6 @@ ipx_pcbdisconnect(ipxp) IPX_LOCK_ASSERT(ipxp); ipxp->ipxp_faddr = zeroipx_addr; - if (ipxp->ipxp_socket->so_state & SS_NOFDREF) - ipx_pcbdetach(ipxp); } void @@ -287,10 +285,20 @@ ipx_pcbdetach(ipxp) IPX_LIST_LOCK_ASSERT(); IPX_LOCK_ASSERT(ipxp); - ACCEPT_LOCK(); - SOCK_LOCK(so); so->so_pcb = NULL; - sotryfree(so); + ipxp->ipxp_socket = NULL; +} + +void +ipx_pcbfree(ipxp) + struct ipxpcb *ipxp; +{ + + KASSERT(ipxp->ipxp_socket == NULL, + ("ipx_pcbfree: ipxp_socket != NULL")); + IPX_LIST_LOCK_ASSERT(); + IPX_LOCK_ASSERT(ipxp); + if (ipxp->ipxp_route.ro_rt != NULL) RTFREE(ipxp->ipxp_route.ro_rt); LIST_REMOVE(ipxp, ipxp_list); |