buglwIP - A Lightweight TCP/IP stack - Bugs: bug #38853, connect() use a wrong errno

 
 

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

bug #38853: connect() use a wrong errno

Submitted by:  hanhui <hanhui03>
Submitted on:  Mon 29 Apr 2013 03:51:35 PM UTC  
 
Category: sockets/netconnSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Tue 17 Feb 2015 09:11:00 PM UTC, comment #3:

Fixed, thanks for the input.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Mon 17 Mar 2014 03:21:31 PM UTC, comment #2:

Agreed.

I attach a patch that changes the following:
1) introduces ERR_ALREADY in the LwIP errors
2) uses ERR_ALREADY in lwip_netconn_do_connect() if already called and connection not yet established, but ERR_ISCONN is used when it is established
3) in sockets.c, added ERR_ALREADY => EALREADY to the err_to_errno table and changed ERR_ISCONN to be EISCONN as it's supposed to be

(file #30928)

TabascoEye <tabascoeye>
Mon 29 Apr 2013 03:56:13 PM UTC, comment #1:

Add tcp_connect() do not use LWIP_ERROR(...) to check pcb state!

hanhui <hanhui03>
Mon 29 Apr 2013 03:51:35 PM UTC, original submission:

EALREADY : A connection request is already in progress for the specified socket.

EISCONN: The specified socket is connection-mode and is already connected.

EALREADY is NOT same as EISCONN, but lwip is only use "ERR_ISCONN" as EALREADY.

Some software(for example Qt/Embedded) whill check EISCONN to determine whether the connection is successful!

I suggest that add a netconn error code : ERR_ALREADY used to distinguish these two cases.

err_t
tcp_connect(struct tcp_pcb pcb, ip_addr_t ipaddr, u16_t port, tcp_connected_fn connected)
{
if (pcb->state == ESTABLISHED) {
return ERR_ISCONN;
} else if (pcb->state != CLOSED) {
return ERR_ALREADY;
}

...
}

hanhui <hanhui03>

 

Attached Files
file #30928:  lwip_connect_errnos.patch added by tabascoeye (3KiB - application/octet-stream)

 

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 tabascoeye (Updated the item)
  • -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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 17 Feb 2015 09:11:00 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
    Mon 17 Mar 2014 03:21:31 PM UTCtabascoeyeAttached File-=>Added lwip_connect_errnos.patch, #30928

    Back to the top


    Powered by Savane 3.1-cleanup1