aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/options.c
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:30:19 -0400
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:45:29 -0400
commitf8a644c07e6f38b2c3cbaf99990e867d670d207b (patch)
treef73051f64757db74135e538c4643a1d305a7fa0b /net/dccp/options.c
parent0ef118a017919cd661cf294811d1889ac556ee80 (diff)
dccp: Integrate feature-negotiation insertion code
The patch implements insertion of feature negotiation at the server (listening and request socket) and the client (connecting socket). In dccp_insert_options(), several statements have been grouped together now to achieve (I hope) better efficiency by reducing the number of tests each packet has to go through: - Ack Vectors are sent if the packet is neither a Data or a Request packet; - a previous issue is corrected - feature negotiation options are allowed on DataAck packets (5.8). Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Diffstat (limited to 'net/dccp/options.c')
-rw-r--r--net/dccp/options.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/net/dccp/options.c b/net/dccp/options.c
index bfa1cb8f3ef1..0e277114cb23 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -554,11 +554,25 @@ int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
554 dccp_insert_option_ndp(sk, skb)) 554 dccp_insert_option_ndp(sk, skb))
555 return -1; 555 return -1;
556 556
557 if (!dccp_packet_without_ack(skb)) { 557 if (DCCP_SKB_CB(skb)->dccpd_type != DCCP_PKT_DATA) {
558 if (dmsk->dccpms_send_ack_vector && 558
559 dccp_ackvec_pending(dp->dccps_hc_rx_ackvec) && 559 /* Feature Negotiation */
560 dccp_insert_option_ackvec(sk, skb)) 560 if (dccp_feat_insert_opts(dp, NULL, skb))
561 return -1; 561 return -1;
562
563 if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_REQUEST) {
564 /*
565 * Obtain RTT sample from Request/Response exchange.
566 * This is currently used in CCID 3 initialisation.
567 */
568 if (dccp_insert_option_timestamp(sk, skb))
569 return -1;
570
571 } else if (dmsk->dccpms_send_ack_vector &&
572 dccp_ackvec_pending(dp->dccps_hc_rx_ackvec) &&
573 dccp_insert_option_ackvec(sk, skb)) {
574 return -1;
575 }
562 } 576 }
563 577
564 if (dp->dccps_hc_rx_insert_options) { 578 if (dp->dccps_hc_rx_insert_options) {
@@ -567,14 +581,6 @@ int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
567 dp->dccps_hc_rx_insert_options = 0; 581 dp->dccps_hc_rx_insert_options = 0;
568 } 582 }
569 583
570 /*
571 * Obtain RTT sample from Request/Response exchange.
572 * This is currently used in CCID 3 initialisation.
573 */
574 if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_REQUEST &&
575 dccp_insert_option_timestamp(sk, skb))
576 return -1;
577
578 if (dp->dccps_timestamp_echo != 0 && 584 if (dp->dccps_timestamp_echo != 0 &&
579 dccp_insert_option_timestamp_echo(dp, NULL, skb)) 585 dccp_insert_option_timestamp_echo(dp, NULL, skb))
580 return -1; 586 return -1;
@@ -587,6 +593,9 @@ int dccp_insert_options_rsk(struct dccp_request_sock *dreq, struct sk_buff *skb)
587{ 593{
588 DCCP_SKB_CB(skb)->dccpd_opt_len = 0; 594 DCCP_SKB_CB(skb)->dccpd_opt_len = 0;
589 595
596 if (dccp_feat_insert_opts(NULL, dreq, skb))
597 return -1;
598
590 if (dreq->dreq_timestamp_echo != 0 && 599 if (dreq->dreq_timestamp_echo != 0 &&
591 dccp_insert_option_timestamp_echo(NULL, dreq, skb)) 600 dccp_insert_option_timestamp_echo(NULL, dreq, skb))
592 return -1; 601 return -1;