You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2021/05/27 08:20:55 UTC
[mynewt-nimble] 28/31: Revert "mesh: Check response address in
Configuration Client"
This is an automated email from the ASF dual-hosted git repository.
naraj pushed a commit to branch revert-958-mesh_sync_march21
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 02d8e6b0b365015aa54d5173e8be975799876389
Author: MichaĆ Narajowski <mi...@codecoup.pl>
AuthorDate: Thu May 27 10:20:19 2021 +0200
Revert "mesh: Check response address in Configuration Client"
This reverts commit 299b2ebe9ab2ac6c9cb85cffb0f10e18428212e1.
---
nimble/host/mesh/include/mesh/cfg_cli.h | 3 +-
nimble/host/mesh/src/cfg_cli.c | 91 +++++++++++++++------------------
2 files changed, 43 insertions(+), 51 deletions(-)
diff --git a/nimble/host/mesh/include/mesh/cfg_cli.h b/nimble/host/mesh/include/mesh/cfg_cli.h
index 368bdfc..bd2f9fe 100644
--- a/nimble/host/mesh/include/mesh/cfg_cli.h
+++ b/nimble/host/mesh/include/mesh/cfg_cli.h
@@ -26,9 +26,8 @@ struct bt_mesh_cfg_cli {
struct bt_mesh_model *model;
struct k_sem op_sync;
- uint32_t op_pending;
+ uint32_t op_pending;
void *op_param;
- uint16_t op_addr;
};
extern const struct bt_mesh_model_op bt_mesh_cfg_cli_op[];
diff --git a/nimble/host/mesh/src/cfg_cli.c b/nimble/host/mesh/src/cfg_cli.c
index 2df7d70..104d4e6 100644
--- a/nimble/host/mesh/src/cfg_cli.c
+++ b/nimble/host/mesh/src/cfg_cli.c
@@ -33,11 +33,6 @@ static int32_t msg_timeout = K_SECONDS(5);
static struct bt_mesh_cfg_cli *cli;
-static inline bool cli_response_check(uint32_t resp_opcode, uint16_t resp_addr)
-{
- return cli->op_pending == resp_opcode && cli->op_addr == resp_addr;
-}
-
static void comp_data_status(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct os_mbuf *buf)
@@ -49,7 +44,7 @@ static void comp_data_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_DEV_COMP_DATA_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_DEV_COMP_DATA_STATUS) {
BT_WARN("Unexpected Composition Data Status");
return;
}
@@ -74,7 +69,7 @@ static void state_status_u8(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(expect_status, ctx->addr)) {
+ if (cli->op_pending != expect_status) {
BT_WARN("Unexpected Status (0x%08x != 0x%08x)",
(unsigned) cli->op_pending, (unsigned) expect_status);
return;
@@ -129,7 +124,7 @@ static void relay_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_RELAY_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_RELAY_STATUS) {
BT_WARN("Unexpected Relay Status message");
return;
}
@@ -151,7 +146,7 @@ static void net_transmit_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_NET_TRANSMIT_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_NET_TRANSMIT_STATUS) {
BT_WARN("Unexpected Net Transmit Status message");
return;
}
@@ -179,7 +174,7 @@ static void net_key_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_NET_KEY_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_NET_KEY_STATUS) {
BT_WARN("Unexpected Net Key Status message");
return;
}
@@ -216,7 +211,7 @@ static void net_key_list(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_NET_KEY_LIST, ctx->addr)) {
+ if (cli->op_pending != OP_NET_KEY_LIST) {
BT_WARN("Unexpected Net Key List message");
return;
}
@@ -243,7 +238,7 @@ static void node_reset_status(struct bt_mesh_model *model,
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x",
ctx->net_idx, ctx->app_idx, ctx->addr);
- if (!cli_response_check(OP_NODE_RESET_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_NODE_RESET_STATUS) {
BT_WARN("Unexpected Node Reset Status message");
return;
}
@@ -274,7 +269,7 @@ static void app_key_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_APP_KEY_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_APP_KEY_STATUS) {
BT_WARN("Unexpected App Key Status message");
return;
}
@@ -315,7 +310,7 @@ static void app_key_list(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_APP_KEY_LIST, ctx->addr)) {
+ if (cli->op_pending != OP_APP_KEY_LIST) {
BT_WARN("Unexpected App Key List message");
return;
}
@@ -365,7 +360,7 @@ static void mod_app_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_MOD_APP_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_MOD_APP_STATUS) {
BT_WARN("Unexpected Model App Status message");
return;
}
@@ -454,7 +449,7 @@ static void mod_app_list(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_SIG_MOD_APP_LIST, ctx->addr)) {
+ if (cli->op_pending != OP_SIG_MOD_APP_LIST) {
BT_WARN("Unexpected Model App List message");
return;
}
@@ -470,7 +465,7 @@ static void mod_app_list_vnd(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_VND_MOD_APP_LIST, ctx->addr)) {
+ if (cli->op_pending != OP_VND_MOD_APP_LIST) {
BT_WARN("Unexpected Model App List Vendor message");
return;
}
@@ -498,7 +493,7 @@ static void mod_pub_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_MOD_PUB_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_MOD_PUB_STATUS) {
BT_WARN("Unexpected Model Pub Status message");
return;
}
@@ -574,7 +569,7 @@ static void mod_sub_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_MOD_SUB_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_MOD_SUB_STATUS) {
BT_WARN("Unexpected Model Subscription Status message");
return;
}
@@ -618,7 +613,7 @@ static void mod_sub_list(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_MOD_SUB_LIST, ctx->addr)) {
+ if (cli->op_pending != OP_MOD_SUB_LIST) {
BT_WARN("Unexpected Model Subscription List message");
return;
}
@@ -634,7 +629,7 @@ static void mod_sub_list_vnd(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_MOD_SUB_LIST_VND, ctx->addr)) {
+ if (cli->op_pending != OP_MOD_SUB_LIST_VND) {
BT_WARN("Unexpected Model Subscription List Vendor message");
return;
}
@@ -657,7 +652,7 @@ static void hb_sub_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_HEARTBEAT_SUB_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_HEARTBEAT_SUB_STATUS) {
BT_WARN("Unexpected Heartbeat Subscription Status message");
return;
}
@@ -691,7 +686,7 @@ static void hb_pub_status(struct bt_mesh_model *model,
ctx->net_idx, ctx->app_idx, ctx->addr, buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- if (!cli_response_check(OP_HEARTBEAT_PUB_STATUS, ctx->addr)) {
+ if (cli->op_pending != OP_HEARTBEAT_PUB_STATUS) {
BT_WARN("Unexpected Heartbeat Publication Status message");
return;
}
@@ -769,7 +764,7 @@ const struct bt_mesh_model_cb bt_mesh_cfg_cli_cb = {
.init = cfg_cli_init,
};
-static int cli_prepare(void *param, uint32_t op, uint16_t addr)
+static int cli_prepare(void *param, uint32_t op)
{
if (!cli) {
BT_ERR("No available Configuration Client context!");
@@ -783,7 +778,6 @@ static int cli_prepare(void *param, uint32_t op, uint16_t addr)
cli->op_param = param;
cli->op_pending = op;
- cli->op_addr = addr;
return 0;
}
@@ -792,7 +786,6 @@ static void cli_reset(void)
{
cli->op_pending = 0;
cli->op_param = NULL;
- cli->op_addr = BT_MESH_ADDR_UNASSIGNED;
}
static int cli_wait(void)
@@ -822,7 +815,7 @@ int bt_mesh_cfg_comp_data_get(uint16_t net_idx, uint16_t addr, uint8_t page,
};
int err;
- err = cli_prepare(¶m, OP_DEV_COMP_DATA_STATUS, addr);
+ err = cli_prepare(¶m, OP_DEV_COMP_DATA_STATUS);
if (err) {
goto done;
}
@@ -855,7 +848,7 @@ static int get_state_u8(uint16_t net_idx, uint16_t addr, uint32_t op, uint32_t r
};
int err;
- err = cli_prepare(val, rsp, addr);
+ err = cli_prepare(val, rsp);
if (err) {
goto done;
}
@@ -887,7 +880,7 @@ static int set_state_u8(uint16_t net_idx, uint16_t addr, uint32_t op, uint32_t r
};
int err;
- err = cli_prepare(val, rsp, addr);
+ err = cli_prepare(val, rsp);
if (err) {
goto done;
}
@@ -987,7 +980,7 @@ int bt_mesh_cfg_relay_get(uint16_t net_idx, uint16_t addr, uint8_t *status,
};
int err;
- err = cli_prepare(¶m, OP_RELAY_STATUS, addr);
+ err = cli_prepare(¶m, OP_RELAY_STATUS);
if (err) {
goto done;
}
@@ -1023,7 +1016,7 @@ int bt_mesh_cfg_relay_set(uint16_t net_idx, uint16_t addr, uint8_t new_relay,
};
int err;
- err = cli_prepare(¶m, OP_RELAY_STATUS, addr);
+ err = cli_prepare(¶m, OP_RELAY_STATUS);
if (err) {
goto done;
}
@@ -1061,7 +1054,7 @@ int bt_mesh_cfg_net_key_add(uint16_t net_idx, uint16_t addr, uint16_t key_net_id
};
int err;
- err = cli_prepare(¶m, OP_NET_KEY_STATUS, addr);
+ err = cli_prepare(¶m, OP_NET_KEY_STATUS);
if (err) {
goto done;
}
@@ -1104,7 +1097,7 @@ int bt_mesh_cfg_net_key_get(uint16_t net_idx, uint16_t addr, uint16_t *keys,
};
int err;
- err = cli_prepare(¶m, OP_NET_KEY_LIST, addr);
+ err = cli_prepare(¶m, OP_NET_KEY_LIST);
if (err) {
return err;
}
@@ -1138,7 +1131,7 @@ int bt_mesh_cfg_net_key_del(uint16_t net_idx, uint16_t addr,
};
int err;
- err = cli_prepare(¶m, OP_NET_KEY_STATUS, addr);
+ err = cli_prepare(¶m, OP_NET_KEY_STATUS);
if (err) {
goto done;
}
@@ -1182,7 +1175,7 @@ int bt_mesh_cfg_app_key_add(uint16_t net_idx, uint16_t addr, uint16_t key_net_id
};
int err;
- err = cli_prepare(¶m, OP_APP_KEY_STATUS, addr);
+ err = cli_prepare(¶m, OP_APP_KEY_STATUS);
if (err) {
goto done;
}
@@ -1225,7 +1218,7 @@ int bt_mesh_cfg_node_reset(uint16_t net_idx, uint16_t addr, bool *status)
*status = false;
}
- err = cli_prepare(status, OP_NODE_RESET_STATUS, addr);
+ err = cli_prepare(status, OP_NODE_RESET_STATUS);
if (err) {
goto done;
}
@@ -1272,7 +1265,7 @@ int bt_mesh_cfg_app_key_get(uint16_t net_idx, uint16_t addr, uint16_t key_net_id
};
int err;
- err = cli_prepare(¶m, OP_APP_KEY_LIST, addr);
+ err = cli_prepare(¶m, OP_APP_KEY_LIST);
if (err) {
os_mbuf_free_chain(msg);
return err;
@@ -1310,7 +1303,7 @@ int bt_mesh_cfg_app_key_del(uint16_t net_idx, uint16_t addr,
};
int err;
- err = cli_prepare(¶m, OP_APP_KEY_STATUS, addr);
+ err = cli_prepare(¶m, OP_APP_KEY_STATUS);
if (err) {
os_mbuf_free_chain(msg);
return err;
@@ -1357,7 +1350,7 @@ static int mod_app_bind(uint16_t net_idx, uint16_t addr, uint16_t elem_addr,
};
int err;
- err = cli_prepare(¶m, OP_MOD_APP_STATUS, addr);
+ err = cli_prepare(¶m, OP_MOD_APP_STATUS);
if (err) {
goto done;
}
@@ -1429,7 +1422,7 @@ static int mod_app_unbind(uint16_t net_idx, uint16_t addr, uint16_t elem_addr,
};
int err;
- err = cli_prepare(¶m, OP_MOD_APP_STATUS, addr);
+ err = cli_prepare(¶m, OP_MOD_APP_STATUS);
if (err) {
goto done;
}
@@ -1508,7 +1501,7 @@ static int mod_member_list_get(uint32_t op, uint32_t expect_op, uint16_t net_idx
};
int err;
- err = cli_prepare(¶m, expect_op, addr);
+ err = cli_prepare(¶m, expect_op);
if (err) {
goto done;
}
@@ -1580,7 +1573,7 @@ static int mod_sub(uint32_t op, uint16_t net_idx, uint16_t addr, uint16_t elem_a
};
int err;
- err = cli_prepare(¶m, OP_MOD_SUB_STATUS, addr);
+ err = cli_prepare(¶m, OP_MOD_SUB_STATUS);
if (err) {
goto done;
}
@@ -1691,7 +1684,7 @@ static int mod_sub_va(uint32_t op, uint16_t net_idx, uint16_t addr, uint16_t ele
};
int err;
- err = cli_prepare(¶m, OP_MOD_SUB_STATUS, addr);
+ err = cli_prepare(¶m, OP_MOD_SUB_STATUS);
if (err) {
goto done;
}
@@ -1832,7 +1825,7 @@ static int mod_pub_get(uint16_t net_idx, uint16_t addr, uint16_t elem_addr,
};
int err;
- err = cli_prepare(¶m, OP_MOD_PUB_STATUS, addr);
+ err = cli_prepare(¶m, OP_MOD_PUB_STATUS);
if (err) {
goto done;
}
@@ -1904,7 +1897,7 @@ static int mod_pub_set(uint16_t net_idx, uint16_t addr, uint16_t elem_addr,
};
int err;
- err = cli_prepare(¶m, OP_MOD_PUB_STATUS, addr);
+ err = cli_prepare(¶m, OP_MOD_PUB_STATUS);
if (err) {
goto done;
}
@@ -1977,7 +1970,7 @@ int bt_mesh_cfg_hb_sub_set(uint16_t net_idx, uint16_t addr,
};
int err;
- err = cli_prepare(¶m, OP_HEARTBEAT_SUB_STATUS, addr);
+ err = cli_prepare(¶m, OP_HEARTBEAT_SUB_STATUS);
if (err) {
goto done;
}
@@ -2021,7 +2014,7 @@ int bt_mesh_cfg_hb_sub_get(uint16_t net_idx, uint16_t addr,
};
int err;
- err = cli_prepare(¶m, OP_HEARTBEAT_SUB_STATUS, addr);
+ err = cli_prepare(¶m, OP_HEARTBEAT_SUB_STATUS);
if (err) {
goto done;
}
@@ -2061,7 +2054,7 @@ int bt_mesh_cfg_hb_pub_set(uint16_t net_idx, uint16_t addr,
};
int err;
- err = cli_prepare(¶m, OP_HEARTBEAT_PUB_STATUS, addr);
+ err = cli_prepare(¶m, OP_HEARTBEAT_PUB_STATUS);
if (err) {
goto done;
}
@@ -2108,7 +2101,7 @@ int bt_mesh_cfg_hb_pub_get(uint16_t net_idx, uint16_t addr,
};
int err;
- err = cli_prepare(¶m, OP_HEARTBEAT_PUB_STATUS, addr);
+ err = cli_prepare(¶m, OP_HEARTBEAT_PUB_STATUS);
if (err) {
goto done;
}