mesh: Use correct TTL value to send model publication
PATCH 1/1 mesh: Use correct TTL value to send model publication
When sending model publishing data, use TTL value configured for that publication instead of the default TTL value used for regular messages.
--- mesh/model.c | 4 ++-- mesh/model.h | 2 +- mesh/node.c | 11 ++++------- 3 files changed, 7 insertions(+), 10 deletions(-)
mesh/model.c +2 -2
@@ -1022,7 +1022,7 @@ done: }int mesh_model_publish (struct mesh_node *node,uint32_t id,uint16_t src, -uint8_t ttl,const void *msg,uint16_t msg_len) +const void *msg,uint16_t msg_len) {struct mesh_net *net =node_get_net (node);struct mesh_model *mod;
@@ -1063,7 +1063,7 @@ int mesh_model_publish(struct mesh_node *node, uint32_t id, uint16_t src, result =msg_send (node, mod->pub->credential !=0 , src, mod->pub->addr, mod->pub->idx, net_idx, - label, ttl, false, msg, msg_len); + label, mod->pub->ttl, false, msg, msg_len);return result ?MESH_ERROR_NONE :MESH_ERROR_FAILED ; }
mesh/model.h +1 -1
@@ -103,7 +103,7 @@ bool mesh_model_send(struct mesh_node *node, uint16_t src, uint16_t dst, uint8_t ttl, bool segmented, const void *msg, uint16_t msg_len);int mesh_model_publish (struct mesh_node *node,uint32_t id,uint16_t src, -uint8_t ttl,const void *msg,uint16_t msg_len); +const void *msg,uint16_t msg_len); bool mesh_model_rx(struct mesh_node *node, bool szmict, uint32_t seq0, uint32_t seq, uint32_t iv_index, uint16_t net_idx, uint16_t src, uint16_t dst, uint8_t key_aid,
mesh/node.c +4 -7
@@ -1983,7 +1983,7 @@ static struct l_dbus_message *publish_call(struct l_dbus *dbus,struct l_dbus_message_iter iter_data;uint16_t mod_id, src;struct node_element *ele; -uint8_t *data, ttl; +uint8_t *data;uint32_t len, id;int result;
@@ -2010,10 +2010,8 @@ static struct l_dbus_message *publish_call(struct l_dbus *dbus,return dbus_error (msg,MESH_ERROR_INVALID_ARGS ,"Incorrect data" ); - ttl =mesh_net_get_default_ttl (node->net); - id =SET_ID (SIG_VENDOR , mod_id); - result =mesh_model_publish (node, id, src, ttl, data, len); + result =mesh_model_publish (node, id, src, data, len);if (result !=MESH_ERROR_NONE )return dbus_error (msg, result,NULL );
@@ -2030,7 +2028,7 @@ static struct l_dbus_message *vendor_publish_call(struct l_dbus *dbus,struct l_dbus_message_iter iter_data;uint16_t src, mod_id, vendor_id;struct node_element *ele; -uint8_t ttl, *data =NULL ; +uint8_t *data =NULL ;uint32_t len;int result;
@@ -2057,8 +2055,7 @@ static struct l_dbus_message *vendor_publish_call(struct l_dbus *dbus,return dbus_error (msg,MESH_ERROR_INVALID_ARGS ,"Incorrect data" ); - ttl =mesh_net_get_default_ttl (node->net); - result =mesh_model_publish (node,SET_ID (vendor_id, mod_id), src, ttl, + result =mesh_model_publish (node,SET_ID (vendor_id, mod_id), src, data, len);if (result !=MESH_ERROR_NONE )
Signature · 1 line
2.26.2
Gix, Brian
AppliedApplied
Quoted 88 lines · Inga Stotland
When sending model publishing data, use TTL value configured for that publication instead of the default TTL value used for regular messages.
--- mesh/model.c | 4 ++-- mesh/model.h | 2 +- mesh/node.c | 11 ++++------- 3 files changed, 7 insertions(+), 10 deletions(-)mesh/model.c +2
-2@@ -1022,7 +1022,7 @@ done: }int mesh_model_publish (struct mesh_node *node,uint32_t id,uint16_t src, -uint8_t ttl,const void *msg,uint16_t msg_len) +const void *msg,uint16_t msg_len) {struct mesh_net *net =node_get_net (node);struct mesh_model *mod;@@ -1063,7 +1063,7 @@ int mesh_model_publish(struct mesh_node *node, uint32_t id, uint16_t src, result =msg_send (node, mod->pub->credential !=0 , src, mod->pub->addr, mod->pub->idx, net_idx, - label, ttl, false, msg, msg_len); + label, mod->pub->ttl, false, msg, msg_len);return result ?MESH_ERROR_NONE :MESH_ERROR_FAILED ; }mesh/model.h +1
-1@@ -103,7 +103,7 @@ bool mesh_model_send(struct mesh_node *node, uint16_t src, uint16_t dst, uint8_t ttl, bool segmented, const void *msg, uint16_t msg_len);int mesh_model_publish (struct mesh_node *node,uint32_t id,uint16_t src, -uint8_t ttl,const void *msg,uint16_t msg_len); +const void *msg,uint16_t msg_len); bool mesh_model_rx(struct mesh_node *node, bool szmict, uint32_t seq0, uint32_t seq, uint32_t iv_index, uint16_t net_idx, uint16_t src, uint16_t dst, uint8_t key_aid,mesh/node.c +4
-7@@ -1983,7 +1983,7 @@ static struct l_dbus_message *publish_call(struct l_dbus *dbus,struct l_dbus_message_iter iter_data;uint16_t mod_id, src;struct node_element *ele; -uint8_t *data, ttl; +uint8_t *data;uint32_t len, id;int result;@@ -2010,10 +2010,8 @@ static struct l_dbus_message *publish_call(struct l_dbus *dbus,return dbus_error (msg,MESH_ERROR_INVALID_ARGS ,"Incorrect data" ); - ttl =mesh_net_get_default_ttl (node->net); - id =SET_ID (SIG_VENDOR , mod_id); - result =mesh_model_publish (node, id, src, ttl, data, len); + result =mesh_model_publish (node, id, src, data, len);if (result !=MESH_ERROR_NONE )return dbus_error (msg, result,NULL );@@ -2030,7 +2028,7 @@ static struct l_dbus_message *vendor_publish_call(struct l_dbus *dbus,struct l_dbus_message_iter iter_data;uint16_t src, mod_id, vendor_id;struct node_element *ele; -uint8_t ttl, *data =NULL ; +uint8_t *data =NULL ;uint32_t len;int result;@@ -2057,8 +2055,7 @@ static struct l_dbus_message *vendor_publish_call(struct l_dbus *dbus,return dbus_error (msg,MESH_ERROR_INVALID_ARGS ,"Incorrect data" ); - ttl =mesh_net_get_default_ttl (node->net); - result =mesh_model_publish (node,SET_ID (vendor_id, mod_id), src, ttl, + result =mesh_model_publish (node,SET_ID (vendor_id, mod_id), src, data, len);if (result !=MESH_ERROR_NONE )