1. 29 1月, 2008 3 次提交
    • G
      [DCCP]: Integrate state transitions for passive-close · 0c869620
      Gerrit Renker 提交于
      This adds the necessary state transitions for the two forms of passive-close
      
       * PASSIVE_CLOSE    - which is entered when a host   receives a Close;
       * PASSIVE_CLOSEREQ - which is entered when a client receives a CloseReq.
      
      Here is a detailed account of what the patch does in each state.
      
      1) Receiving CloseReq
      
        The pseudo-code in 8.5 says:
      
           Step 13: Process CloseReq
                If P.type == CloseReq and S.state < CLOSEREQ,
                    Generate Close
                    S.state := CLOSING
                    Set CLOSING timer.
      
        This means we need to address what to do in CLOSED, LISTEN, REQUEST, RESPOND, PARTOPEN, and OPEN.
      
         * CLOSED:         silently ignore - it may be a late or duplicate CloseReq;
         * LISTEN/RESPOND: will not appear, since Step 7 is performed first (we know we are the client);
         * REQUEST:        perform Step 13 directly (no need to enqueue packet);
         * OPEN/PARTOPEN:  enter PASSIVE_CLOSEREQ so that the application has a chance to process unread data.
      
        When already in PASSIVE_CLOSEREQ, no second CloseReq is enqueued. In any other state, the CloseReq is ignored.
        I think that this offers some robustness against rare and pathological cases: e.g. a simultaneous close where
        the client sends a Close and the server a CloseReq. The client will then be retransmitting its Close until it
        gets the Reset, so ignoring the CloseReq while in state CLOSING is sane.
      
      2) Receiving Close
      
        The code below from 8.5 is unconditional.
      
           Step 14: Process Close
                If P.type == Close,
                    Generate Reset(Closed)
                    Tear down connection
                    Drop packet and return
      
        Thus we need to consider all states:
         * CLOSED:           silently ignore, since this can happen when a retransmitted or late Close arrives;
         * LISTEN:           dccp_rcv_state_process() will generate a Reset ("No Connection");
         * REQUEST:          perform Step 14 directly (no need to enqueue packet);
         * RESPOND:          dccp_check_req() will generate a Reset ("Packet Error") -- left it at that;
         * OPEN/PARTOPEN:    enter PASSIVE_CLOSE so that application has a chance to process unread data;
         * CLOSEREQ:         server performed active-close -- perform Step 14;
         * CLOSING:          simultaneous-close: use a tie-breaker to avoid message ping-pong (see comment);
         * PASSIVE_CLOSEREQ: ignore - the peer has a bug (sending first a CloseReq and now a Close);
         * TIMEWAIT:         packet is ignored.
      
         Note that the condition of receiving a packet in state CLOSED here is different from the condition "there
         is no socket for such a connection": the socket still exists, but its state indicates it is unusable.
      
         Last, dccp_finish_passive_close sets either DCCP_CLOSED or DCCP_CLOSING = TCP_CLOSING, so that
         sk_stream_wait_close() will wait for the final Reset (which will trigger CLOSING => CLOSED).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0c869620
    • P
      [NET]: Name magic constants in sock_wake_async() · 8d8ad9d7
      Pavel Emelyanov 提交于
      The sock_wake_async() performs a bit different actions
      depending on "how" argument. Unfortunately this argument
      ony has numerical magic values.
      
      I propose to give names to their constants to help people
      reading this function callers understand what's going on
      without looking into this function all the time.
      
      I suppose this is 2.6.25 material, but if it's not (or the
      naming seems poor/bad/awful), I can rework it against the
      current net-2.6 tree.
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8d8ad9d7
    • G
      [DCCP]: Honour and make use of shutdown option set by user · 8e8c71f1
      Gerrit Renker 提交于
      This extends the DCCP socket API by honouring any shutdown(2) option set by the user.
      The behaviour is, as much as possible, made consistent with the API for TCP's shutdown.
      
      This patch exploits the information provided by the user via the socket API to reduce
      processing costs:
       * if the read end is closed (SHUT_RD), it is not necessary to deliver to input CCID;
       * if the write end is closed (SHUT_WR), the same idea applies, but with a difference -
         as long as the TX queue has not been drained, we need to receive feedback to keep
         congestion-control rates up to date. Hence SHUT_WR is honoured only after the last
         packet (under congestion control) has been sent;
       * although SHUT_RDWR seems nonsensical, it is nevertheless supported in the same manner
         as for TCP (and agrees with test for SHUTDOWN_MASK in dccp_poll() in net/dccp/proto.c).
      
      Furthermore, most of the code already honours the sk_shutdown flags (dccp_recvmsg() for
      instance sets the read length to 0 if SHUT_RD had been called); CCID handling is now added
      to this by the present patch.
      
      There will also no longer be any delivery when the socket is in the final stages, i.e. when
      one of dccp_close(), dccp_fin(), or dccp_done() has been called - which is fine since at
      that stage the connection is its final stages.
      
      Motivation and background are on http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/shutdown
      
      A FIXME has been added to notify the other end if SHUT_RD has been set (RFC 4340, 11.7).
      
      Note: There is a comment in inet_shutdown() in net/ipv4/af_inet.c which asks to "make
            sure the socket is a TCP socket". This should probably be extended to mean
            `TCP or DCCP socket' (the code is also used by UDP and raw sockets).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8e8c71f1
  2. 24 10月, 2007 1 次提交
    • G
      [DCCP]: Convert Reset code into socket error number · d8ef2c29
      Gerrit Renker 提交于
      This adds support for converting the 11 currently defined Reset codes into system
      error numbers, which are stored in sk_err for further interpretation.
      
      This makes the externally visible API behaviour similar to TCP, since a client
      connecting to a non-existing port will experience ECONNREFUSED.
      
      * Code 0, Unspecified, is interpreted as non-error (0);
      * Code 1, Closed (normal termination), also maps into 0;
      * Code 2, Aborted, maps into "Connection reset by peer" (ECONNRESET);
      * Code 3, No Connection and
        Code 7, Connection Refused, map into "Connection refused" (ECONNREFUSED);
      * Code 4, Packet Error, maps into "No message of desired type" (ENOMSG);
      * Code 5, Option Error, maps into "Illegal byte sequence" (EILSEQ);
      * Code 6, Mandatory Error, maps into "Operation not supported on transport endpoint" (EOPNOTSUPP);
      * Code 8, Bad Service Code, maps into "Invalid request code" (EBADRQC);
      * Code 9, Too Busy, maps into "Too many users" (EUSERS);
      * Code 10, Bad Init Cookie, maps into "Invalid request descriptor" (EBADR);
      * Code 11, Aggression Penalty, maps into "Quota exceeded" (EDQUOT)
        which makes sense in terms of using more than the `fair share' of bandwidth.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d8ef2c29
  3. 18 10月, 2007 1 次提交
  4. 11 10月, 2007 6 次提交
  5. 26 4月, 2007 3 次提交
  6. 08 3月, 2007 1 次提交
  7. 07 3月, 2007 1 次提交
  8. 11 2月, 2007 1 次提交
  9. 12 12月, 2006 2 次提交
  10. 03 12月, 2006 2 次提交
    • G
      [DCCP]: Simplified conditions due to use of enum:8 states · 59348b19
      Gerrit Renker 提交于
      This reaps the benefit of the earlier patch, which changed the type of
      CCID 3 states to use enums, in that many conditions are now simplified
      and the number of possible (unexpected) values is greatly reduced.
      
      In a few instances, this also allowed to simplify pre-conditions; where
      care has been taken to retain logical equivalence.
      
      [DCCP]: Introduce a consistent BUG/WARN message scheme
      
      This refines the existing set of DCCP messages so that
       * BUG(), BUG_ON(), WARN_ON() have meaningful DCCP-specific counterparts
       * DCCP_CRIT (for severe warnings) is not rate-limited
       * DCCP_WARN() is introduced as rate-limited wrapper
      
      Using these allows a faster and cleaner transition to their original
      counterparts once the code has matured into a full DCCP implementation.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@mandriva.com>
      59348b19
    • G
      [DCCP]: Update code comments for Step 2/3 · d83ca5ac
      Gerrit Renker 提交于
      Sorts out the comments for processing steps 2,3 in section 8.5 of RFC 4340.
      All comments have been updated against this document, and the reference to step
      2 has been made consistent throughout the files.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@mandriva.com>
      d83ca5ac
  11. 25 10月, 2006 1 次提交
  12. 01 7月, 2006 1 次提交
  13. 21 3月, 2006 5 次提交
  14. 04 1月, 2006 6 次提交
  15. 11 10月, 2005 1 次提交
  16. 18 9月, 2005 1 次提交
  17. 17 9月, 2005 1 次提交
  18. 14 9月, 2005 2 次提交
  19. 09 9月, 2005 1 次提交