promiscuous callback documentation
Posted: Tue May 12, 2015 5:23 pm
Using SDK 1.0.1 I've registered a promiscuous mode callback to monitor traffic. For testing purposes I'm using simple java code on a laptop connected to the same WLAN as the ESP that simply sends UDP packets with increasing length:
but all packets I receive have the length set to either 12 or 60. As the WLAN is WPA encrypted and the MAC header etc. come on top, I expected packet lengths somewhere between 70 and 170 bytes...
I understand that the promiscuous mode does not provide the full packet content but I expected the length to be accurate. The best "documentation" that provides insights into the format of the buffer provided to the callback is this: https://github.com/ly0/esp8266-smartlink/blob/master/network_80211.h which seems to be partly provided by Espressif - but it does not explain the 12 byte packets and does not provide any details about what the SDk makes available to the callback. When the java code is running, the number of 12 byte packets received by the ESP is dramatically higher so I suspect that these are kind of the stubs representing the UDP packets... Looking at the first 12 bytes of the buffer for these packets there is no pattern visible that could represent the real packet length .
Any further documentation is greatly welcome!!
Code: Select all
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class SendUdp
{
public static void main (String[] args) {
try {
System.out.println("create socket");
DatagramSocket socket = new DatagramSocket(8027);
socket.setBroadcast(true);
socket.connect(InetAddress.getByName("255.255.255.255"), 8027);
byte[] buf = new byte[100];
for (int i = 0; i < 100; i++) {
System.out.println("sending " + i);
DatagramPacket packet = new DatagramPacket(buf, i);
socket.send(packet);
Thread.sleep(10);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
but all packets I receive have the length set to either 12 or 60. As the WLAN is WPA encrypted and the MAC header etc. come on top, I expected packet lengths somewhere between 70 and 170 bytes...
Code: Select all
wifi_promiscuous_rx(uint8 *buf, uint16 len)
I understand that the promiscuous mode does not provide the full packet content but I expected the length to be accurate. The best "documentation" that provides insights into the format of the buffer provided to the callback is this: https://github.com/ly0/esp8266-smartlink/blob/master/network_80211.h which seems to be partly provided by Espressif - but it does not explain the 12 byte packets and does not provide any details about what the SDk makes available to the callback. When the java code is running, the number of 12 byte packets received by the ESP is dramatically higher so I suspect that these are kind of the stubs representing the UDP packets... Looking at the first 12 bytes of the buffer for these packets there is no pattern visible that could represent the real packet length .
Any further documentation is greatly welcome!!