Skip to contentSkip to conversation

: Send Reset upon Sync in state REQUEST

PATCH In review Gerrit Renker 1 participant 1 message Apr 9, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 : Send Reset upon Sync in state REQUEST

[DCCP]: Send Reset upon Sync in state REQUEST

This makes a small update so that the code corresponds to RFC 4340, 7.5.4, which has the exception that a Sync received in state REQUEST generates a Reset (not a SyncAck).

This is almost already supported by dccp_rcv_request_sent_state_process(), including the correct Reset Code number 4 ("Packet Error"); all that has to be done (and is done here) is shifting the if-statement a few lines further down.

(To test this case: replace DCCP_PKT_RESPONSE with DCCP_PKT_SYNC
in dccp_make_response.)

---
 net/dccp/input.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
net/dccp/input.c +4 -5
@@ -575,11 +575,6 @@ int dccp_rcv_state_process(struct sock *
 		return 0;
 	}
 
-	if (unlikely(dh->dccph_type = DCCP_PKT_SYNC)) {
-		dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNCACK);
-		goto discard;
-	}
-
 	switch (sk->sk_state) {
 	case DCCP_CLOSED:
 		dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION;
@@ -610,8 +605,12 @@ int dccp_rcv_state_process(struct sock *
 			sk_wake_async(sk, 0, POLL_OUT);
 			break;
 		}
+	} else if (unlikely(dh->dccph_type = DCCP_PKT_SYNC)) {
+		dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNCACK);
+		goto discard;
 	}
 
+
 	if (!queued) {
 discard:
 		__kfree_skb(skb);