1. 19 8月, 2008 1 次提交
    • G
      dccp: Fix panic caused by too early termination of retransmission mechanism · d28934ad
      Gerrit Renker 提交于
      Thanks is due to Wei Yongjun for the detailed analysis and description of this
      bug at http://marc.info/?l=dccp&m=121739364909199&w=2
      
      The problem is that invalid packets received by a client in state REQUEST cause
      the retransmission timer for the DCCP-Request to be reset. This includes freeing
      the Request-skb ( in dccp_rcv_request_sent_state_process() ). As a consequence,
       * the arrival of further packets cause a double-free, triggering a panic(),
       * the connection then may hang, since further retransmissions are blocked.
      
      This patch changes the order of statements so that the retransmission timer is
      reset, and the pending Request freed, only if a valid Response has arrived (or
      the number of sysctl-retries has been exhausted).
      
      Further changes:
      ----------------
      To be on the safe side, replaced __kfree_skb with kfree_skb so that if due to
      unexpected circumstances the sk_send_head is NULL the WARN_ON is used instead.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d28934ad
  2. 26 7月, 2008 1 次提交
  3. 29 1月, 2008 6 次提交
    • G
      [DCCP]: Allow to parse options on Request Sockets · 8b819412
      Gerrit Renker 提交于
      The option parsing code currently only parses on full sk's. This causes a problem for
      options sent during the initial handshake (in particular timestamps and feature-negotiation
      options). Therefore, this patch extends the option parsing code with an additional argument
      for request_socks: if it is non-NULL, options are parsed on the request socket, otherwise
      the normal path (parsing on the sk) is used.
      
      Subsequent patches, which implement feature negotiation during connection setup, make use
      of this facility.
      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>
      8b819412
    • G
      [DCCP]: Perform SHUT_RD and SHUT_WR on receiving close · 69567d0b
      Gerrit Renker 提交于
      This patch performs two changes:
      
      1) Close the write-end in addition to the read-end when a fin-like segment
        (Close or CloseReq) is received by DCCP. This accounts for the fact that DCCP,
        in contrast to TCP, does not have a half-close. RFC 4340 says in this respect
        that when a fin-like segment has been sent there is no guarantee at all that
        any   further data will be processed.
        Thus this patch performs SHUT_WR in addition to the SHUT_RD when a fin-like
        segment is encountered.
      
      2) Minor change: I noted that code appears twice in different places and think it
         makes sense to put this into a self-contained function (dccp_enqueue()).
      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>
      69567d0b
    • G
      [DCCP]: Remove duplicate test for CloseReq · 3159afe0
      Gerrit Renker 提交于
      This removes a redundant test for unexpected packet types. In dccp_rcv_state_process
      it is tested twice whether a DCCP-server has received a CloseReq (Step 7):
      
       * first in the combined if-statement,
       * then in the call to dccp_rcv_closereq().
      
      The latter is necesssary since dccp_rcv_closereq() is also called from
      __dccp_rcv_established().
      
      This patch removes the duplicate test.
      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>
      3159afe0
    • 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
  4. 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
  5. 18 10月, 2007 1 次提交
  6. 11 10月, 2007 6 次提交
  7. 26 4月, 2007 3 次提交
  8. 08 3月, 2007 1 次提交
  9. 07 3月, 2007 1 次提交
  10. 11 2月, 2007 1 次提交
  11. 12 12月, 2006 2 次提交
  12. 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
  13. 25 10月, 2006 1 次提交
  14. 01 7月, 2006 1 次提交
  15. 21 3月, 2006 5 次提交
  16. 04 1月, 2006 6 次提交
  17. 11 10月, 2005 1 次提交