summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/bluetooth/socket
diff options
context:
space:
mode:
authoremax <emax@FreeBSD.org>2004-04-23 20:21:17 +0000
committeremax <emax@FreeBSD.org>2004-04-23 20:21:17 +0000
commita2939bc1de354a17c2e184e24be18cb195843a07 (patch)
tree5f8877a798187f70ffdcb1bc55571951138f2138 /sys/netgraph/bluetooth/socket
parent047d23ddc14479dbf396d021ba46441131b0b3e9 (diff)
downloadFreeBSD-src-a2939bc1de354a17c2e184e24be18cb195843a07.zip
FreeBSD-src-a2939bc1de354a17c2e184e24be18cb195843a07.tar.gz
Make sure RFCOMM multiplexor channel does not hang in DISCONNECTING
state. Apparently it happens when both devices try to disconnect RFCOMM multiplexor channel at the same time. The scenario is as follows: - local device initiates RFCOMM connection to the remote device. This creates both RFCOMM multiplexor channel and data channel; - remote device terminates RFCOMM data channel (inactivity timeout); - local device acknowledges RFCOMM data channel termination. Because there is no more active data channels and local device has initiated connection it terminates RFCOMM multiplexor channel; - remote device does not acknowledges RFCOMM multiplexor channel termination. Instead it sends its own request to terminate RFCOMM multiplexor channel. Even though local device acknowledges RFCOMM multiplexor channel termination the remote device still keeps L2CAP connection open. Because of hanging RFCOMM multiplexor channel subsequent RFCOMM connections between local and remote devices will fail. Reported by: Johann Hugo <jhugo@icomtek.csir.co.za>
Diffstat (limited to 'sys/netgraph/bluetooth/socket')
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
index 5c20618..5b53312 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
@@ -2065,9 +2065,12 @@ ng_btsocket_rfcomm_receive_disc(ng_btsocket_rfcomm_session_p s, int dlci)
if (dlci == 0) {
/* XXX FIXME assume that remote side will close the socket */
error = ng_btsocket_rfcomm_send_command(s, RFCOMM_FRAME_UA, 0);
- if (error == 0)
- s->state = NG_BTSOCKET_RFCOMM_SESSION_DISCONNECTING;
- else
+ if (error == 0) {
+ if (s->state == NG_BTSOCKET_RFCOMM_SESSION_DISCONNECTING)
+ s->state = NG_BTSOCKET_RFCOMM_SESSION_CLOSED; /* XXX */
+ else
+ s->state = NG_BTSOCKET_RFCOMM_SESSION_DISCONNECTING;
+ } else
s->state = NG_BTSOCKET_RFCOMM_SESSION_CLOSED; /* XXX */
ng_btsocket_rfcomm_session_clean(s);
OpenPOWER on IntegriCloud