lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] How to limit the UDP Rx packet size to avoid big RAM alloca


From: R. Diez
Subject: [lwip-users] How to limit the UDP Rx packet size to avoid big RAM allocations
Date: Tue, 19 Jun 2018 16:24:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

Hi all:

I have a small STM32 microcontroller with little RAM. I mean, I do not count available memory in Gigabytes or Megabytes, but in Kilobytes. 8-)

I am implementing a very simple protocol based on UDP.

I know that the maximum UDP packet length will be short, according to my protocol implementation. However, I can send from my PC with 'socat' huge test UDP packets that cause allocation of several big pbuf objects.

My firmware just discards such big packets upon reception, as they are obviously invalid according to the protocol. But the firmware cannot cope well with such big memory allocations, even if short lived. At the very least, they temporarily exhaust pool memory for other TCP or UDP connections.

Is there a way to tell lwIP to drop received UDP packets over a certain size limit, so that it does not try to allocate any RAM for them? I cannot really prevent that someone on the network suddenly decides to send big UDP packets to the device. This could be an easy attack vector (a denial of service security risk).

Thanks in advance,
  rdiez



reply via email to

[Prev in Thread] Current Thread [Next in Thread]