host/mesh Multi-thread call bt_mesh_model_send at the same time
- Dominant language
- C
- Stars
- 893
- Forks
- 512
- Avg merge
- 13d 31m
- Merged PRs (30d)
- 7
Description
when bt_mesh_model_send was called in two different thread. there are two msgs send in the same time.
bt_mesh_model_send -> model_send -> bt_mesh_trans_send -> trans_encrypt
in function trans_encrypt, use current seqence num to create app nonce. maybe use same seqence num to create app nonce and encrypt different two msgs
and then the msg send to network layer.
bt_mesh_trans_send -> bt_mesh_net_send -> net_header_encode
in function net_header_encode, put current seqence num into network pdu header and increase seqence num.
for example
send:
transport layer:
thread 1 send msg 1, use seqence num 1 to create app nonce, use appkey and app nonce encrypt msg 1
thread 2 send msg 2, use seqence num 1 to create app nonce, use appkey and app nonce encrypt msg 2
network layer:
thread 1 send msg 1, put seqence num 1 into netowrk header of msg 1, and seqence num increase
thread 2 send msg 2, put seqence num 2 into netowrk header of msg 2, and seqence num increase
recv:
recv msg 1, and msg 1 can be processed ok
recv msg 2
network layer
parse network header, get seqence num is 2
transport layer
use seqence num 2 to create app nonce, so it can not be decrypted
Waiting for your replies! thank you so much!
Contributor guide
No contributing guide indexed for this repository
Research direction
Trace the call chain from bt_mesh_model_send through model_send, bt_mesh_trans_send, trans_encrypt, bt_mesh_net_send, and net_header_encode, focusing on concurrent sequence-number handling. Reproduce two simultaneous sends and verify that each message’s transport encryption nonce matches the sequence number placed in its network header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, networking, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100