buglwIP - A Lightweight TCP/IP stack - Bugs: bug #43110, call getpeername() before listen()...


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

bug #43110: call getpeername() before listen() will cause a error.

Submitted by:  hanhui <hanhui03>
Submitted on:  Sat 30 Aug 2014 03:30:46 PM UTC  
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  Simon Goldschmidt <goldsimon>
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

( Jump to the original submission)

Thu 26 Feb 2015 08:16:08 PM UTC, comment #6: 

This is already fixed (ERR_CONN is not a fatal error (any more))

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 04 Sep 2014 06:22:23 PM UTC, comment #5: 

Alright, I hadn't continued to other functions, but listen() succeeds now. I was in the assumption that a succesful execution of listen() would reset the netconn's err member, which it obviously doesn't...

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 03 Sep 2014 01:20:10 PM UTC, comment #4: 

  Simon please see netconn_accept()

  This function first check fatal error:

  err = conn->last_err;
  if (ERR_IS_FATAL(err)) {
    /* don't recv on fatal errors: this might block the application task
       waiting on acceptmbox forever! */
    return err;

  because getpeername() set this err = ERR_CONN;

  listen() is OK now, bug netconn_accept will fail.


hanhui <hanhui03>
Wed 03 Sep 2014 12:53:02 PM UTC, comment #3: 

> you can have a test.

Guess what, I did. And it did work for me or else I wouldn't have set it to fixed.

But maybe you want to share more detail on what's not fixed?

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 03 Sep 2014 12:19:30 PM UTC, comment #2: 

Hi Simon

  This bug NOT Fixed! you can have a test.


hanhui <hanhui03>
Tue 02 Sep 2014 08:35:25 PM UTC, comment #1: 

Fixed by re-sorting the error numbers and letting listen() continue on ERR_CONN.

Thanks for reporting.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 30 Aug 2014 03:30:46 PM UTC, original submission:  

Hello All

     If call getpeername() before call listen(), this socket can NOT change to listen mode.

     For example:

     int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     bind(s, ...);
     getpeername(s, ...);
     listen(s, ...); this socket can not listen!

     because getpeername() will cause a fatal error when socket is not connect. listen just check if socket has a fatal error, will not listen.

     But in Qt library, QTcpServer will fist get socket status (will call getpeername()) before call listen. This calling sequence will OK in BSD, Linux and Windows, but fail in Lwip.


hanhui <hanhui03>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by hanhui03 (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-26 goldsimon StatusIn Progress => Fixed
        Open/ClosedOpen => Closed
    2014-09-04 goldsimon StatusFixed => In Progress
        Open/ClosedClosed => Open
    2014-09-02 goldsimon StatusNone => Fixed
        Assigned toNone => goldsimon
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5