buglwIP - A Lightweight TCP/IP stack - Bugs: bug #12592, write in CLOSE_WAIT possible but...

 
 

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

bug #12592: write in CLOSE_WAIT possible but should return ESHUTDOWN

Submitted by:  None
Submitted on:  Thu 07 Apr 2005 11:43:16 AM UTC  
 
Category: TCPSeverity: 2 - Minor
Item Group: Faulty BehaviourStatus: Invalid
Privacy: PublicAssigned to: Kieran Mansley <kieranm>
Open/Closed: ClosedPlanned Release: None
lwIP version: None

(Jump to the original submission Jump to the original submission)

Wed 28 Feb 2007 09:41:15 PM UTC, comment #6:

Sorry, my bad for the confusion. I got mixed up between CLOSE_WAIT and FIN_WAIT.

Jonathan Larmour <jifl>
Project Member
Wed 28 Feb 2007 09:30:11 AM UTC, comment #5:

I agree that you should be able to send data without an error in CLOSE_WAIT. Should have spotted that myself - I did say it wasn't clear!

Closing this as invalid

Kieran Mansley <kieranm>
Project AdministratorIn charge of this item.
Wed 28 Feb 2007 08:11:09 AM UTC, comment #4:

I have a question about the issue.
TCP state is CLOSE_WAIT, that is mean the TCP receive FIN and send ACK of the FIN, In this state, TCP still could send data to the Server/Client.

So I think the codes should not be changed.

dupengbo <dupengbo>
Mon 26 Feb 2007 02:58:41 PM UTC, comment #3:

Thanks for investigating Jonathan, I'll make the change you suggest.

Kieran Mansley <kieranm>
Project AdministratorIn charge of this item.
Mon 26 Feb 2007 02:45:29 PM UTC, comment #2:

It wasn't me that posted this bug, but I can see what's proposed. If writing to a TCP connection already in the CLOSE_WAIT state, ERR_CONN is returned, equivalent to ENOTCONN in BSD sockets. The patch wants to return ESHUTDOWN instead (although the patch is incorrect and should return ERR_CLSD if it wants that behaviour) in that case. This would indeed be the strictly correct error code.

Incidentally, it's impossible to have dialogue with anonymous submitters - is allowing anonymous submissions perhaps an option that could be turned off?

Jonathan Larmour <jifl>
Project Member
Mon 26 Feb 2007 01:12:49 PM UTC, comment #1:

It's not clear from this bug report what the problem is, or what fix you are suggesting. Could you provide more information?

Kieran Mansley <kieranm>
Project AdministratorIn charge of this item.
Thu 07 Apr 2005 11:43:16 AM UTC, original submission:

Possible work around tcp_out.c:
err_t
tcp_write(struct tcp_pcb pcb, const void arg, u16_t len, u8_t copy)
{
LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_write(pcb=%p, arg=%p, len=%u, copy=%d)\n", (void *)pcb,
arg, len, (unsigned int)copy));
/* connection is in valid state for data transmission? */
if (pcb->state == ESTABLISHED ||
pcb->state == SYN_SENT ||
pcb->state == SYN_RCVD) {
if (len > 0) {
return tcp_enqueue(pcb, (void *)arg, len, 0, copy, NULL, 0);
}
return ERR_OK;
} else if (pcb->state == CLOSE_WAIT) {
/* FIX: shutdown was not recognized. */
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | DBG_STATE | 3, ("tcp_write() in state CLOSE_WAIT\n"));
return ESHUTDOWN;
} else {
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | DBG_STATE | 3, ("tcp_write() called in invalid state\n"));
return ERR_CONN;
}
}

Anonymous

 

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 dupengbo (Posted a comment)
  • -unavailable- added by jifl (Posted a comment)
  • -unavailable- added by kieranm (Posted a comment)
  •  

    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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 28 Feb 2007 09:30:11 AM UTCkieranmStatusNeed Info=>Invalid
      Open/ClosedOpen=>Closed
    Mon 26 Feb 2007 02:58:41 PM UTCkieranmAssigned toNone=>kieranm
    Mon 26 Feb 2007 01:12:49 PM UTCkieranmSeverity3 - Normal=>2 - Minor
      StatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1