Bluetooth: Mesh: Introduce debug option to use identity address

Add a Kconfig debug option to enable using the local identity address
for advertising.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-03-21 09:24:25 +02:00 committed by Johan Hedberg
commit bf8050b016
3 changed files with 23 additions and 3 deletions

View file

@ -388,6 +388,14 @@ config BT_MESH_DEBUG
if BT_MESH_DEBUG
config BT_MESH_DEBUG_USE_ID_ADDR
bool "Use identity address for all advertising"
help
This option forces the usage of the local identity address for
all advertising. This can be a help for debugging (analyzing
traces), however it should never be enabled for a production
build as it compromises the privacy of the device.
config BT_MESH_DEBUG_NET
bool "Network layer debug"
help

View file

@ -115,7 +115,12 @@ static inline void adv_send(struct net_buf *buf)
ad.data_len = buf->len;
ad.data = buf->data;
param.options = 0;
if (IS_ENABLED(CONFIG_BT_MESH_DEBUG_USE_ID_ADDR)) {
param.options = BT_LE_ADV_OPT_USE_IDENTITY;
} else {
param.options = 0;
}
param.interval_min = ADV_SCAN_UNIT(adv_int);
param.interval_max = param.interval_min;

View file

@ -44,14 +44,21 @@
#define CLIENT_BUF_SIZE 68
#if defined(CONFIG_BT_MESH_DEBUG_USE_ID_ADDR)
#define ADV_OPT (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | \
BT_LE_ADV_OPT_USE_IDENTITY)
#else
#define ADV_OPT (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME)
#endif
static const struct bt_le_adv_param slow_adv_param = {
.options = (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME),
.options = ADV_OPT,
.interval_min = BT_GAP_ADV_SLOW_INT_MIN,
.interval_max = BT_GAP_ADV_SLOW_INT_MAX,
};
static const struct bt_le_adv_param fast_adv_param = {
.options = (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME),
.options = ADV_OPT,
.interval_min = BT_GAP_ADV_FAST_INT_MIN_2,
.interval_max = BT_GAP_ADV_FAST_INT_MAX_2,
};