Skip to contentSkip to conversation

dccp: Send Confirm Options Only Once

PATCH In review Samuel Jero 2 participants 3 messages Feb 14, 2011 – Feb 26, 2011 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 dccp: Send Confirm Options Only Once

Remove Feature Negotiation Confirm Options from the list of options to send after they are sent once because such options are NOT supposed to be retransmitted and are ONLY supposed to be sent in response to a Change Option (RFC 4340 6.2).

---

Signed-off-by Samuel Jero
net/dccp/feat.c +12 -5
index 6f2bc96..ab85f23 100644
@@ -690,11 +690,18 @@ int dccp_feat_insert_opts(struct dccp_sock *dp, struct dccp_request_sock *dreq,
 			return -1;
 		if (pos->needs_mandatory && dccp_insert_option_mandatory(skb))
 			return -1;
-		/*
-		 * Enter CHANGING after transmitting the Change option (6.6.2).
-		 */
-		if (pos->state == FEAT_INITIALISING)
-			pos->state = FEAT_CHANGING;
+
+		if (opt == DCCPO_CONFIRM_R || opt == DCCPO_CONFIRM_L) {
+			/*Confirms don't get retransmitted (6.6.3)*/
+			dccp_feat_list_pop(pos);
+		} else {
+			/*
+			 * Enter CHANGING after transmitting
+			 * the Change option (6.6.2).
+			 */
+			if (pos->state == FEAT_INITIALISING)
+				pos->state = FEAT_CHANGING;
+		}
 	}
 	return 0;
 }
#1 lore raw

Quoting Samuel Jero:

| Remove Feature Negotiation Confirm Options from the list of options to
| send after they are sent once because such options are NOT supposed to
| be retransmitted and are ONLY supposed to be sent in response to a
| Change Option (RFC 4340 6.2).
| 
| --- a/net/dccp/feat.c
| +++ b/net/dccp/feat.c
| @@ -690,11 +690,18 @@ int dccp_feat_insert_opts(struct dccp_sock *dp, struct dccp_request_sock *dreq,
|  			return -1;
|  		if (pos->needs_mandatory && dccp_insert_option_mandatory(skb))
|  			return -1;
| -		/*
| -		 * Enter CHANGING after transmitting the Change option (6.6.2).
| -		 */
| -		if (pos->state = FEAT_INITIALISING)
| -			pos->state = FEAT_CHANGING;
| +
| +		if (opt = DCCPO_CONFIRM_R || opt = DCCPO_CONFIRM_L) {
| +			/*Confirms don't get retransmitted (6.6.3)*/
| +			dccp_feat_list_pop(pos);
| +		} else {
| +			/*
| +			 * Enter CHANGING after transmitting
| +			 * the Change option (6.6.2).
| +			 */
| +			if (pos->state = FEAT_INITIALISING)
| +				pos->state = FEAT_CHANGING;
| +		}

Your thinking is correct, but this needs more work.

In fact your code is almost the same as the one that had been reverted earlier:

               if (pos->state = FEAT_INITIALISING)
	               pos->state = FEAT_CHANGING;
	       else if (pos->needs_confirm && dreq = NULL)
	               dccp_feat_list_pop(pos);

where the else-if part has been removed since it lead to several bugs when packets got lost during the initial handshake. The problem is that client and server have only 3 packets to get it right, if only 1 packet gets lost, and then retransmitted, the negotiation does not complete.

( This part was only one half of the change, the other is in proto.c:dccp_set_state()

		/* Client retransmits all Confirm options until entering OPEN */
		 if (oldstate = DCCP_PARTOPEN)
                        dccp_feat_list_purge(&dccp_sk(sk)->dccps_featneg);

)

It seems to me that what you would like to do is to send Confirm options only once in established state? Then the dccp_feat_list_pop() should be state-dependent, i.e.
only apply in states > PARTOPEN. Otherwise, we will have the same bugs for the
initial feature negotiation that had already been fixed. This is documented on:

http://eden-feed.erg.abdn.ac.uk/dccp/notes/feature_negotiation/why_retransmit_confirms

Connection-state dependent handling of negotiation options is in dccp_feat_parse_options(), don't have a patch to accomplish both the above at the moment.

#2 lore raw
In reply to Samuel Jero

If a connection is in the OPEN state, then remove Feature Negotiation Confirm Options from the list of options to send after they are sent once. Confirm options are NOT supposed to be retransmitted and are ONLY supposed to be sent in response to a Change Option (RFC 4340 6.2).

When combined with feature negotiation code that would reset the connection on an feature negotiation value that didn't match the most recently sent value, this issue will cause a connection reset on the second feature negotiation for any given NN feature.

Note: Patch #3 (Don't Reset on Confirm for Old NN Feature Values), fixed the other side of this issue by ignoring values that don't match the most recent.

---

I have modified this patch to only remove confirm options when the connection is in the OPEN state. This will allow confirm options to be retransmitted during PARTOPEN to provide durability at that point.

Samuel Jero

---
Signed-off-by: Samuel Jero

net/dccp/feat.c +16 -5
@@ -690,11 +678,22 @@ int dccp_feat_insert_opts(struct dccp_sock *dp, struct dccp_request_sock *dreq,
 			return -1;
 		if (pos->needs_mandatory && dccp_insert_option_mandatory(skb))
 			return -1;
-		/*
-		 * Enter CHANGING after transmitting the Change option (6.6.2).
-		 */
-		if (pos->state == FEAT_INITIALISING)
-			pos->state = FEAT_CHANGING;
+
+		if (skb->sk->sk_state == DCCP_OPEN &&
+			(opt == DCCPO_CONFIRM_R || opt == DCCPO_CONFIRM_L)) {
+			/*
+			 * Confirms don't get retransmitted (6.6.3) once the
+			 * connection is in state OPEN
+			 */
+			dccp_feat_list_pop(pos);
+		} else {
+			/*
+			 * Enter CHANGING after transmitting the Change
+			 * option (6.6.2).
+			 */
+			if (pos->state == FEAT_INITIALISING)
+				pos->state = FEAT_CHANGING;
+		}
 	}
 	return 0;
 }