1. 04 9月, 2008 40 次提交
    • G
      dccp: Support for the exchange of NN options in established state · 624a965a
      Gerrit Renker 提交于
      In contrast to static feature negotiation at the begin of a connection, which
      establishes the capabilities of both endpoints, this patch introduces support
      for dynamic exchange of feature negotiation options.
      
      Such a dynamic exchange is necessary in at least two cases:
       * CCID-2's Ack Ratio (RFC 4341, 6.1.2) which changes during the connection;
       * Sequence Window values that, as per RFC 4340, 7.5.2, should be sent "as
         as the connection progresses".
      
      Both are NN (non-negotiable) features. Hence dynamic feature "negotiation" is
      distinguished from static/pre-connection negotiation by the following:
       * no new capabilities are negotiated (those that matter for the connection
         are negotiated prior to setting up the connection, comparable to SIP);
       * features must be understood by each endpoint: as per RFC 4340, 6.4, 
         Sequence Window is "Req'd" and Ack Ratio must be understood when CCID-2
         is used as per the note underneath Table 4.
      
      These characteristics are reflected in the implementation:
       * only NN options can be exchanged after connection setup;
       * NN options are activated directly after validating them. The rationale is
         that a peer must accept every valid NN value (RFC 4340, 6.3.2), hence it
         will either accept the value and send a "Confirm R", or it will send an
         empty Confirm (which will reset the connection according to FN rules). 
       * An Ack is scheduled directly after activation to accelerate communicating
         the update to the peer.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      624a965a
    • G
      dccp: Debugging functions for feature negotiation · 76f738a7
      Gerrit Renker 提交于
      Since all feature-negotiation processing now takes place in feat.c, functions
      for producing verbose debugging output are concentrated there.
      
      New functions to print out values, entry records, and options are provided,
      and also a macro is defined to not always have the function name in the
      output line.
      
      Thanks a lot to Wei Yongjun and Giuseppe Galeota for help with errors in an
      earlier revision of this patch.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      76f738a7
    • G
      dccp: Initialisation and type-checking of feature sysctls · 0a482267
      Gerrit Renker 提交于
      This patch takes care of initialising and type-checking sysctls related to
      feature negotiation. Type checking is important since some of the sysctls
      now directly act on the feature-negotiation process.
      
      The sysctls are initialised with the known default values for each feature.
      For the type-checking the value constraints from RFC 4340 are used:
      
       * Sequence Window uses the specified Wmin=32, the maximum is ulong (4 bytes),
         tested and confirmed that it works up to 4294967295 - for Gbps speed;
       * Ack Ratio is between 0 .. 0xffff (2-byte unsigned integer);
       * CCIDs are between 0 .. 255;
       * request_retries, retries1, retries2 also between 0..255 for good measure;
       * tx_qlen is checked to be non-negative;
       * sync_ratelimit remains as before.
      
      Further changes:
      ----------------
      Performed s@sysctl_dccp_feat@sysctl_dccp@g since the sysctls are now in feat.c.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      0a482267
    • G
      dccp: Implement both feature-local and feature-remote Sequence Window feature · 51c7d4fa
      Gerrit Renker 提交于
      This adds full support for local/remote Sequence Window feature, from which the 
        * sequence-number-validity (W) and 
        * acknowledgment-number-validity (W') windows 
      derive as specified in RFC 4340, 7.5.3. 
      
      Specifically, the following changes are introduced:
        * integrated new socket fields into dccp_sk;
        * updated the update_gsr/gss routines with regard to these fields;
        * updated handler code: the Sequence Window feature is located at the TX side,
          so the local feature is meant if the handler-rx flag is false;
        * the initialisation of `rcv_wnd' in reqsk is removed, since
          - rcv_wnd is not used by the code anywhere;
          - sequence number checks are not done in the LISTEN state (cf. 7.5.3);
          - dccp_check_req checks the Ack number validity more rigorously;
        * the `struct dccp_minisock' became empty and is now removed.
      
      Until the handshake completes with activating negotiated values, the local/remote
      Sequence-Window values are undefined and thus can not reliably be estimated.
      This issue is addressed in a separate patch.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      51c7d4fa
    • G
      dccp: Auto-load (when supported) CCID plugins for negotiation · 09856c10
      Gerrit Renker 提交于
      This adds auto-loading of CCIDs (when module loading is enabled) 
      for the purpose of feature negotiation. 
      
      The problem with loading the CCIDs at the end of feature negotiation is
      that this would happen in software interrupt context. Besides, if the host
      advertises CCIDs during negotiation, it should have them ready to use, in
      case an agreeing peer wants to use it for the connection.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      09856c10
    • G
      dccp: Initialisation framework for feature negotiation · 5d3dac26
      Gerrit Renker 提交于
      This initialises feature negotiation from two tables, which are initialised
      from sysctls. 
      
      As a novel feature, specifics of the implementation (e.g. currently short
      seqnos and ECN are not supported) are advertised for robustness.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      5d3dac26
    • G
      dccp ccid-2: Phase out the use of boolean Ack Vector sysctl · b235dc4a
      Gerrit Renker 提交于
      This removes the use of the sysctl and the minisock variable for the Send Ack
      Vector feature, which is now handled fully dynamically via feature negotiation;
      i.e. when CCID2 is enabled, Ack Vectors are automatically enabled (as per
      RFC 4341, 4.).
      
      Using a sysctl in parallel to this implementation would open the door to
      crashes, since much of the code relies on tests of the boolean minisock /
      sysctl variable. Thus, this patch replaces all tests of type
      
      	if (dccp_msk(sk)->dccpms_send_ack_vector)
      		/* ... */
      with
      	if (dp->dccps_hc_rx_ackvec != NULL)
      		/* ... */
      
      The dccps_hc_rx_ackvec is allocated by the dccp_hdlr_ackvec() when feature
      negotiation concluded that Ack Vectors are to be used on the half-connection.
      Otherwise, it is NULL (due to dccp_init_sock/dccp_create_openreq_child),
      so that the test is a valid one.
      
      The activation handler for Ack Vectors is called as soon as the feature
      negotiation has concluded at the
       * server when the Ack marking the transition RESPOND => OPEN arrives;
       * client after it has sent its ACK, marking the transition REQUEST => PARTOPEN.
      
      Adding the sequence number of the Response packet to the Ack Vector has been 
      removed, since
       (a) connection establishment implies that the Response has been received;
       (b) the CCIDs only look at packets received in the (PART)OPEN state, i.e.
           this entry will always be ignored;
       (c) it can not be used for anything useful - to detect loss for instance, only
           packets received after the loss can serve as pseudo-dupacks.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      b235dc4a
    • G
      dccp: Remove manual influence on NDP Count feature · 68e074bf
      Gerrit Renker 提交于
      Updating the NDP count feature is handled automatically now:
       * for CCID-2 it is disabled, since the code does not use NDP counts;
       * for CCID-3 it is enabled, as NDP counts are used to determine loss lengths.
      
      Allowing the user to change NDP values leads to unpredictable and failing
      behaviour, since it is then possible to disable NDP counts even when they
      are needed (e.g. in CCID-3).
      
      This means that only those user settings are sensible that agree with the
      values for Send NDP Count implied by the choice of CCID. But those settings
      are already activated by the feature negotiation (CCID dependency tracking),
      hence this form of support is redundant.
      
      At startup the initialisation of the NDP count feature is with the default
      value of 0, which is done implicitly by the zeroing-out of the socket when
      it is allocated. If the choice of CCID or feature negotiation enables NDP
      count, this will then be updated via the NDP activation handler.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      68e074bf
    • G
      dccp: Remove obsolete parts of the old CCID interface · 78673e24
      Gerrit Renker 提交于
      The TX/RX CCIDs of the minisock are now redundant: similar to the Ack Vector
      case, their value equals initially that of the sysctl, but at the end of
      feature negotiation may be something different.
      
      The old interface removed by this patch thus has been replaced by the newer
      interface to dynamically query the currently loaded CCIDs earlier in this
      patch set.
      
      Also removed the constructors for the TX CCID and the RX CCID, since the
      switch rx/non-rx is done by the handler in minisocks.c (and the handler is
      the only place in the code where CCIDs are loaded).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      78673e24
    • G
      dccp: Clean up old feature-negotiation infrastructure · 23479cbf
      Gerrit Renker 提交于
      The code removed by this patch is no longer referenced or used, the added
      lines update documentation and copyrights.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      23479cbf
    • G
      dccp: Integration of dynamic feature activation - part 3 (client side) · c49b2272
      Gerrit Renker 提交于
      This integrates feature-activation in the client, with these details:
      
       1. When dccp_parse_options() fails, the reset code is already set, request_sent
          _state_process() currently overrides this with `Packet Error', which is not
          intended - so changed to use the reset code set in dccp_parse_options();
      
       2. There was a FIXME to change the error code when dccp_ackvec_add() fails.
          I have looked this up and found that: 
          * the check whether ackno < ISN is already made earlier,
          * this Response is likely the 1st packet with an Ackno that the client gets,
          * so when dccp_ackvec_add() fails, the reason is likely not a packet error.
      
       3. When feature negotiation fails, the socket should be marked as not usable,
          so that the application is notified that an error occurs. This is achieved
          by a new label, which uses an error code of `Aborted' and which sets the
          socket state to CLOSED, as well as sk_err.
      
       4. Avoids parsing the Ack twice in Respond state by not doing option processing
          again in dccp_rcv_respond_partopen_state_process (as option processing has
          already been done on the request_sock in dccp_check_req).    
      
      Since this addresses congestion-control initialisation, a corresponding
      FIXME has been removed.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      c49b2272
    • G
      dccp: Integration of dynamic feature activation - part 2 (server side) · e70cacb9
      Gerrit Renker 提交于
      This patch integrates the activation of features at the end of negotiation
      into the server-side code.
      
      Note: 
        In dccp_create_openreq_child the request_sock argument is no longer constant,
        since dccp_activate_values() uses the feature-negotiation list on dreq to sort
        out the initialisation values for the different features of the child socket;
        and purges this queue after use (but the `req' argument to openreq_child
        can and does still remain constant).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      e70cacb9
    • G
      dccp: Integration of dynamic feature activation - part 1 (socket setup) · 3a53a9ad
      Gerrit Renker 提交于
      This first patch out of three replaces the hardcoded default settings with
      initialisation code for the dynamic feature negotiation.
      
      Note on retransmitting Confirm options:
      ---------------------------------------
      This patch also defers flushing the client feature-negotiation queue,
      due to the following considerations.
      
      As long as the client is in PARTOPEN, it needs to retransmit the Confirm
      options for the Change options received on the DCCP-Response from the server.
      
      Otherwise, if the packet containing the Confirm options gets dropped in the 
      network, the connection aborts due to undefined feature negotiation state.
      
      Thanks to Leandro Melo de Sales who reported a bug in an earlier revision
      of the patch set, resulting from not retransmitting the Confirm options.
      
      The patch now ensures that the client feature-negotiation queue is flushed only
      when entering the OPEN state. Since confirmed Change options are removed as
      soon as they are confirmed (in the DCCP-Response), this ensures that Confirm
      options are retransmitted.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      3a53a9ad
    • G
      dccp: Feature activation handlers · c926c6ae
      Gerrit Renker 提交于
      This patch provides the post-processing of feature negotiation state, after
      the negotiation has completed.
      
      To this purpose, handlers are used and added to the dccp_feat_table. Each
      handler is passed a boolean flag whether the RX or TX side of the feature
      is meant.
      
      Several handlers are provided already, new handlers can easily be added.
      
      The initialisation is now fully dynamic, i.e. CCIDs are activated only
      after the feature negotiation. The integration of this dynamic activation
      is done in the subsequent patches.
      
      Thanks to Wei Yongjun for pointing out the necessity of skipping over empty
      Confirm options while copying the negotiated feature values.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      c926c6ae
    • G
      dccp: Processing Confirm options · d2150b7b
      Gerrit Renker 提交于
      Analogous to the previous patch, this adds code to interpret incoming Confirm
      feature-negotiation options. Both functions operate on the feature-negotiation
      list of either the request_sock (server) or the dccp_sock (client).
      
      Thanks to Wei Yongjun for pointing out that it is overly restrictive to check
      the entire list of confirmed SP values.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      d2150b7b
    • G
      dccp: Process incoming Change feature-negotiation options · 5a146b97
      Gerrit Renker 提交于
      This adds/replaces code for processing incoming ChangeL/R options.
      The main difference is that:
       * mandatory FN options are now interpreted inside the function
        (there are too many individual cases to do this externally);
       * the function returns an appropriate Reset code or 0,
         which is then used to fill in the data for the Reset packet.
      
      Old code, which is no longer used or referenced, has been removed.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      5a146b97
    • G
      dccp: Preference list reconciliation · c664d4f4
      Gerrit Renker 提交于
      This provides two functions to
       * reconcile preference lists (with appropriate return codes) and
       * reorder the preference list if successful reconciliation changed the
         preferred value.
      
      The patch also removes the old code for processing SP/NN Change options, since
      new code to process these is mostly there already; related references have been
      commented out.
      
      The code for processing Change options follows in the next patch.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      c664d4f4
    • G
      dccp: Integrate feature-negotiation insertion code · f8a644c0
      Gerrit Renker 提交于
      The patch implements insertion of feature negotiation at the server (listening
      and request socket) and the client (connecting socket).
      
      In dccp_insert_options(), several statements have been grouped together now
      to achieve (I hope) better efficiency by reducing the number of tests each
      packet has to go through:
       - Ack Vectors are sent if the packet is neither a Data or a Request packet;
       - a previous issue is corrected - feature negotiation options are allowed
         on DataAck packets (5.8).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      f8a644c0
    • G
      dccp: Insert feature-negotiation options into skb · 0ef118a0
      Gerrit Renker 提交于
      This patch replaces the earlier insertion routine from options.c, so that
      code specific to feature negotiation can remain in feat.c. This is possible
      by calling a function already existing in options.c.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      0ef118a0
    • G
      dccp: Header option insertion routine for feature-negotiation · cf9ddf73
      Gerrit Renker 提交于
      The patch extends existing code:
       * Confirm options divide into the confirmed value plus an optional preference
         list for SP values. Previously only the preference list was echoed for SP
         values, now the confirmed value is added as per RFC 4340, 6.1;
       * length and sanity checks are added to avoid illegal memory (or NULL) access.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      cf9ddf73
    • G
      dccp: Support for Mandatory options · d0440ee6
      Gerrit Renker 提交于
      Support for Mandatory options is provided by this patch, which will
      be used by subsequent feature-negotiation patches.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      Acked-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d0440ee6
    • G
      dccp: Increase the scope of variable-length htonl/ntohl functions · b9aaac1c
      Gerrit Renker 提交于
      This extends the scope of two available functions, encode|decode_value_var,
      to work up to 6 (8) bytes, to match maximum requirements in the RFC.
      
      These functions are going to be used both by general option processing and 
      feature negotiation code, hence declarations have been put into feat.h.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      Acked-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b9aaac1c
    • G
      dccp: API to query the current TX/RX CCID · c8041e26
      Gerrit Renker 提交于
      This provides function to query the current TX/RX CCID dynamically, without
      reliance on the minisock value, using dynamic information available in the
      currently loaded CCID module.
      
      This query function is then used to 
       (a) provide the getsockopt part for getting/setting CCIDs via sockopts;
       (b) replace the current test for "which CCID is in use" in probe.c.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      c8041e26
    • G
      dccp: Set per-connection CCIDs via socket options · fade756f
      Gerrit Renker 提交于
      With this patch, TX/RX CCIDs can now be changed on a per-connection basis, which
      overrides the defaults set by the global sysctl variables for TX/RX CCIDs.
      
      To make full use of this facility, the remaining patches of this patch set are
      needed, which track dependencies and activate negotiated feature values.
      
      Note on the maximum number of CCIDs that can be registered:
      -----------------------------------------------------------
      The maximum number of CCIDs that can be registered on the socket is constrained
      by the space in a Confirm/Change feature negotiation option. 
      
      The space in these in turn depends on the size of header options as defined
      in RFC 4340, 5.8. Since this is a recurring constant, it has been moved from
      ackvec.h into linux/dccp.h, clarifying its purpose.
      
      Relative to this size, the maximum number of CCID identifiers that can be 
      present in a Confirm option (which always consumes 1 byte more than a Change
      option, cf. 6.1) is 2 bytes less than the maximum TLV size: one for the
      CCID-feature-type and one for the selected value.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      fade756f
    • G
      dccp: Tidy up setsockopt calls · 73bbe095
      Gerrit Renker 提交于
      This splits the setsockopt calls into two groups, depending on whether an
      integer argument (val) is required and whether routines being called do
      their own locking.
      
      Some options (such as setting the CCID) use u8 rather than int, so that for
      these the test with regard to integer-sizeof can not be used.
      
      The second switch-case statement now only has those statements which need
      locking and which make use of `val'.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      Acked-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Reviewed-by: NEugene Teo <eugeneteo@kernel.sg>
      73bbe095
    • G
      dccp: Deprecate Ack Ratio sysctl · 17c30b40
      Gerrit Renker 提交于
      This patch deprecates the Ack Ratio sysctl, since
       * Ack Ratio is entirely ignored by CCID-3 and CCID-4,
       * Ack Ratio currently doesn't work in CCID-2 (i.e. is always set to 1);
       * even if it would work in CCID-2, there is no point for a user to change it:
         - Ack Ratio is constrained by cwnd (RFC 4341, 6.1.2),
         - if Ack Ratio > cwnd, the system resorts to spurious RTO timeouts 
           (since waiting for Acks which will never arrive in this window),
         - cwnd is not a user-configurable value.	
      
      The only reasonable place for Ack Ratio is to print it for debugging. It is
      planned to do this later on, as part of e.g. dccp_probe.
      
      With this patch Ack Ratio is now under full control of feature negotiation:
       * Ack Ratio is resolved as a dependency of the selected CCID;
       * if the chosen CCID supports it (i.e. CCID == CCID-2), Ack Ratio is set to
         the default of 2, following RFC 4340, 11.3 - "New connections start with Ack
         Ratio 2 for both endpoints";
       * what happens then is part of another patch set, since it concerns the 
         dynamic update of Ack Ratio while the connection is in full flight.
      
      Thanks to Tomasz Grobelny for discussion leading up to this patch.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      17c30b40
    • G
      dccp: Feature negotiation for minimum-checksum-coverage · 20f41eee
      Gerrit Renker 提交于
      This provides feature negotiation for server minimum checksum coverage
      which so far has been missing.
      
      Since sender/receiver coverage values range only from 0...15, their
      type has also been reduced in size from u16 to u4.
      
      Feature-negotiation options are now generated for both sender and receiver
      coverage, i.e. when the peer has `forgotten' to enable partial coverage
      then feature negotiation will automatically enable (negotiate) the partial
      coverage value for this connection.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      20f41eee
    • G
      dccp: Deprecate old setsockopt framework · 668144f7
      Gerrit Renker 提交于
      The previous setsockopt interface, which passed socket options via struct 
      dccp_so_feat, is complicated/difficult to use. Continuing to support it leads to
      ugly code since the old approach did not distinguish between NN and SP values.
      
      This patch removes the old setsockopt interface and replaces it with two new
      functions to register NN/SP values for feature negotiation. These are 
      essentially wrappers around the internal __feat_register functions, with 
      checking added to avoid
       * wrong usage (type);
       * changing values while the connection is in progress.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      668144f7
    • G
      dccp: Mechanism to resolve CCID dependencies · d4c8741c
      Gerrit Renker 提交于
      This adds a hook to resolve features whose value depends on the choice of
      CCID. It is done at the server since it can only be done after the CCID
      values have been negotiated; i.e. the client will add its CCID preference
      list on the Change options sent in the Request, which will be reconciled
      with the local preference list of the server.
      
      The concept is documented on 
      http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/feature_negotiation/\
      				implementation_notes.html#ccid_dependencies
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      d4c8741c
    • G
      dccp: Resolve dependencies of features on choice of CCID · 093e1f46
      Gerrit Renker 提交于
      This provides a missing link in the code chain, as several features implicitly
      depend and/or rely on the choice of CCID. Most notably, this is the Send Ack Vector
      feature, but also Ack Ratio and Send Loss Event Rate (also taken care of).
      
      For Send Ack Vector, the situation is as follows:
       * since CCID2 mandates the use of Ack Vectors, there is no point in allowing 
         endpoints which use CCID2 to disable Ack Vector features such a connection;
      
       * a peer with a TX CCID of CCID2 will always expect Ack Vectors, and a peer
         with a RX CCID of CCID2 must always send Ack Vectors (RFC 4341, sec. 4);
      
       * for all other CCIDs, the use of (Send) Ack Vector is optional and thus
         negotiable. However, this implies that the code negotiating the use of Ack
         Vectors also supports it (i.e. is able to supply and to either parse or
         ignore received Ack Vectors). Since this is not the case (CCID-3 has no Ack
         Vector support), the use of Ack Vectors is here disabled, with a comment
         in the source code.
      
      An analogous consideration arises for the Send Loss Event Rate feature,
      since the CCID-3 implementation does not support the loss interval options
      of RFC 4342. To make such use explicit, corresponding feature-negotiation
      options are inserted which signal the use of the loss event rate option,
      as it is used by the CCID3 code.
      
      Lastly, the values of the Ack Ratio feature are matched to the choice of CCID.
      
      The patch implements this as a function which is called after the user has
      made all other registrations for changing default values of features.
      
      The table is variable-length, the reserved (and hence for feature-negotiation
      invalid, confirmed by considering section 19.4 of RFC 4340) feature number `0'
      is used to mark the end of the table.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      093e1f46
    • G
      dccp: Query supported CCIDs · 71bb4959
      Gerrit Renker 提交于
      This provides a data structure to record which CCIDs are locally supported
      and three accessor functions:
       - a test function for internal use which is used to validate CCID requests
         made by the user;
       - a copy function so that the list can be used for feature-negotiation;   
       - documented getsockopt() support so that the user can query capabilities.
      
      The data structure is a table which is filled in at compile-time with the
      list of available CCIDs (which in turn depends on the Kconfig choices).
      
      Using the copy function for cloning the list of supported CCIDs is useful for
      feature negotiation, since the negotiation is now with the full list of available
      CCIDs (e.g. {2, 3}) instead of the default value {2}. This means negotiation 
      will not fail if the peer requests to use CCID3 instead of CCID2. 
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      71bb4959
    • G
      dccp: Registration routines for changing feature values · 86349c8d
      Gerrit Renker 提交于
      Two registration routines, for SP and NN features, are provided by this patch,
      replacing a previous routine which was used for both feature types.
      
      These are internal-only routines and therefore start with `__feat_register'.
      
      It further exports the known limits of Sequence Window and Ack Ratio as symbolic
      constants.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      86349c8d
    • G
      dccp: Limit feature negotiation to connection setup phase · 5591d286
      Gerrit Renker 提交于
      This patch starts the new implementation of feature negotiation:
       1. Although it is theoretically possible to perform feature negotiation at any
          time (and RFC 4340 supports this), in practice this is prohibitively complex,
          as it requires to put traffic on hold for each new negotiation.
       2. As a byproduct of restricting feature negotiation to connection setup, the
          feature-negotiation retransmit timer is no longer required. This part is now
          mapped onto the protocol-level retransmission.
          Details indicating why timers are no longer needed can be found on
          http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/feature_negotiation/\
      	                                      implementation_notes.html
      
      This patch disables anytime negotiation, subsequent patches work out full
      feature negotiation support for connection setup.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      5591d286
    • G
      dccp: Cleanup routines for feature negotiation · 70208383
      Gerrit Renker 提交于
      This inserts the required de-allocation routines for memory allocated by 
      feature negotiation in the socket destructors, replacing dccp_feat_clean()
      in one instance.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      70208383
    • G
      dccp: Per-socket initialisation of feature negotiation · 828755ce
      Gerrit Renker 提交于
      This provides feature-negotiation initialisation for both DCCP sockets and
      DCCP request_sockets, to support feature negotiation during connection setup.
      
      It also resolves a FIXME regarding the congestion control initialisation.
      
      Thanks to Wei Yongjun for help with the IPv6 side of this patch.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      828755ce
    • G
      dccp: List management for new feature negotiation · 3001fc05
      Gerrit Renker 提交于
      This adds list fields and list management functions for the new feature
      negotiation implementation. The new code is kept in parallel to the old
      code, until removed at the end of the patch set.
      
      Thanks to Arnaldo for suggestions to improve the code.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      3001fc05
    • G
      dccp: Implement lookup table for feature-negotiation information · b4eec206
      Gerrit Renker 提交于
      A lookup table for feature-negotiation information, extracted from RFC 4340/42,
      is provided by this patch. All currently known features can be found in this 
      table, along with their feature location, their default value, and type.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      b4eec206
    • G
      dccp: Basic data structure for feature negotiation · 5c7c9451
      Gerrit Renker 提交于
      This patch prepares for the new and extended feature-negotiation routines.
      
      The following feature-negotiation data structures are provided:
      	* a container for the various (SP or NN) values,
      	* symbolic state names to track feature states,
      	* an entry struct which holds all current information together,
      	* elementary functions to fill in and process these structures.
      
      Entry structs are arranged as FIFO for the following reason: RFC 4340 specifies
      that if multiple options of the same type are present, they are processed in the
      order of their appearance in the packet; which means that this order needs to be
      preserved in the local data structure (the later insertion code also respects
      this order).
      
      The struct list_head has been chosen for the following reasons: the most 
      frequent operations are
       * add new entry at tail (when receiving Change or setting socket options);
       * delete entry (when Confirm has been received);
       * deep copy of entire list (cloning from listening socket onto request socket).
      
      The NN value has been set to 64 bit, which is a currently sufficient upper limit
      (Sequence Window feature has 48 bit).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      5c7c9451
    • G
      dccp ccid-3: Replace lazy BUG_ON with condition · 959fd992
      Gerrit Renker 提交于
      The BUG_ON(w_tot == 0) only holds if there is no more than 1 loss interval in
      the loss history. If there is only a single loss interval, the calc_i_mean()
      routine need in fact not be called (RFC 3448, 6.3.1). 
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      959fd992
    • G
      dccp: Toggle debug output without module unloading · 43264991
      Gerrit Renker 提交于
      This sets the sysfs permissions so that root can toggle the `debug'
      parameter available for nearly every DCCP module. This is useful 
      since there are various module inter-dependencies. The debug flag
      can now be toggled at runtime using
      
        echo 1 > /sys/module/dccp/parameters/dccp_debug
        echo 1 > /sys/module/dccp_ccid2/parameters/ccid2_debug
        echo 1 > /sys/module/dccp_ccid3/parameters/ccid3_debug
        echo 1 > /sys/module/dccp_tfrc_lib/parameters/tfrc_debug
      
      The last is not very useful yet, since no code at the moment calls
      the tfrc_debug() macro.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      43264991