4 * An implementation of the DCCP protocol
5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
13 #include <linux/dccp.h>
14 #include <linux/skbuff.h>
22 /* rate-limit for syncs in reply to sequence-invalid packets; RFC 4340, 7.5.4 */
23 int sysctl_dccp_sync_ratelimit __read_mostly = HZ / 8;
25 static void dccp_fin(struct sock *sk, struct sk_buff *skb)
27 sk->sk_shutdown |= RCV_SHUTDOWN;
28 sock_set_flag(sk, SOCK_DONE);
29 __skb_pull(skb, dccp_hdr(skb)->dccph_doff * 4);
30 __skb_queue_tail(&sk->sk_receive_queue, skb);
31 skb_set_owner_r(skb, sk);
32 sk->sk_data_ready(sk, 0);
35 static int dccp_rcv_close(struct sock *sk, struct sk_buff *skb)
39 switch (sk->sk_state) {
41 * We ignore Close when received in one of the following states:
42 * - CLOSED (may be a late or duplicate packet)
43 * - PASSIVE_CLOSEREQ (the peer has sent a CloseReq earlier)
44 * - RESPOND (already handled by dccp_check_req)
48 * Simultaneous-close: receiving a Close after sending one. This
49 * can happen if both client and server perform active-close and
50 * will result in an endless ping-pong of crossing and retrans-
51 * mitted Close packets, which only terminates when one of the
52 * nodes times out (min. 64 seconds). Quicker convergence can be
53 * achieved when one of the nodes acts as tie-breaker.
54 * This is ok as both ends are done with data transfer and each
55 * end is just waiting for the other to acknowledge termination.
57 if (dccp_sk(sk)->dccps_role != DCCP_ROLE_CLIENT)
61 case DCCP_ACTIVE_CLOSEREQ:
62 dccp_send_reset(sk, DCCP_RESET_CODE_CLOSED);
67 /* Give waiting application a chance to read pending data */
70 dccp_set_state(sk, DCCP_PASSIVE_CLOSE);
72 case DCCP_PASSIVE_CLOSE:
74 * Retransmitted Close: we have already enqueued the first one.
76 sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP);
81 static int dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
86 * Step 7: Check for unexpected packet types
87 * If (S.is_server and P.type == CloseReq)
88 * Send Sync packet acknowledging P.seqno
89 * Drop packet and return
91 if (dccp_sk(sk)->dccps_role != DCCP_ROLE_CLIENT) {
92 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, DCCP_PKT_SYNC);
96 /* Step 13: process relevant Client states < CLOSEREQ */
97 switch (sk->sk_state) {
99 dccp_send_close(sk, 0);
100 dccp_set_state(sk, DCCP_CLOSING);
104 /* Give waiting application a chance to read pending data */
107 dccp_set_state(sk, DCCP_PASSIVE_CLOSEREQ);
109 case DCCP_PASSIVE_CLOSEREQ:
110 sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP);
115 static u8 dccp_reset_code_convert(const u8 code)
117 const u8 error_code[] = {
118 [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */
119 [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */
120 [DCCP_RESET_CODE_ABORTED] = ECONNRESET,
122 [DCCP_RESET_CODE_NO_CONNECTION] = ECONNREFUSED,
123 [DCCP_RESET_CODE_CONNECTION_REFUSED] = ECONNREFUSED,
124 [DCCP_RESET_CODE_TOO_BUSY] = EUSERS,
125 [DCCP_RESET_CODE_AGGRESSION_PENALTY] = EDQUOT,
127 [DCCP_RESET_CODE_PACKET_ERROR] = ENOMSG,
128 [DCCP_RESET_CODE_BAD_INIT_COOKIE] = EBADR,
129 [DCCP_RESET_CODE_BAD_SERVICE_CODE] = EBADRQC,
130 [DCCP_RESET_CODE_OPTION_ERROR] = EILSEQ,
131 [DCCP_RESET_CODE_MANDATORY_ERROR] = EOPNOTSUPP,
134 return code >= DCCP_MAX_RESET_CODES ? 0 : error_code[code];
137 static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb)
139 u8 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code);
143 /* Queue the equivalent of TCP fin so that dccp_recvmsg exits the loop */
146 if (err && !sock_flag(sk, SOCK_DEAD))
147 sk_wake_async(sk, SOCK_WAKE_IO, POLL_ERR);
148 dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
151 static void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb)
153 struct dccp_sock *dp = dccp_sk(sk);
155 if (dccp_msk(sk)->dccpms_send_ack_vector)
156 dccp_ackvec_check_rcv_ackno(dp->dccps_hc_rx_ackvec, sk,
157 DCCP_SKB_CB(skb)->dccpd_ack_seq);
160 static void dccp_deliver_input_to_ccids(struct sock *sk, struct sk_buff *skb)
162 const struct dccp_sock *dp = dccp_sk(sk);
164 /* Don't deliver to RX CCID when node has shut down read end. */
165 if (!(sk->sk_shutdown & RCV_SHUTDOWN))
166 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
168 * Until the TX queue has been drained, we can not honour SHUT_WR, since
169 * we need received feedback as input to adjust congestion control.
171 if (sk->sk_write_queue.qlen > 0 || !(sk->sk_shutdown & SEND_SHUTDOWN))
172 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
175 static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
177 const struct dccp_hdr *dh = dccp_hdr(skb);
178 struct dccp_sock *dp = dccp_sk(sk);
179 u64 lswl, lawl, seqno = DCCP_SKB_CB(skb)->dccpd_seq,
180 ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq;
183 * Step 5: Prepare sequence numbers for Sync
184 * If P.type == Sync or P.type == SyncAck,
185 * If S.AWL <= P.ackno <= S.AWH and P.seqno >= S.SWL,
186 * / * P is valid, so update sequence number variables
187 * accordingly. After this update, P will pass the tests
188 * in Step 6. A SyncAck is generated if necessary in
190 * Update S.GSR, S.SWL, S.SWH
192 * Drop packet and return
194 if (dh->dccph_type == DCCP_PKT_SYNC ||
195 dh->dccph_type == DCCP_PKT_SYNCACK) {
196 if (between48(ackno, dp->dccps_awl, dp->dccps_awh) &&
197 dccp_delta_seqno(dp->dccps_swl, seqno) >= 0)
198 dccp_update_gsr(sk, seqno);
204 * Step 6: Check sequence numbers
205 * Let LSWL = S.SWL and LAWL = S.AWL
206 * If P.type == CloseReq or P.type == Close or P.type == Reset,
207 * LSWL := S.GSR + 1, LAWL := S.GAR
208 * If LSWL <= P.seqno <= S.SWH
209 * and (P.ackno does not exist or LAWL <= P.ackno <= S.AWH),
210 * Update S.GSR, S.SWL, S.SWH
214 lswl = dp->dccps_swl;
215 lawl = dp->dccps_awl;
217 if (dh->dccph_type == DCCP_PKT_CLOSEREQ ||
218 dh->dccph_type == DCCP_PKT_CLOSE ||
219 dh->dccph_type == DCCP_PKT_RESET) {
220 lswl = ADD48(dp->dccps_gsr, 1);
221 lawl = dp->dccps_gar;
224 if (between48(seqno, lswl, dp->dccps_swh) &&
225 (ackno == DCCP_PKT_WITHOUT_ACK_SEQ ||
226 between48(ackno, lawl, dp->dccps_awh))) {
227 dccp_update_gsr(sk, seqno);
229 if (dh->dccph_type != DCCP_PKT_SYNC &&
230 (ackno != DCCP_PKT_WITHOUT_ACK_SEQ))
231 dp->dccps_gar = ackno;
233 unsigned long now = jiffies;
235 * Step 6: Check sequence numbers
237 * If P.type == Reset,
238 * Send Sync packet acknowledging S.GSR
240 * Send Sync packet acknowledging P.seqno
241 * Drop packet and return
243 * These Syncs are rate-limited as per RFC 4340, 7.5.4:
244 * at most 1 / (dccp_sync_rate_limit * HZ) Syncs per second.
246 if (time_before(now, (dp->dccps_rate_last +
247 sysctl_dccp_sync_ratelimit)))
250 DCCP_WARN("DCCP: Step 6 failed for %s packet, "
251 "(LSWL(%llu) <= P.seqno(%llu) <= S.SWH(%llu)) and "
252 "(P.ackno %s or LAWL(%llu) <= P.ackno(%llu) <= S.AWH(%llu), "
253 "sending SYNC...\n", dccp_packet_name(dh->dccph_type),
254 (unsigned long long) lswl, (unsigned long long) seqno,
255 (unsigned long long) dp->dccps_swh,
256 (ackno == DCCP_PKT_WITHOUT_ACK_SEQ) ? "doesn't exist"
258 (unsigned long long) lawl, (unsigned long long) ackno,
259 (unsigned long long) dp->dccps_awh);
261 dp->dccps_rate_last = now;
263 if (dh->dccph_type == DCCP_PKT_RESET)
264 seqno = dp->dccps_gsr;
265 dccp_send_sync(sk, seqno, DCCP_PKT_SYNC);
272 static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
273 const struct dccp_hdr *dh, const unsigned len)
275 struct dccp_sock *dp = dccp_sk(sk);
277 switch (dccp_hdr(skb)->dccph_type) {
278 case DCCP_PKT_DATAACK:
281 * FIXME: schedule DATA_DROPPED (RFC 4340, 11.7.2) if and when
282 * - sk_shutdown == RCV_SHUTDOWN, use Code 1, "Not Listening"
283 * - sk_receive_queue is full, use Code 2, "Receive Buffer"
285 __skb_pull(skb, dh->dccph_doff * 4);
286 __skb_queue_tail(&sk->sk_receive_queue, skb);
287 skb_set_owner_r(skb, sk);
288 sk->sk_data_ready(sk, 0);
294 * Step 9: Process Reset
295 * If P.type == Reset,
296 * Tear down connection
297 * S.state := TIMEWAIT
299 * Drop packet and return
301 dccp_rcv_reset(sk, skb);
303 case DCCP_PKT_CLOSEREQ:
304 if (dccp_rcv_closereq(sk, skb))
308 if (dccp_rcv_close(sk, skb))
311 case DCCP_PKT_REQUEST:
313 * or (S.is_server and P.type == Response)
314 * or (S.is_client and P.type == Request)
315 * or (S.state >= OPEN and P.type == Request
316 * and P.seqno >= S.OSR)
317 * or (S.state >= OPEN and P.type == Response
318 * and P.seqno >= S.OSR)
319 * or (S.state == RESPOND and P.type == Data),
320 * Send Sync packet acknowledging P.seqno
321 * Drop packet and return
323 if (dp->dccps_role != DCCP_ROLE_LISTEN)
326 case DCCP_PKT_RESPONSE:
327 if (dp->dccps_role != DCCP_ROLE_CLIENT)
330 if (dccp_delta_seqno(dp->dccps_osr,
331 DCCP_SKB_CB(skb)->dccpd_seq) >= 0) {
333 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq,
338 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq,
341 * From RFC 4340, sec. 5.7
343 * As with DCCP-Ack packets, DCCP-Sync and DCCP-SyncAck packets
344 * MAY have non-zero-length application data areas, whose
345 * contents receivers MUST ignore.
350 DCCP_INC_STATS_BH(DCCP_MIB_INERRS);
356 int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
357 const struct dccp_hdr *dh, const unsigned len)
359 struct dccp_sock *dp = dccp_sk(sk);
361 if (dccp_check_seqno(sk, skb))
364 if (dccp_parse_options(sk, skb))
367 if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
368 dccp_event_ack_recv(sk, skb);
370 if (dccp_msk(sk)->dccpms_send_ack_vector &&
371 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
372 DCCP_SKB_CB(skb)->dccpd_seq,
373 DCCP_ACKVEC_STATE_RECEIVED))
375 dccp_deliver_input_to_ccids(sk, skb);
377 return __dccp_rcv_established(sk, skb, dh, len);
383 EXPORT_SYMBOL_GPL(dccp_rcv_established);
385 static int dccp_rcv_request_sent_state_process(struct sock *sk,
387 const struct dccp_hdr *dh,
391 * Step 4: Prepare sequence numbers in REQUEST
392 * If S.state == REQUEST,
393 * If (P.type == Response or P.type == Reset)
394 * and S.AWL <= P.ackno <= S.AWH,
395 * / * Set sequence number variables corresponding to the
396 * other endpoint, so P will pass the tests in Step 6 * /
397 * Set S.GSR, S.ISR, S.SWL, S.SWH
398 * / * Response processing continues in Step 10; Reset
399 * processing continues in Step 9 * /
401 if (dh->dccph_type == DCCP_PKT_RESPONSE) {
402 const struct inet_connection_sock *icsk = inet_csk(sk);
403 struct dccp_sock *dp = dccp_sk(sk);
404 long tstamp = dccp_timestamp();
406 /* Stop the REQUEST timer */
407 inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS);
408 BUG_TRAP(sk->sk_send_head != NULL);
409 __kfree_skb(sk->sk_send_head);
410 sk->sk_send_head = NULL;
412 if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
413 dp->dccps_awl, dp->dccps_awh)) {
414 dccp_pr_debug("invalid ackno: S.AWL=%llu, "
415 "P.ackno=%llu, S.AWH=%llu \n",
416 (unsigned long long)dp->dccps_awl,
417 (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq,
418 (unsigned long long)dp->dccps_awh);
419 goto out_invalid_packet;
422 if (dccp_parse_options(sk, skb))
423 goto out_invalid_packet;
425 /* Obtain usec RTT sample from SYN exchange (used by CCID 3) */
426 if (likely(dp->dccps_options_received.dccpor_timestamp_echo))
427 dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * (tstamp -
428 dp->dccps_options_received.dccpor_timestamp_echo));
430 if (dccp_msk(sk)->dccpms_send_ack_vector &&
431 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
432 DCCP_SKB_CB(skb)->dccpd_seq,
433 DCCP_ACKVEC_STATE_RECEIVED))
434 goto out_invalid_packet; /* FIXME: change error code */
436 dp->dccps_isr = DCCP_SKB_CB(skb)->dccpd_seq;
437 dccp_update_gsr(sk, dp->dccps_isr);
439 * SWL and AWL are initially adjusted so that they are not less than
440 * the initial Sequence Numbers received and sent, respectively:
441 * SWL := max(GSR + 1 - floor(W/4), ISR),
442 * AWL := max(GSS - W' + 1, ISS).
443 * These adjustments MUST be applied only at the beginning of the
446 * AWL was adjusted in dccp_v4_connect -acme
448 dccp_set_seqno(&dp->dccps_swl,
449 max48(dp->dccps_swl, dp->dccps_isr));
451 dccp_sync_mss(sk, icsk->icsk_pmtu_cookie);
454 * Step 10: Process REQUEST state (second part)
455 * If S.state == REQUEST,
456 * / * If we get here, P is a valid Response from the
457 * server (see Step 4), and we should move to
458 * PARTOPEN state. PARTOPEN means send an Ack,
459 * don't send Data packets, retransmit Acks
460 * periodically, and always include any Init Cookie
461 * from the Response * /
462 * S.state := PARTOPEN
464 * Continue with S.state == PARTOPEN
465 * / * Step 12 will send the Ack completing the
466 * three-way handshake * /
468 dccp_set_state(sk, DCCP_PARTOPEN);
470 /* Make sure socket is routed, for correct metrics. */
471 icsk->icsk_af_ops->rebuild_header(sk);
473 if (!sock_flag(sk, SOCK_DEAD)) {
474 sk->sk_state_change(sk);
475 sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT);
478 if (sk->sk_write_pending || icsk->icsk_ack.pingpong ||
479 icsk->icsk_accept_queue.rskq_defer_accept) {
480 /* Save one ACK. Data will be ready after
481 * several ticks, if write_pending is set.
483 * It may be deleted, but with this feature tcpdumps
484 * look so _wonderfully_ clever, that I was not able
485 * to stand against the temptation 8) --ANK
488 * OK, in DCCP we can as well do a similar trick, its
489 * even in the draft, but there is no need for us to
490 * schedule an ack here, as dccp_sendmsg does this for
491 * us, also stated in the draft. -acme
501 /* dccp_v4_do_rcv will send a reset */
502 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR;
506 static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
508 const struct dccp_hdr *dh,
513 switch (dh->dccph_type) {
515 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
518 if (sk->sk_state == DCCP_RESPOND)
520 case DCCP_PKT_DATAACK:
523 * FIXME: we should be reseting the PARTOPEN (DELACK) timer
524 * here but only if we haven't used the DELACK timer for
525 * something else, like sending a delayed ack for a TIMESTAMP
526 * echo, etc, for now were not clearing it, sending an extra
527 * ACK when there is nothing else to do in DELACK is not a big
531 /* Stop the PARTOPEN timer */
532 if (sk->sk_state == DCCP_PARTOPEN)
533 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
535 dccp_sk(sk)->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq;
536 dccp_set_state(sk, DCCP_OPEN);
538 if (dh->dccph_type == DCCP_PKT_DATAACK ||
539 dh->dccph_type == DCCP_PKT_DATA) {
540 __dccp_rcv_established(sk, skb, dh, len);
541 queued = 1; /* packet was queued
542 (by __dccp_rcv_established) */
550 int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
551 struct dccp_hdr *dh, unsigned len)
553 struct dccp_sock *dp = dccp_sk(sk);
554 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
555 const int old_state = sk->sk_state;
559 * Step 3: Process LISTEN state
561 * If S.state == LISTEN,
562 * If P.type == Request or P contains a valid Init Cookie option,
563 * (* Must scan the packet's options to check for Init
564 * Cookies. Only Init Cookies are processed here,
565 * however; other options are processed in Step 8. This
566 * scan need only be performed if the endpoint uses Init
568 * (* Generate a new socket and switch to that socket *)
569 * Set S := new socket for this port pair
571 * Choose S.ISS (initial seqno) or set from Init Cookies
572 * Initialize S.GAR := S.ISS
573 * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init
574 * Cookies Continue with S.state == RESPOND
575 * (* A Response packet will be generated in Step 11 *)
577 * Generate Reset(No Connection) unless P.type == Reset
578 * Drop packet and return
580 if (sk->sk_state == DCCP_LISTEN) {
581 if (dh->dccph_type == DCCP_PKT_REQUEST) {
582 if (inet_csk(sk)->icsk_af_ops->conn_request(sk,
586 /* FIXME: do congestion control initialization */
589 if (dh->dccph_type == DCCP_PKT_RESET)
592 /* Caller (dccp_v4_do_rcv) will send Reset */
593 dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION;
597 if (sk->sk_state != DCCP_REQUESTING) {
598 if (dccp_check_seqno(sk, skb))
602 * Step 8: Process options and mark acknowledgeable
604 if (dccp_parse_options(sk, skb))
607 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
608 dccp_event_ack_recv(sk, skb);
610 if (dccp_msk(sk)->dccpms_send_ack_vector &&
611 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
612 DCCP_SKB_CB(skb)->dccpd_seq,
613 DCCP_ACKVEC_STATE_RECEIVED))
616 dccp_deliver_input_to_ccids(sk, skb);
620 * Step 9: Process Reset
621 * If P.type == Reset,
622 * Tear down connection
623 * S.state := TIMEWAIT
625 * Drop packet and return
627 if (dh->dccph_type == DCCP_PKT_RESET) {
628 dccp_rcv_reset(sk, skb);
631 * Step 7: Check for unexpected packet types
632 * If (S.is_server and P.type == Response)
633 * or (S.is_client and P.type == Request)
634 * or (S.state == RESPOND and P.type == Data),
635 * Send Sync packet acknowledging P.seqno
636 * Drop packet and return
638 } else if ((dp->dccps_role != DCCP_ROLE_CLIENT &&
639 dh->dccph_type == DCCP_PKT_RESPONSE) ||
640 (dp->dccps_role == DCCP_ROLE_CLIENT &&
641 dh->dccph_type == DCCP_PKT_REQUEST) ||
642 (sk->sk_state == DCCP_RESPOND &&
643 dh->dccph_type == DCCP_PKT_DATA)) {
644 dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNC);
646 } else if (dh->dccph_type == DCCP_PKT_CLOSEREQ) {
647 if (dccp_rcv_closereq(sk, skb))
650 } else if (dh->dccph_type == DCCP_PKT_CLOSE) {
651 if (dccp_rcv_close(sk, skb))
656 switch (sk->sk_state) {
658 dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION;
661 case DCCP_REQUESTING:
662 /* FIXME: do congestion control initialization */
664 queued = dccp_rcv_request_sent_state_process(sk, skb, dh, len);
673 queued = dccp_rcv_respond_partopen_state_process(sk, skb,
678 if (dh->dccph_type == DCCP_PKT_ACK ||
679 dh->dccph_type == DCCP_PKT_DATAACK) {
682 sk->sk_state_change(sk);
683 sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT);
686 } else if (unlikely(dh->dccph_type == DCCP_PKT_SYNC)) {
687 dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNCACK);
698 EXPORT_SYMBOL_GPL(dccp_rcv_state_process);
701 * dccp_sample_rtt - Validate and finalise computation of RTT sample
702 * @delta: number of microseconds between packet and acknowledgment
703 * The routine is kept generic to work in different contexts. It should be
704 * called immediately when the ACK used for the RTT sample arrives.
706 u32 dccp_sample_rtt(struct sock *sk, long delta)
708 /* dccpor_elapsed_time is either zeroed out or set and > 0 */
709 delta -= dccp_sk(sk)->dccps_options_received.dccpor_elapsed_time * 10;
711 if (unlikely(delta <= 0)) {
712 DCCP_WARN("unusable RTT sample %ld, using min\n", delta);
713 return DCCP_SANE_RTT_MIN;
715 if (unlikely(delta > DCCP_SANE_RTT_MAX)) {
716 DCCP_WARN("RTT sample %ld too large, using max\n", delta);
717 return DCCP_SANE_RTT_MAX;
723 EXPORT_SYMBOL_GPL(dccp_sample_rtt);