Mbed-os: Rebinding TCPServer socket more than once results in an infinite loop

Created on 11 Aug 2016  路  8Comments  路  Source: ARMmbed/mbed-os

  1. create and open a TCPServer socket
  2. bind the socket to port X
  3. bind the same socket again to port Y
  4. bind any TCPServer type socket to port Z

Step 4 always results in an infinite loop in lwip_tcp.c : lines 425-426.

closed_in_jira mirrored tracking bug

All 8 comments

cc @geky

Please file these issues with a test case or example program or code snippet to reproduce.

ARM Internal Ref: IOTMORF-443

Looking into this more, it appears lwip does not handling rebinding sockets.

In BSD sockets, bind is similarly not allowed more than once:
http://man7.org/linux/man-pages/man2/bind.2.html

Fortunately, the state of the socket can be determined from the netconn struct, so changing the behaviour to return NSAPI_ERROR_PARAMETER is preferential to a non-halt state.

Added a check per the above behaviour here: https://github.com/ARMmbed/mbed-os/pull/2580

Let us know if there is still an issue.

changing the behaviour to return NSAPI_ERROR_PARAMETER is preferential to a non-halt state

Yep, that sounds good. I'll try it out.

This has been fixed. Closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

toyowata picture toyowata  路  4Comments

sarahmarshy picture sarahmarshy  路  4Comments

chrissnow picture chrissnow  路  4Comments

bcostm picture bcostm  路  4Comments

DuyTrandeLion picture DuyTrandeLion  路  3Comments