Skip to content

Commit b9422ea

Browse files
Michał Narajowskicarlescufi
authored andcommitted
Bluetooth: Mesh: Add return value for opcode callback
``` 3.7.3.4 Message error procedure When receiving a message that is not understood by an element, it shall ignore the message. Note: A message can be falsely identified as a valid message, passing the NetMIC and TransMIC authentication using a known network key and application key even though that message was sent using different keys. The decryption of that message using the wrong keys would result in a message that is not understood by the element. The probability of such a situation occurring is small but not insignificant. A message that is not understood includes messages that have one or more of the following conditions: • The application opcode is unknown by the receiving element. • The access message size for the application opcode is incorrect. • The application parameters contain values that are currently Prohibited. Note: An element that sends an acknowledged message that is not understood by a peer node will not receive any response message. ``` Signed-off-by: Michał Narajowski <[email protected]>
1 parent cd881e0 commit b9422ea

File tree

6 files changed

+541
-418
lines changed

6 files changed

+541
-418
lines changed

include/bluetooth/mesh/access.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,12 @@ struct bt_mesh_model_op {
175175
* @param ctx Message context for the message.
176176
* @param buf Message buffer containing the message payload, not
177177
* including the opcode.
178+
*
179+
* @return Zero on success or (negative) error code otherwise.
178180
*/
179-
void (*const func)(struct bt_mesh_model *model,
180-
struct bt_mesh_msg_ctx *ctx,
181-
struct net_buf_simple *buf);
181+
int (*const func)(struct bt_mesh_model *model,
182+
struct bt_mesh_msg_ctx *ctx,
183+
struct net_buf_simple *buf);
182184
};
183185

184186
#define BT_MESH_MODEL_OP_1(b0) (b0)

subsys/bluetooth/mesh/access.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
670670
* receive the message.
671671
*/
672672
net_buf_simple_save(buf, &state);
673-
op->func(model, &rx->ctx, buf);
673+
(void)op->func(model, &rx->ctx, buf);
674674
net_buf_simple_restore(buf, &state);
675675
}
676676
}

0 commit comments

Comments
 (0)