Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong buffer pointer for UDP echoing #1

Open
iilba-cpi opened this issue Mar 10, 2021 · 2 comments
Open

Wrong buffer pointer for UDP echoing #1

iilba-cpi opened this issue Mar 10, 2021 · 2 comments

Comments

@iilba-cpi
Copy link

FreeRTOS_sendto( xSocket, (const void *)pcRecvBuffer, xLength, 0, pxFrom, sizeof( *pxFrom ) );

Was it meant to be pvData, not pcRecvBuffer, on this line?

@htibosch
Copy link
Owner

Sure you are right, thank you for noticing this!

Normally, I only use iperf with the TCP protocol, and I think that the code under ipconfigIPERF_HAS_UDP needs some revision.

Please let me know if the UDP option works for you after making this change.

Note that every UDP socket has a list of received UDP packets. The length of this list is only limited by the number of available network buffers. This means that your device may suffer from a UDP flooding because of network buffer exhaustion.

You can activate a limit on the amount of UDP packets stored, either by setting the macro ipconfigUDP_MAX_RX_PACKETS, or by setting the socket option FREERTOS_SO_UDP_MAX_RX_PACKETS. The macro will set the default for all UDP sockets. The socket option works for a single socket.

The maximum value will be stored internally as pxSocket->u.xUDP.uxMaxPackets. As soon as the list becomes longer than uxMaxPackets, the incoming packet will be dropped.

Thanks, Hein

@iilba-cpi
Copy link
Author

I had to completely rewrite your demo as we use lwIP netwokring library, not FreeRTOS+TCP. Having said that, there were a couple of things which I had to add to get iperf3 UDP working.

  • Support for initial UDP "handshake". Client sends 32-bit value 123456789 and server should respond back to confirm it's ready.
  • Count UDP packets to report it back to a client. Packet counter is more relevant in UDP context than byte counter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants