From 4421f50dbcd2f36b743aa399d2b97522e01adfa2 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Fri, 2 Jun 2006 08:27:15 +0000 Subject: [PATCH] raw_disconnect() now disconnects but does not detach the raw pcb. As a result, raw_uabort() now needs to call raw_detach() directly. As raw_uabort() is never called, and raw_disconnect() is probably not ever actually called in practice, this is likely not a functional change, but improves congruence between protocols, and avoids a NULL raw cb pointer after disconnect, which could result in a panic. MFC after: 1 month --- sys/net/raw_cb.c | 4 +--- sys/net/raw_usrreq.c | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/net/raw_cb.c b/sys/net/raw_cb.c index f45be72cb766..705db619f7bd 100644 --- a/sys/net/raw_cb.c +++ b/sys/net/raw_cb.c @@ -113,7 +113,7 @@ raw_detach(rp) } /* - * Disconnect and possibly release resources. + * Disconnect raw socket. */ void raw_disconnect(rp) @@ -125,8 +125,6 @@ raw_disconnect(rp) m_freem(dtom(rp->rcb_faddr)); rp->rcb_faddr = 0; #endif - if (rp->rcb_socket->so_state & SS_NOFDREF) - raw_detach(rp); } #ifdef notdef diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c index 5a7449a09790..4f2f006757e2 100644 --- a/sys/net/raw_usrreq.c +++ b/sys/net/raw_usrreq.c @@ -146,6 +146,7 @@ raw_uabort(struct socket *so) KASSERT(rp != NULL, ("raw_uabort: rp == NULL")); raw_disconnect(rp); soisdisconnected(so); + raw_detach(rp); } /* pru_accept is EOPNOTSUPP */