[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [patch #6865] SO_REUSEADDR for TCP

From: Jeff Barber
Subject: [lwip-devel] [patch #6865] SO_REUSEADDR for TCP
Date: Tue, 14 Jul 2009 15:22:06 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2009060215 Firefox/3.0.11


                 Summary: SO_REUSEADDR for TCP
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: jeffbabar
            Submitted on: Tue 14 Jul 2009 03:22:04 PM GMT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None



In developing an FTP server (for example) it is necessary to bind each
outgoing PORT connection to the well-known FTP-data port (20).  Back-to-back
transfers usually mean that the second and subsequent connections need to be
bound to port 20 while the previous PCB is still in TIME_WAIT.  Hence, the
equivalent of SO_REUSEADDR required in order to implement the server.

This patch provides a new TCP flag "TF_REUSEADDR" that, when set during the
processing of tcp_bind, bypasses the checking of the PCBs still in TIME_WAIT.

Applies cleanly to top-of-tree and 1.3.1-RC1.  It does not apply cleanly to
1.3.0 but the sole failure is the one line definition of the new flag and is
trivial to fix.

    pcb = tcp_new();
    pcb->flags |= TF_REUSEADDR;
    status = tcp_bind(pcb, &in_addr_any, FTP_DATA_PORT);

Sorry, I only use the raw API with NO_SYS=1 so I can't provide a patch that
works for other APIs.


File Attachments:

Date: Tue 14 Jul 2009 03:22:04 PM GMT  Name: tcp_reuseaddr.patch  Size: 2kB  
By: jeffbabar



Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]