Skip to content

Commit d64edaf

Browse files
m-alperen-senerbjarki-andreasen
authored andcommitted
[nrf fromlist] tests: bluetooth: tester: Fix MESH/SR/PRB/PNID/BV-02-C test case
Private node identity advertisements must stop immediately when ordered by PTS. To do so; adding enabled parameter to btp_priv_node_id_get_cmd. Upstream PR #: 87891 Signed-off-by: alperen sener <[email protected]>
1 parent 8b07dfa commit d64edaf

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

tests/bluetooth/tester/src/btp/btp_mesh.h

+3
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,9 @@ struct btp_priv_node_id_set_cmd {
10601060
} __packed;
10611061

10621062
#define BTP_MESH_PROXY_PRIVATE_IDENTITY 0x72
1063+
struct btp_proxy_priv_identity_cmd {
1064+
uint8_t enabled;
1065+
} __packed;
10631066

10641067
#define BTP_MESH_OD_PRIV_PROXY_GET 0x73
10651068
struct btp_od_priv_proxy_get_cmd {

tests/bluetooth/tester/src/btp_mesh.c

+26-4
Original file line numberDiff line numberDiff line change
@@ -899,20 +899,40 @@ static uint8_t priv_node_id_set(const void *cmd, uint16_t cmd_len,
899899

900900
return BTP_STATUS_SUCCESS;
901901
}
902+
#endif
902903

904+
#ifdef CONFIG_BT_MESH_PRIV_BEACON_SRV
903905
static uint8_t proxy_private_identity_enable(const void *cmd, uint16_t cmd_len,
904906
void *rsp, uint16_t *rsp_len)
905907
{
908+
const struct btp_proxy_priv_identity_cmd *cp = cmd;
909+
uint16_t net_idx[CONFIG_BT_MESH_SUBNET_COUNT];
910+
enum bt_mesh_feat_state priv_node_id = BT_MESH_FEATURE_DISABLED;
911+
ssize_t count;
906912
int err;
907913

908914
LOG_DBG("");
909915

910-
err = bt_mesh_proxy_private_identity_enable();
911-
if (err) {
912-
LOG_ERR("Failed to enable proxy private identity (err %d)", err);
916+
count = bt_mesh_subnets_get(net_idx, ARRAY_SIZE(net_idx), 0);
917+
918+
if (count <= 0) {
919+
LOG_ERR("No subnet (err:%i)", count);
913920
return BTP_STATUS_FAILED;
914921
}
915922

923+
if (cp->enabled) {
924+
priv_node_id = BT_MESH_FEATURE_ENABLED;
925+
}
926+
927+
for (int i = 0; i < count; i++) {
928+
err = bt_mesh_subnet_priv_node_id_set(net_idx[i], priv_node_id);
929+
if (err) {
930+
LOG_ERR("Failed to %s proxy private identity for net idx:%x (err %d)",
931+
cp->enabled ? "enable" : "disable", net_idx[i], err);
932+
return BTP_STATUS_FAILED;
933+
}
934+
}
935+
916936
return BTP_STATUS_SUCCESS;
917937
}
918938
#endif
@@ -5251,8 +5271,10 @@ static const struct btp_handler handlers[] = {
52515271
{.opcode = BTP_MESH_PRIV_NODE_ID_SET,
52525272
.expect_len = sizeof(struct btp_priv_node_id_set_cmd),
52535273
.func = priv_node_id_set},
5274+
#endif
5275+
#ifdef CONFIG_BT_MESH_PRIV_BEACON_SRV
52545276
{.opcode = BTP_MESH_PROXY_PRIVATE_IDENTITY,
5255-
.expect_len = 0,
5277+
.expect_len = sizeof(struct btp_proxy_priv_identity_cmd),
52565278
.func = proxy_private_identity_enable},
52575279
#endif
52585280
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI)

0 commit comments

Comments
 (0)