Skip to content

Commit 991d927

Browse files
Gerrit Renkerdavem330
authored andcommitted
dccp: Integration of dynamic feature activation - part 3 (client side)
This integrates feature-activation in the client: 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 - changed to use the reset code supplied by dccp_parse_options(). 2. When feature negotiation fails, the socket should be marked as not usable, so that the application is notified that an error occurred. This is achieved by a new label 'unable_to_proceed': generating an error code of `Aborted', setting the socket state to CLOSED, returning with ECOMM in sk_err. 3. 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: Gerrit Renker <gerrit@erg.abdn.ac.uk> Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 192b27f commit 991d927

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

‎net/dccp/input.c‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,13 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
421421
goto out_invalid_packet;
422422
}
423423

424+
/*
425+
* If option processing (Step 8) failed, return 1 here so that
426+
* dccp_v4_do_rcv() sends a Reset. The Reset code depends on
427+
* the option type and is set in dccp_parse_options().
428+
*/
424429
if (dccp_parse_options(sk, NULL, skb))
425-
goto out_invalid_packet;
430+
return 1;
426431

427432
/* Obtain usec RTT sample from SYN exchange (used by CCID 3) */
428433
if (likely(dp->dccps_options_received.dccpor_timestamp_echo))
@@ -475,6 +480,15 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
475480
*/
476481
dccp_set_state(sk, DCCP_PARTOPEN);
477482

483+
/*
484+
* If feature negotiation was successful, activate features now;
485+
* an activation failure means that this host could not activate
486+
* one ore more features (e.g. insufficient memory), which would
487+
* leave at least one feature in an undefined state.
488+
*/
489+
if (dccp_feat_activate_values(sk, &dp->dccps_featneg))
490+
goto unable_to_proceed;
491+
478492
/* Make sure socket is routed, for correct metrics. */
479493
icsk->icsk_af_ops->rebuild_header(sk);
480494

@@ -509,6 +523,16 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
509523
/* dccp_v4_do_rcv will send a reset */
510524
DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR;
511525
return 1;
526+
527+
unable_to_proceed:
528+
DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_ABORTED;
529+
/*
530+
* We mark this socket as no longer usable, so that the loop in
531+
* dccp_sendmsg() terminates and the application gets notified.
532+
*/
533+
dccp_set_state(sk, DCCP_CLOSED);
534+
sk->sk_err = ECOMM;
535+
return 1;
512536
}
513537

514538
static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
@@ -600,7 +624,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
600624
return 1;
601625
}
602626

603-
if (sk->sk_state != DCCP_REQUESTING) {
627+
if (sk->sk_state != DCCP_REQUESTING && sk->sk_state != DCCP_RESPOND) {
604628
if (dccp_check_seqno(sk, skb))
605629
goto discard;
606630

@@ -665,8 +689,6 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
665689
return 1;
666690

667691
case DCCP_REQUESTING:
668-
/* FIXME: do congestion control initialization */
669-
670692
queued = dccp_rcv_request_sent_state_process(sk, skb, dh, len);
671693
if (queued >= 0)
672694
return queued;

0 commit comments

Comments
 (0)