From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: davem@davemloft.net
Cc: dccp@vger.kernel.org, netdev@vger.kernel.org,
Gerrit Renker <gerrit@erg.abdn.ac.uk>
Subject: [PATCH 1/4] dccp: Initialisation framework for feature negotiation
Date: Sat, 17 Jan 2009 10:36:30 +0100 [thread overview]
Message-ID: <1232184993-9927-2-git-send-email-gerrit@erg.abdn.ac.uk> (raw)
In-Reply-To: <1232184993-9927-1-git-send-email-gerrit@erg.abdn.ac.uk>
This initialises feature negotiation from two tables, which are in turn are
initialised from sysctls.
As a novel feature, specifics of the implementation (e.g. that short seqnos
and ECN are not yet available) are advertised for robustness.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
---
include/linux/dccp.h | 19 --------------
net/dccp/feat.c | 67 +++++++++++++++++++++++++++++++++++++++++++--------
net/dccp/feat.h | 2 -
3 files changed, 58 insertions(+), 30 deletions(-)
--- a/net/dccp/feat.h
+++ b/net/dccp/feat.h
@@ -113,13 +113,13 @@ static inline void dccp_feat_debug(const
#define dccp_feat_debug(type, feat, val)
#endif /* CONFIG_IP_DCCP_DEBUG */
+extern int dccp_feat_init(struct sock *sk);
extern int dccp_feat_register_sp(struct sock *sk, u8 feat, u8 is_local,
u8 const *list, u8 len);
extern int dccp_feat_register_nn(struct sock *sk, u8 feat, u64 val);
extern int dccp_feat_parse_options(struct sock *, struct dccp_request_sock *,
u8 mand, u8 opt, u8 feat, u8 *val, u8 len);
extern int dccp_feat_clone_list(struct list_head const *, struct list_head *);
-extern int dccp_feat_init(struct sock *sk);
/*
* Encoding variable-length options and their maximum length.
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -369,28 +369,9 @@ static inline unsigned int dccp_hdr_len(
* Will be used to pass the state from dccp_request_sock to dccp_sock.
*
* @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
- * @dccpms_pending - List of features being negotiated
- * @dccpms_conf -
*/
struct dccp_minisock {
__u64 dccpms_sequence_window;
- struct list_head dccpms_pending;
- struct list_head dccpms_conf;
-};
-
-struct dccp_opt_conf {
- __u8 *dccpoc_val;
- __u8 dccpoc_len;
-};
-
-struct dccp_opt_pend {
- struct list_head dccpop_node;
- __u8 dccpop_type;
- __u8 dccpop_feat;
- __u8 *dccpop_val;
- __u8 dccpop_len;
- int dccpop_conf;
- struct dccp_opt_conf *dccpop_sc;
};
extern void dccp_minisock_init(struct dccp_minisock *dmsk);
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -1115,23 +1115,70 @@ int dccp_feat_parse_options(struct sock
return 0; /* ignore FN options in all other states */
}
+/**
+ * dccp_feat_init - Seed feature negotiation with host-specific defaults
+ * This initialises global defaults, depending on the value of the sysctls.
+ * These can later be overridden by registering changes via setsockopt calls.
+ * The last link in the chain is finalise_settings, to make sure that between
+ * here and the start of actual feature negotiation no inconsistencies enter.
+ *
+ * All features not appearing below use either defaults or are otherwise
+ * later adjusted through dccp_feat_finalise_settings().
+ */
int dccp_feat_init(struct sock *sk)
{
- struct dccp_sock *dp = dccp_sk(sk);
- struct dccp_minisock *dmsk = dccp_msk(sk);
+ struct list_head *fn = &dccp_sk(sk)->dccps_featneg;
+ u8 on = 1, off = 0;
int rc;
+ struct {
+ u8 *val;
+ u8 len;
+ } tx, rx;
+
+ /* Non-negotiable (NN) features */
+ rc = __feat_register_nn(fn, DCCPF_SEQUENCE_WINDOW, 0,
+ sysctl_dccp_feat_sequence_window);
+ if (rc)
+ return rc;
+
+ /* Server-priority (SP) features */
+
+ /* Advertise that short seqnos are not supported (7.6.1) */
+ rc = __feat_register_sp(fn, DCCPF_SHORT_SEQNOS, true, true, &off, 1);
+ if (rc)
+ return rc;
+
+ /* RFC 4340 12.1: "If a DCCP is not ECN capable, ..." */
+ rc = __feat_register_sp(fn, DCCPF_ECN_INCAPABLE, true, true, &on, 1);
+ if (rc)
+ return rc;
- INIT_LIST_HEAD(&dmsk->dccpms_pending); /* XXX no longer used */
- INIT_LIST_HEAD(&dmsk->dccpms_conf); /* XXX no longer used */
-
- /* Ack ratio */
- rc = __feat_register_nn(&dp->dccps_featneg, DCCPF_ACK_RATIO, 0,
- dp->dccps_l_ack_ratio);
+ /*
+ * We advertise the available list of CCIDs and reorder according to
+ * preferences, to avoid failure resulting from negotiating different
+ * singleton values (which always leads to failure).
+ * These settings can still (later) be overridden via sockopts.
+ */
+ if (ccid_get_builtin_ccids(&tx.val, &tx.len) ||
+ ccid_get_builtin_ccids(&rx.val, &rx.len))
+ return -ENOBUFS;
+
+ if (!dccp_feat_prefer(sysctl_dccp_feat_tx_ccid, tx.val, tx.len) ||
+ !dccp_feat_prefer(sysctl_dccp_feat_rx_ccid, rx.val, rx.len))
+ goto free_ccid_lists;
+
+ rc = __feat_register_sp(fn, DCCPF_CCID, true, false, tx.val, tx.len);
+ if (rc)
+ goto free_ccid_lists;
+
+ rc = __feat_register_sp(fn, DCCPF_CCID, false, false, rx.val, rx.len);
+
+free_ccid_lists:
+ kfree(tx.val);
+ kfree(rx.val);
return rc;
}
-EXPORT_SYMBOL_GPL(dccp_feat_init);
-
int dccp_feat_activate_values(struct sock *sk, struct list_head *fn_list)
{
struct dccp_sock *dp = dccp_sk(sk);
next prev parent reply other threads:[~2009-01-17 9:36 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-17 21:46 [RFCv2][PATCH] static builtin CCIDs was Re: [PATCH 2/5] dccp: Auto-load (when supported) CCID plugins for negotiation Arnaldo Carvalho de Melo
2008-12-18 5:21 ` David Miller
2008-12-18 5:33 ` Gerrit Renker
2008-12-19 3:15 ` David Miller
2008-12-19 5:24 ` Gerrit Renker
2008-12-19 6:28 ` David Miller
2008-12-19 7:56 ` gerrit
2008-12-20 23:51 ` Arnaldo Carvalho de Melo
2008-12-20 8:08 ` [RFC] [Patch 0/4] dccp: Working prototype of integrating the modules Gerrit Renker
2008-12-20 8:08 ` [RFC] [Patch 1/4] dccp: Remove old CCID-module references Gerrit Renker
2008-12-20 8:08 ` [RFC] [Patch 2/4] dccp: Lockless use of CCID blocks Gerrit Renker
2008-12-21 0:32 ` Arnaldo Carvalho de Melo
2008-12-23 17:08 ` Gerrit Renker
2008-12-23 17:17 ` Gerrit Renker
2009-01-01 10:49 ` Gerrit Renker
2009-01-03 7:30 ` [Patch 0/3] " Gerrit Renker
2009-01-03 7:30 ` [PATCH 1/3] dccp: Lockless integration of CCID congestion-control plugins Gerrit Renker
2009-01-03 7:30 ` [PATCH 2/3] dccp: Clean up ccid.c after integration of CCID plugins Gerrit Renker
2009-01-03 7:30 ` [PATCH 3/3] dccp: Integrate the TFRC library with DCCP Gerrit Renker
2009-01-05 5:46 ` David Miller
2009-01-17 9:36 ` [PATCH 0/4] dccp: Completing feature negotiation Gerrit Renker
2009-01-17 9:36 ` Gerrit Renker [this message]
2009-01-17 9:36 ` [PATCH 2/4] dccp: Implement both feature-local and feature-remote Sequence Window feature Gerrit Renker
2009-01-17 9:36 ` [PATCH 3/4] dccp: Initialisation and type-checking of feature sysctls Gerrit Renker
2009-01-17 9:36 ` [PATCH 4/4] dccp: Debugging functions for feature negotiation Gerrit Renker
2009-01-19 5:40 ` David Miller
2009-01-19 5:40 ` [PATCH 3/4] dccp: Initialisation and type-checking of feature sysctls David Miller
2009-01-19 5:40 ` [PATCH 2/4] dccp: Implement both feature-local and feature-remote Sequence Window feature David Miller
2009-01-19 5:39 ` [PATCH 1/4] dccp: Initialisation framework for feature negotiation David Miller
2009-01-05 5:46 ` [PATCH 2/3] dccp: Clean up ccid.c after integration of CCID plugins David Miller
2009-01-05 5:45 ` [PATCH 1/3] dccp: Lockless integration of CCID congestion-control plugins David Miller
2008-12-20 8:08 ` [RFC] [Patch 3/4] dccp: Add unregister function Gerrit Renker
2008-12-21 0:35 ` Arnaldo Carvalho de Melo
2008-12-20 8:08 ` [RFC] [Patch 4/4] dccp: Integrate the TFRC library (dependency) Gerrit Renker
2008-12-21 0:55 ` Arnaldo Carvalho de Melo
2008-12-23 10:54 ` Gerrit Renker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1232184993-9927-2-git-send-email-gerrit@erg.abdn.ac.uk \
--to=gerrit@erg.abdn.ac.uk \
--cc=davem@davemloft.net \
--cc=dccp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).