summaryrefslogtreecommitdiff
path: root/mesh/model.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2020-08-06 18:38:28 -0700
committerBrian Gix <brian.gix@intel.com>2020-08-10 14:47:09 -0700
commit14572fe1c508a94da43ed7ab76bd4a754f817c9f (patch)
tree94fe585760fcf709d05298e0ed43e0f7ee996bce /mesh/model.c
parent72f85660fb8b6d74f3d56045601c00751e50af35 (diff)
downloadbluez-14572fe1c508a94da43ed7ab76bd4a754f817c9f.tar.gz
mesh: Clean up handling of config publication messages
This modification allows using a single point for sending out the composed status messages by the Config Server. Also, return Feature Not Supported errror code when credential flag is set, but the node does not support LPN feature
Diffstat (limited to 'mesh/model.c')
-rw-r--r--mesh/model.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesh/model.c b/mesh/model.c
index c9d93a692..17b58b473 100644
--- a/mesh/model.c
+++ b/mesh/model.c
@@ -1076,7 +1076,7 @@ bool mesh_model_send(struct mesh_node *node, uint16_t src, uint16_t dst,
int mesh_model_pub_set(struct mesh_node *node, uint16_t addr, uint32_t id,
const uint8_t *pub_addr, uint16_t idx, bool cred_flag,
uint8_t ttl, uint8_t period, uint8_t retransmit,
- bool is_virt, uint16_t *dst)
+ bool is_virt, uint16_t *pub_dst)
{
struct mesh_model *mod;
int status, ele_idx = node_get_element_idx(node, addr);
@@ -1103,6 +1103,9 @@ int mesh_model_pub_set(struct mesh_node *node, uint16_t addr, uint32_t id,
return MESH_STATUS_SUCCESS;
}
+ if (cred_flag && node_lpn_mode_get(node) != MESH_MODE_ENABLED)
+ return MESH_STATUS_FEATURE_NO_SUPPORT;
+
/* Check if the old publication destination is a virtual label */
if (mod->pub && mod->pub->virt) {
unref_virt(mod->pub->virt);
@@ -1116,7 +1119,7 @@ int mesh_model_pub_set(struct mesh_node *node, uint16_t addr, uint32_t id,
status = set_virt_pub(mod, pub_addr, idx, cred_flag, ttl,
period, retransmit);
- *dst = mod->pub->addr;
+ *pub_dst = mod->pub->addr;
if (status != MESH_STATUS_SUCCESS)
return status;