diff options
-rw-r--r-- | net/dccp/ccids/ccid3.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 66a27b9688ca..f1b745ee9cb6 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -444,9 +444,9 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
444 | 444 | ||
445 | /* Update loss event rate */ | 445 | /* Update loss event rate */ |
446 | pinv = opt_recv->ccid3or_loss_event_rate; | 446 | pinv = opt_recv->ccid3or_loss_event_rate; |
447 | if (pinv == ~0U || pinv == 0) | 447 | if (pinv == ~0U || pinv == 0) /* see RFC 4342, 8.5 */ |
448 | hctx->ccid3hctx_p = 0; | 448 | hctx->ccid3hctx_p = 0; |
449 | else | 449 | else /* can not exceed 100% */ |
450 | hctx->ccid3hctx_p = 1000000 / pinv; | 450 | hctx->ccid3hctx_p = 1000000 / pinv; |
451 | 451 | ||
452 | dccp_timestamp(sk, &now); | 452 | dccp_timestamp(sk, &now); |
@@ -733,10 +733,15 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk) | |||
733 | /* Convert to multiples of 10us */ | 733 | /* Convert to multiples of 10us */ |
734 | hcrx->ccid3hcrx_elapsed_time = | 734 | hcrx->ccid3hcrx_elapsed_time = |
735 | timeval_delta(&now, &packet->dccphrx_tstamp) / 10; | 735 | timeval_delta(&now, &packet->dccphrx_tstamp) / 10; |
736 | |||
736 | if (hcrx->ccid3hcrx_p == 0) | 737 | if (hcrx->ccid3hcrx_p == 0) |
737 | hcrx->ccid3hcrx_pinv = ~0; | 738 | hcrx->ccid3hcrx_pinv = ~0U; /* see RFC 4342, 8.5 */ |
738 | else | 739 | else if (hcrx->ccid3hcrx_p > 1000000) { |
740 | DCCP_WARN("p (%u) > 100%%\n", hcrx->ccid3hcrx_p); | ||
741 | hcrx->ccid3hcrx_pinv = 1; /* use 100% in this case */ | ||
742 | } else | ||
739 | hcrx->ccid3hcrx_pinv = 1000000 / hcrx->ccid3hcrx_p; | 743 | hcrx->ccid3hcrx_pinv = 1000000 / hcrx->ccid3hcrx_p; |
744 | |||
740 | dp->dccps_hc_rx_insert_options = 1; | 745 | dp->dccps_hc_rx_insert_options = 1; |
741 | dccp_send_ack(sk); | 746 | dccp_send_ack(sk); |
742 | } | 747 | } |