Open Juul opened 6 years ago
There is one problem, from previous experience, I know for a fact that the ESP truncates packets captured in promiscuous mode to ~128 bytes. Wonder how much this would constrain the data we need to send?
Also, the nodeMCU firmware does not provide a function for enabling promiscuous mode, we could call it from Lua-wrapped C or modify the firmware to provide this functionality or just switch to writing the protocol in C. All of these are interesting possibilities, but I'm not sure if any are worth pursuing for what may just be a limited hack?
After reading through this more I found a few interesting things:
wifi_raw_set_recv_cb
(a feature of the esp iot sdk? having trouble finding this in the API reference, I think this is from an old SDK and may no longer be available in newer versions Espressif's closed source API)wifi_send_pkt_freedom
function (this is in the API reference along with register/unregister callback functions) All in all, this seems like a viable, if not the best solution (assuming I can find documentation on receiving raw packets). It isn't any less of a hack than what we are already doing in Lua.
This seems to be capable of both injecting arbitrary packets and a limited promiscuous mode that can capture packets addressed to the broadcast MAC address or the MAC address of the device.
I haven't tried it, but it looks like it is enough that you can do something like adhoc mode by having all devices in SOFTAP mode and either using the broadcast address or setting all nodes to have the same MAC.