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/netconnSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

(Jump to the original submission 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.

Han.hui

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.

Han.hui

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.

Han.hui

hanhui <hanhui03>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 26 Feb 2015 08:16:08 PM UTCgoldsimonStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Thu 04 Sep 2014 06:22:23 PM UTCgoldsimonStatusFixed=>In Progress
      Open/ClosedClosed=>Open
    Tue 02 Sep 2014 08:35:25 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1