diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2007-11-24 18:32:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:54:53 -0500 |
commit | df054e1d00fdafa2e2920319df326ddb3f0d0413 (patch) | |
tree | 4c5178212391dc2b1fe0d329da5e8552bcab4a55 /net/dccp/ccids/ccid2.c | |
parent | cfbbeabc8864902c4af1c0cadf0972b352930a26 (diff) |
[CCID2]: Don't assign negative values to Ack Ratio
Since it makes not sense to assign negative values to Ack Ratio, this
patch disallows this possibility.
As a consequence, a Bug test for negative Ack Ratio values becomes obsolete.
Furthermore, a check against overflow (as Ack Ratio may not exceed 2 bytes,
due to RFC 4340, 11.3) has been added.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ccids/ccid2.c')
-rw-r--r-- | net/dccp/ccids/ccid2.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index 55522182f2fa..f18235e8ce84 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -140,7 +140,7 @@ static int ccid2_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) | |||
140 | return 1; /* XXX CCID should dequeue when ready instead of polling */ | 140 | return 1; /* XXX CCID should dequeue when ready instead of polling */ |
141 | } | 141 | } |
142 | 142 | ||
143 | static void ccid2_change_l_ack_ratio(struct sock *sk, int val) | 143 | static void ccid2_change_l_ack_ratio(struct sock *sk, u32 val) |
144 | { | 144 | { |
145 | struct dccp_sock *dp = dccp_sk(sk); | 145 | struct dccp_sock *dp = dccp_sk(sk); |
146 | /* | 146 | /* |
@@ -159,9 +159,10 @@ static void ccid2_change_l_ack_ratio(struct sock *sk, int val) | |||
159 | if (val > max) | 159 | if (val > max) |
160 | val = max; | 160 | val = max; |
161 | } | 161 | } |
162 | if (val > 0xFFFF) /* RFC 4340, 11.3 */ | ||
163 | val = 0xFFFF; | ||
162 | 164 | ||
163 | ccid2_pr_debug("changing local ack ratio to %d\n", val); | 165 | ccid2_pr_debug("changing local ack ratio to %u\n", val); |
164 | WARN_ON(val <= 0); | ||
165 | dp->dccps_l_ack_ratio = val; | 166 | dp->dccps_l_ack_ratio = val; |
166 | } | 167 | } |
167 | 168 | ||
@@ -572,7 +573,7 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
572 | hctx->ccid2hctx_rpdupack = -1; /* XXX lame */ | 573 | hctx->ccid2hctx_rpdupack = -1; /* XXX lame */ |
573 | hctx->ccid2hctx_rpseq = 0; | 574 | hctx->ccid2hctx_rpseq = 0; |
574 | 575 | ||
575 | ccid2_change_l_ack_ratio(sk, dp->dccps_l_ack_ratio << 1); | 576 | ccid2_change_l_ack_ratio(sk, 2 * dp->dccps_l_ack_ratio); |
576 | } | 577 | } |
577 | } | 578 | } |
578 | } | 579 | } |