Problems with promiscuous mode (capture network traffic)

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Problems with promiscuous mode (capture network traffic)

Postby ESP_Sprite » Fri Jul 28, 2017 1:51 am

No idea why your packets get corrupted; I have not seen that and I've received far more than 200 packets with my code. I doubt the issue is the ringbuffer: if it's full, depending on the timeout value it will either (non-zero) wait for a while for there to be space, or (zero) discard the packet alltogether. Corrupting packets is not intended behaviour :)

The difference between the two lines is that the 2nd one will only push 4bytes (the size of the pointer 'packet') into the buffer; methinks that's not what you'd want.

Staubgeborener
Posts: 20
Joined: Sat Jul 22, 2017 11:59 am

Re: Problems with promiscuous mode (capture network traffic)

Postby Staubgeborener » Fri Jul 28, 2017 10:27 am

> Updated gist in startpost.
Well, it's weird. I dunno why my parsing function on the second core stops. It's like

total received packets: 1
packets after parsing: 1

total received packets: 2
packets after parsing: 2

total received packets: 2
packets after parsing: 2

-> And so on till ~50 packets received. Sometimes it goes on till ~200 packets. Not comprehensible.

total received packets: 51
total received packets: 52
total received packets: 53
total received packets: 54
....

-> No 'packets after parsing' message anymore. But my callback is still working.
I tested this with filtering the ssid and with printf statements to create a hexdump. But no matter, the issue is still the same.

I used

Code: Select all

xRingbufferSend(packetRingbuf, packet, packet->rx_ctrl.sig_len, 0);
So it should discards all packets if it's full, then it should go on. The ringbuf receiving is as follows:

Code: Select all

    size_t len;
    wifi_promiscuous_pkt_t *packet=(wifi_promiscuous_pkt_t*)xRingbufferReceive(packetRingbuf, &len, portMAX_DELAY);
    if (len==1) {
            vRingbufferReturnItem(packetRingbuf, packet);
            vRingbufferDelete(packetRingbuf);
            vTaskDelete(NULL);
    }

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Problems with promiscuous mode (capture network traffic)

Postby WiFive » Fri Jul 28, 2017 11:14 am

You don't call vRingbufferReturnItem after hexdump

Staubgeborener
Posts: 20
Joined: Sat Jul 22, 2017 11:59 am

Re: Problems with promiscuous mode (capture network traffic)

Postby Staubgeborener » Fri Jul 28, 2017 11:31 am

Oh man, that makes me feel uncomfortable. Thanks. It seems to work now, even after >5.000 packets.

Who is online

Users browsing this forum: HighVoltage and 113 guests