diff --git a/nimble/host/mesh/include/mesh/cdb.h b/nimble/host/mesh/include/mesh/cdb.h index db2e0d133..8f9a6bc9b 100644 --- a/nimble/host/mesh/include/mesh/cdb.h +++ b/nimble/host/mesh/include/mesh/cdb.h @@ -9,9 +9,9 @@ #include "syscfg/syscfg.h" #if MYNEWT_VAL(BLE_MESH_CDB) -#define NODE_COUNT MYNEWT_VAL(BLE_MESH_CDB_NODE_COUNT) -#define SUBNET_COUNT MYNEWT_VAL(BLE_MESH_CDB_SUBNET_COUNT) -#define APP_KEY_COUNT MYNEWT_VAL(BLE_MESH_CDB_APP_KEY_COUNT) +#define NODE_COUNT CONFIG_BT_MESH_NODE_COUNT +#define SUBNET_COUNT CONFIG_BT_MESH_SUBNET_COUNT +#define APP_KEY_COUNT CONFIG_BT_MESH_APP_KEY_COUNT #else #define NODE_COUNT 0 #define SUBNET_COUNT 0 diff --git a/nimble/host/mesh/src/cdb.c b/nimble/host/mesh/src/cdb.c index f73c09e55..fca502d80 100644 --- a/nimble/host/mesh/src/cdb.c +++ b/nimble/host/mesh/src/cdb.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#if BLE_MESH_CDB #define BT_DBG_ENABLED MYNEWT_VAL(BLE_MESH_DEBUG_CDB) #define LOG_MODULE_NAME bt_mesh_cdb #include "log/log.h" @@ -16,7 +17,6 @@ #include "mesh/glue.h" -#if MYNEWT_VAL(BLE_MESH_CDB) struct bt_mesh_cdb bt_mesh_cdb = { .nodes = { [0 ... (CONFIG_BT_MESH_NODE_COUNT - 1)] = { diff --git a/nimble/host/mesh/src/provisioner.c b/nimble/host/mesh/src/provisioner.c index e79de162a..371c1f6c3 100644 --- a/nimble/host/mesh/src/provisioner.c +++ b/nimble/host/mesh/src/provisioner.c @@ -37,10 +37,11 @@ static void pub_key_ready(const uint8_t *pkey); static int reset_state(void) { +#if BLE_MESH_CDB if (prov_device.node != NULL) { bt_mesh_cdb_node_del(prov_device.node, false); } - +#endif return bt_mesh_prov_reset_state(pub_key_ready); } @@ -237,7 +238,7 @@ static void prov_capabilities(const uint8_t *data) prov_fail(PROV_ERR_NVAL_FMT); return; } - +#if BLE_MESH_CDB prov_device.node = bt_mesh_cdb_node_alloc(prov_device.uuid, prov_device.addr, data[0], @@ -247,7 +248,7 @@ static void prov_capabilities(const uint8_t *data) prov_fail(PROV_ERR_RESOURCES); return; } - +#endif memcpy(&bt_mesh_prov_link.conf_inputs[1], data, 11); if (bt_mesh_prov->capabilities) { @@ -453,7 +454,9 @@ static void prov_input_complete(const uint8_t *data) static void send_prov_data(void) { struct os_mbuf *pdu = PROV_BUF(34); +#if BLE_MESH_CDB struct bt_mesh_cdb_subnet *sub; +#endif uint8_t session_key[16]; uint8_t nonce[13]; int err; @@ -487,7 +490,7 @@ static void send_prov_data(void) } BT_DBG("DevKey: %s", bt_hex(prov_device.node->dev_key, 16)); - +#if BLE_MESH_CDB sub = bt_mesh_cdb_subnet_get(prov_device.node->net_idx); if (sub == NULL) { BT_ERR("No subnet with net_idx %u", @@ -495,12 +498,14 @@ static void send_prov_data(void) prov_fail(PROV_ERR_UNEXP_ERR); return; } - +#endif bt_mesh_prov_buf_init(pdu, PROV_DATA); +#if BLE_MESH_CDB net_buf_simple_add_mem(pdu, sub->keys[sub->kr_flag].net_key, 16); net_buf_simple_add_be16(pdu, prov_device.node->net_idx); net_buf_simple_add_u8(pdu, bt_mesh_cdb_subnet_flags(sub)); net_buf_simple_add_be32(pdu, bt_mesh_cdb.iv_index); +#endif net_buf_simple_add_be16(pdu, prov_device.node->addr); net_buf_simple_add(pdu, 8); /* For MIC */ diff --git a/nimble/host/mesh/src/testing.c b/nimble/host/mesh/src/testing.c index 2bef38e23..bde8ff3b4 100644 --- a/nimble/host/mesh/src/testing.c +++ b/nimble/host/mesh/src/testing.c @@ -141,6 +141,7 @@ void bt_test_print_credentials(void) for (i = 0; i < ARRAY_SIZE(bt_mesh_cdb.app_keys); ++i) { + app_key = &bt_mesh_cdb.app_keys[i]; if (app_key->net_idx == BT_MESH_KEY_UNUSED) { continue; } @@ -160,6 +161,7 @@ void bt_test_print_credentials(void) for (i = 0; i < ARRAY_SIZE(bt_mesh_cdb.subnets); ++i) { sub = bt_mesh_cdb_subnet_get(i); + app_key = &bt_mesh_cdb.app_keys[i]; if (sub[i].net_idx == BT_MESH_KEY_UNUSED) { continue; } diff --git a/porting/examples/linux_blemesh/include/syscfg/syscfg.h b/porting/examples/linux_blemesh/include/syscfg/syscfg.h index 7326ffbf8..9aac1068a 100644 --- a/porting/examples/linux_blemesh/include/syscfg/syscfg.h +++ b/porting/examples/linux_blemesh/include/syscfg/syscfg.h @@ -1025,7 +1025,7 @@ #endif #ifndef MYNEWT_VAL_BLE_MESH_CDB -#define MYNEWT_VAL_BLE_MESH_CDB (1) +#define MYNEWT_VAL_BLE_MESH_CDB (0) #endif #ifndef MYNEWT_VAL_BLE_MESH_CDB_SUBNET_COUNT