Page 2 of 2

Re: Problems with promiscuous mode (capture network traffic)

Posted: Fri Jul 28, 2017 1:51 am
by Sprite
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.

Re: Problems with promiscuous mode (capture network traffic)

Posted: Fri Jul 28, 2017 10:27 am
by Staubgeborener
> 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);
    }

Re: Problems with promiscuous mode (capture network traffic)

Posted: Fri Jul 28, 2017 11:14 am
by WiFive
You don't call vRingbufferReturnItem after hexdump

Re: Problems with promiscuous mode (capture network traffic)

Posted: Fri Jul 28, 2017 11:31 am
by Staubgeborener
Oh man, that makes me feel uncomfortable. Thanks. It seems to work now, even after >5.000 packets.