Closed wang70880 closed 3 years ago
I'm afraid, I cannot reproduce this bug with the provided proof of concept. However, I agree with the fact the radio state must be checked before reading a packet. Still, I don't clearly understand the root cause of this bug.
Okay, I guess I know what's happening here. It looks like the radio stack is shut down when sniffer_off()
is called, causing some issues when you need to send packets in the code after that. The radio must be on at all time, and as you suggested the sniffer must only notify receive packets when sniffer is on. It must discard them when sniffer is off, and fetch received packets to empty the RX buffer.
I also found some issues with the python code handling the device in Killerbee and will update my repo and send a PR to riverloopsec's repo.
Stay tuned, things will work better soon ;)
Great news. :)
I am sorry that previously I was too busy and didn't focus on this thread. I forgot to mention that if one commented the line kb.sniffer_off()
, the above issue would disappear, which means that the issue lies in the calling of sniffer_off(). Now we have made agreements, and I am happy this issue is solved. I will close this thread. :-)
Problem Description
When using KillerBee to make state transitions from sniffer mode to transmission mode, the bumblebee will crash and disconnect with KillerBee. A small piece of test codes is given as follows.
Running the above test codes, Bumblebee can send packets for the first time. However, for the second time, exceptions are triggered.
Solution
In PROCESS cc2531_rf_sniffer, before calling
radio_got_packet()
, first check the sniffer state of the radio, i.e., g_radio_state in radio.c.radio_got_packet()
is called only ifg_radio_state.sniffer_enabled == SNIFFER ON
A fixed version is implemented in the latest commit of my repo . Please have a look first.