summaryrefslogtreecommitdiff
path: root/mesh
diff options
context:
space:
mode:
authorIsak Westin <isak.westin@loytec.com>2022-09-23 13:31:48 +0200
committerBrian Gix <brian.gix@intel.com>2022-09-23 10:06:37 -0700
commit32d866b4df928aa1d7785da7f83d089f64d42797 (patch)
tree3bd34d9f0cd4707eee3d9aa25a9b0e4981d8014a /mesh
parent721d5a8ae86d1ef1eea35109890b7622324cfc98 (diff)
downloadbluez-32d866b4df928aa1d7785da7f83d089f64d42797.tar.gz
mesh: Clear addr field if virt sub failed
If processing failed for a Config Model Subscription Virtual Address Add/Delete/Overwrite message, the address field in the status reply should be set to zero. See MshPRFv1.0.1 section 4.4.1.2.8.
Diffstat (limited to 'mesh')
-rw-r--r--mesh/cfgmod-server.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index c1e1faa6a..9bc2f1c97 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -286,6 +286,10 @@ static uint16_t cfg_virt_sub_add_msg(struct mesh_node *node, const uint8_t *pkt,
label, true, addr, opcode))
msg[n] = MESH_STATUS_STORAGE_FAIL;
+ /* If processing failed, set addr field to zero in reply */
+ if (msg[n] != MESH_STATUS_SUCCESS)
+ addr = UNASSIGNED_ADDRESS;
+
l_put_le16(ele_addr, msg + n + 1);
l_put_le16(addr, msg + n + 3);