|
From: Anders J. <and...@us...> - 2002-02-25 14:08:38
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bnep.c 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20
l2cap.c 1.130 1.131=20=20=20=20=20=20=20=20=20=20=20
rfcomm.c 1.130 1.131=20=20=20=20=20=20=20=20=20=20=20
sdp.c 1.84 1.85=20=20=20=20=20=20=20=20=20=20=20=20
test.c 1.32 1.33=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Handle continuation flag in the configprocedure correctly.=20
* Handle the hintflag in a configurationoption.
The diff of the modified file(s):
--- bnep.c 20 Feb 2002 10:13:37 -0000 1.8
+++ bnep.c 25 Feb 2002 14:08:35 -0000 1.9
@@ -1316,27 +1316,20 @@
{
D_MISC(__FUNCTION__": remote cid %d\n", l2cap->remote_cid);
=20=09
- /* Check if we have sent a pos response yet */
- if (!l2ca_remote_conf_done(l2cap)) {
- /* Send a positive response */
if (l2ca_config_rsp(l2cap, l2cap->remote_mtu, NULL, CONF_SUCCESS)) {
D_ERR(__FUNCTION__": l2ca_config_rsp failed\n");
}
- } else {
- DSYS(__FUNCTION__": already sent a pos response\n");
- }
=20=09
/* If we weren't the initiator, we now send our configuration request. */
/* Fix l2cap->remote_mtu should be max BNEP_MTU??? */
- if (!l2cap->initiator) {
- if (!l2ca_local_conf_done(l2cap)) {
- if (l2ca_config_req(l2cap, l2cap->remote_mtu,=20
+ if (!l2ca_local_conf_done(con) && !con->conf_req_sent) {
+ if (l2ca_config_req(l2cap, BNEP_MTU,=20
NULL, BNEP_FLUSH_TIMEOUT, 0)) {
D_ERR(__FUNCTION__": l2ca_config_req failed\n");
}
- } else {
- DSYS(__FUNCTION__": already ready with config req\n");
}
+ else {
+ DSYS(__FUNCTION__": already ready with config req\n");
}
}
=20
@@ -1354,7 +1347,7 @@
DSYS(__FUNCTION__ ": l2cap configuration failed\n");
/* FIX ME notify usermode and reset connection */
return;
- } else {
+ } else if(l2cap->current_state =3D=3D OPEN) {
D_MISC(__FUNCTION__ ": remote cid %d\n", l2cap->remote_cid);
DSYS(__FUNCTION__ ": bnep channel opened\n");
dev =3D l2cap->upper_con;
@@ -1366,6 +1359,8 @@
bnep_setup_connection(local);=20
}
D_MISC("Interface %s\n", dev->name);
+ } else {
+ DSYS(__FUNCTION__": not done with configuration yet\n");
}
}
=20
--- l2cap.c 19 Feb 2002 19:04:41 -0000 1.130
+++ l2cap.c 25 Feb 2002 14:08:36 -0000 1.131
@@ -722,8 +722,7 @@
=20=09=09
switch (con->current_state) {
case CLOSED:
- /* FIXME - send peer=20
- 'l2cap_config_rsp_neg' */
+ l2cap_config_rsp(con, 0, NULL, CONF_REJ);
break;
=20=09=09=09
case CONFIG: {
@@ -1094,27 +1093,31 @@
#ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS
disable_rtx(con);
#endif
+ /* Do we expect any more values, if not we are done with our sides
+ configuration, reset the req_sent variable */
+ if(!confrsp->flags) {
con->conf_req_ready =3D TRUE;
+ con->conf_req_sent =3D 0;
+ }
=20
- if (!con->conf_rsp_ready) {
- /* Upper layers still haven't replied pos */
- D_STATE(__FUNCTION__": Still haven't replied pos on other sides conf r=
eq\n");
- return ;
- } else {=09=09=09=09
+
+ /* If both sides is ready with the configuration enter the
+ open state otherwise reside in CONFIG state */
+
+ if (l2ca_conf_done(con)) {=09=09=09
ENTERSTATE(con, OPEN);
PRINTSTATE(con);
DSYS("l2cap channel (%d,%d) [%s] connected\n",=20
con->local_cid, con->remote_cid,=20
psm2str(con->psm));
+ } else {
+ D_STATE(__FUNCTION__ ": Both sides not done with the configuration yet=
\n");
+ }
=20=09=09=09=09
/* notify upper layers that we successfully
opened a connection ! */
l2ca_config_cfm(con, confrsp->result);
-
- /* reset variable */
- con->conf_req_sent =3D 0;
return;
- }
=20=09=09=09
case CONF_FAILURE:
=20
@@ -1819,12 +1822,14 @@
=20
if (result =3D=3D CONF_SUCCESS) {
/* upper layers responded OK */
- con->conf_rsp_ready =3D TRUE;
=20
ret_val =3D l2cap_config_rsp(con, out_mtu, in_flow, result);
+ if(!con->remote_flags) {
+ con->conf_rsp_ready =3D TRUE;
+ }
=20
- /* check if we have sent a configure request yet */
- if (con->conf_req_ready && !con->remote_flags) {
+ /* Is the configuration done yet then enter OPEN state */
+ if (l2ca_conf_done(con)) {
/* all done, proceed to OPEN */
ENTERSTATE(con, OPEN);
PRINTSTATE(con);
@@ -3148,6 +3153,11 @@
return con->conf_req_ready;
}
=20
+s32 l2ca_conf_done(l2cap_con *con)
+{
+ return (con->conf_req_ready && con->conf_rsp_ready);
+}
+
/* Parse and set remote options in l2cap con */
s32=20
parse_options(l2cap_con *con, u8 *data, u32 len)
@@ -3163,7 +3173,9 @@
=20
while (pos < len) {
opt =3D (l2cap_option*)(data + pos);
- switch (opt->type) {
+=09=09
+ /* Strip the hint-bit before using */
+ switch (opt->type & 0x7f) {
case OPT_MTU:
con->remote_mtu =3D *(opt->option_data) |=20
(*(opt->option_data + 1) << 8);
--- rfcomm.c 3 Dec 2001 11:31:31 -0000 1.130
+++ rfcomm.c 25 Feb 2002 14:08:36 -0000 1.131
@@ -904,33 +904,14 @@
void=20
rfcomm_config_ind(l2cap_con* l2cap)
{
-
- /*=20
- FIXME
- Check whether the received params are acceptable,=20
- accept all for now
- */
-
D_CTRL("rfcomm_config_ind : remote cid %d\n", l2cap->remote_cid);
- /* check if we have sent a pos response yet */
- if (!l2ca_remote_conf_done(l2cap)){
- /* still haven't sent a pos configure response*/
-=09=09
if (l2ca_config_rsp(l2cap, l2cap->remote_mtu,=20
NULL, CONF_SUCCESS)) {
D_ERR(FNC"l2ca_config_rsp failed\n");
}
- } else=20
- DSYS(FNC"already have sent back a pos response\n");
-
=20
/* check if we received a pos response on a previous conf req */=20
- if (((rfcomm_con*) l2cap->upper_con)->initiator =3D=3D FALSE) {
-
- /* check if we received a pos response on a=20
- previous config req */=20
- if (!l2ca_local_conf_done(l2cap))
- {
+ if (!l2ca_local_conf_done(con) && !con->conf_req_sent) {
l2cap->local_mtu=3Dl2cap->remote_mtu;
=20
DSYS(FNC"Local l2cap mtu set to %d\n",=20
@@ -940,11 +921,9 @@
0, 0)) {
D_ERR(FNC"l2ca_config_req failed\n");
}
- } else=20
+ } else {
DSYS(FNC"already ready with config req\n");
-
}=20
-
}
=20
/* The lower protocol layer, L2CAP, indicates that the configuration
@@ -964,7 +943,7 @@
bt_connect_cfm(CREATE_RFCOMM_ID(rfcomm->line,0), status);
rfcomm_reset_con(rfcomm->line);
return;
- } else {
+ } else if(l2cap->current_state =3D=3D OPEN) {
DSYS(FNC"l2cap is now open\n");
=20=09=09
if (rfcomm->initiator &&=20
@@ -984,9 +963,9 @@
rfcomm->dlci[j].mtu =3D (l2cap->remote_mtu-5);
}
}
+ } else {
+ DSYS(FNC": configuration not done yet\n");
}
-=20=20=20=20=20=20=20=20
-
}
=20
/* The lower protocol layer, L2CAP, indicates that the lower layer=20
--- sdp.c 15 Jan 2002 11:02:28 -0000 1.84
+++ sdp.c 25 Feb 2002 14:08:37 -0000 1.85
@@ -525,6 +525,10 @@
return;
}
=20
+ if(l2cap->current_state !=3D OPEN) {
+ DSYS(__FUNTION__ ": Configuration not done yet\n");
+ }
+
/* Find the connecting sdp_con */
while ((i < MAX_NBR_SDP) && (!stop)) {
if ((sdp_con_list[i].state =3D=3D SDP_CONNECTING) &&=20
@@ -566,23 +570,12 @@
{
D_MISC(__FUNCTION__ " remote cid : %d\n", l2cap->remote_cid);
=20
- /* FIXME -- Check whether the received params are=20
- acceptable, accept all for now */
-
- /* check if we have sent a pos response yet */
- if (!l2ca_remote_conf_done(l2cap)) {
- /* still haven't sent a pos configure response*/
if (l2ca_config_rsp(l2cap, 0, NULL, CONF_SUCCESS)) {
D_ERR(__FUNCTION__ " Conf rsp failed\n");
}
- } else=20
- DSYS("already have sent back a pos response\n");
=20
- /* check if we received a pos response on a=20
- previous config req */=20
if (!l2ca_local_conf_done(l2cap) && !l2cap->conf_req_sent) {
/* FIXME -- use real options not static values */
-=09=09
if (l2ca_config_req(l2cap, 0, NULL, 0, 0)) {
D_ERR(__FUNCTION__ " Config request failed\n");
}
--- test.c 22 Oct 2001 13:25:54 -0000 1.32
+++ test.c 25 Feb 2002 14:08:37 -0000 1.33
@@ -326,18 +326,13 @@
D_STATE("test_config_ind : remote cid : %d remote_mtu : %d\n",=20
con->remote_cid, con->remote_mtu);
=20=09
- /* check if we have sent a pos response yet */
- if (!l2ca_remote_conf_done(con)) {
- /* still haven't sent a pos configure response*/
-
if (l2ca_config_rsp(con, 0, NULL, CONF_SUCCESS)) {
D_ERR("test_config_ind : Configuration response failed\n");
+=09=09=09
}=20=20=20=20
- } else=20
- printk("test_config_ind : already have sent back a pos response\n");
=20
- /* check if we received a pos response on a previous config req */=20
- if (!l2ca_local_conf_done(con)) {
+ /* Are we ready with our sides configuration */=20
+ if (!l2ca_local_conf_done(con) && !con->conf_req_sent) {
=20
/* still haven't sent config request yet */
=20
@@ -375,7 +370,9 @@
{
D_STATE("test_config_cfm : remote cid : %d\n", con->remote_cid);
=20=09
+ if(con->current_state =3D=3D OPEN) {
D_STATE("Now we have an open l2cap channel\n");
+ }
=20
/* negotiate upper protocol */
}
|