You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current network thread can produce unlimited messages to the queue which is consumed by the event thread. In embedded devices, we have limited memory, so a DDOS attack could exhaust the memory.
Acceptance Criteria
To fix this issue, we want to use the macro OC_MAX_NUM_CONCURRENT_REQUESTS along with setting OC_DYNAMIC_ALLOCATION, which defines the maximum number of messages in the queue. The default value of OC_MAX_NUM_CONCURRENT_REQUESTS is 32 for OC_DYNAMIC_ALLOCATION.
If the number of messages reaches the limit, all sockets in the network thread that produce oc_message_t will be removed from select/poll.
If the limit is not reached, the sockets will be set back to select/poll. When more sockets are available for reading after select, one will be randomly picked, the message will be read, and then pushed to the queue.
Implement to ports linux / esp32 / windows.
The text was updated successfully, but these errors were encountered:
…d Devices
The current network thread can produce unlimited messages to the queue
which is consumed by the event thread. In embedded devices, we have limited
memory, so a DDOS attack could exhaust the memory.
Fixes Issue: #626
To fix this issue, (when OC_DYNAMIC_ALLOCATION is enabled) we use the macro
OC_MAX_NUM_CONCURRENT_REQUESTS , which defines the maximum number
of messages in the queue per device.
The default value of OC_MAX_NUM_CONCURRENT_REQUESTS is 32.
If the number of messages reaches the limit, all file descriptors in the network
thread that produce oc_message_t are removed from select/poll. The file
descriptor for monitoring the control flow is always set and is used to wake up
from select() when the queue is ready to accept events again.
When more file descriptors are ready to be read than the number of available
queue slots, a subset is randomly selected to be pushed to the queue.
---------
Co-authored-by: sp-milos <[email protected]>
Co-authored-by: Daniel Adam <[email protected]>
Description
The current network thread can produce unlimited messages to the queue which is consumed by the event thread. In embedded devices, we have limited memory, so a DDOS attack could exhaust the memory.
Acceptance Criteria
OC_MAX_NUM_CONCURRENT_REQUESTS
along with settingOC_DYNAMIC_ALLOCATION
, which defines the maximum number of messages in the queue. The default value ofOC_MAX_NUM_CONCURRENT_REQUESTS
is 32 forOC_DYNAMIC_ALLOCATION
.oc_message_t
will be removed fromselect/poll
.select/poll
. When more sockets are available for reading after select, one will be randomly picked, the message will be read, and then pushed to the queue.The text was updated successfully, but these errors were encountered: