Skip to contentSkip to conversation

: Resolve dependencies of features on choice of CCID

PATCH In review Gerrit Renker 2 participants 2 messages Oct 3, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH v3 4/9 : Resolve dependencies of features on choice of CCID

Reworked patch, updated as requested:
* removed `typedef const'
* made all initialisation explicit, using field initialisers
This increases the space somewhat, but indeed much better readability.
* Ian I have added your Acked-by as requested, but please have another look and let me know whether you are ok with this revision

-------------------------> Patch v3 <------------------------------------------------------- [DCCP]: Resolve dependencies of features on choice of CCID

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 the patch also takes care of Ack Ratio and Send Loss Event Rate.

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 Send Ack Vector features on the corresponding half-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 (CCID3 has no Ack Vector support), the use of Ack Vectors is here disabled, with a corresponding comment in the source code.

An analogous consideration arises for the Send Loss Event Rate feature, since the CCID3 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 of 0 is used to mark the end of the table.

---
 net/dccp/dccp.h   |    1 
 net/dccp/feat.c   |  157 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 net/dccp/output.c |    4 +
 net/dccp/proto.c  |    3 +
 4 files changed, 165 insertions(+)
net/dccp/dccp.h +1 -0
@@ -422,6 +422,7 @@ static inline int dccp_ack_pending(const
 	       inet_csk_ack_scheduled(sk);
 }
 
+extern int  dccp_feat_finalise_settings(struct dccp_sock *dp);
 extern void dccp_feat_list_purge(struct list_head *fn_list);
 
 extern int dccp_insert_options(struct sock *sk, struct sk_buff *skb);
net/dccp/feat.c +157 -0

163 lines not on this page · raw message

net/dccp/output.c +4 -0
@@ -445,6 +445,10 @@ int dccp_connect(struct sock *sk)
 	struct sk_buff *skb;
 	struct inet_connection_sock *icsk = inet_csk(sk);
 
+	/* do not connect if feature negotiation setup fails */
+	if (dccp_feat_finalise_settings(dccp_sk(sk)))
+		return -EPROTO;
+
 	dccp_connect_init(sk);
 
 	skb = alloc_skb(sk->sk_prot->max_header, sk->sk_allocation);
net/dccp/proto.c +3 -0
@@ -282,6 +282,9 @@ static inline int dccp_listen_start(stru
 	struct dccp_sock *dp = dccp_sk(sk);
 
 	dp->dccps_role = DCCP_ROLE_LISTEN;
+	/* do not start to listen if feature negotiation setup fails */
+	if (dccp_feat_finalise_settings(dp))
+		return -EPROTO;
 	return inet_csk_listen_start(sk, backlog);
 }
 
#1 lore raw
Quoted 7 lines · Gerrit Renker

Reworked patch, updated as requested:
* removed `typedef const'
* made all initialisation explicit, using field initialisers
This increases the space somewhat, but indeed much better readability.
* Ian I have added your Acked-by as requested, but please have another look and let me know whether you are ok with this revision

I'm OK with this revision.

Signature · 3 lines
Web1: http://wand.net.nz/~iam4/
Web2: http://www.jandi.co.nz
Blog: http://iansblog.jandi.co.nz