patchlwIP - A Lightweight TCP/IP stack - Patches: patch #10178, Inconsistent error codes when no...


You are not allowed to post comments on this tracker with your current authentication level.

patch #10178: Inconsistent error codes when no ephemeral port is available

Submitter:  Patrik Lantto <patriklantto>
Submitted:  Fri 11 Feb 2022 03:12:08 PM UTC
Category:  IPv4 Priority:  3 - Low
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Planned Release:  None

Fri 11 Feb 2022 03:12:08 PM UTC, original submission:  

For UDP, lwIP will use the error code ERR_USE if no ephemeral port is available (in udp_bind, udp_connect or udp_send) but for TCP the error code ERR_BUF is used instead (tcp_bind and tcp_connect). Apart from being inconsistent, ERR_BUF also seems to be a strange error code in this case.

However, also the standard socket implementation is inconsistent (

“The error used to diagnose exhaustion of the ephemeral port range differs across the various system calls (connect(2), bind(2), listen(2), sendto(2)) that can assign ephemeral ports.”

The patch attached mimics the behaviour of connect, bind, listen and sendto as documented following the links on the above page.

Patrik Lantto <patriklantto>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #52843:  Ephemeral@port@error.patch added by patriklantto (3KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by patriklantto (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-02-11 patriklantto Attached File- Added Ephemeral@port@error.patch, #52843

    Back to the top

    Powered by Savane 3.9