diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-07-13 06:51:40 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-07-13 06:51:40 -0400 |
commit | 5b5d0e704880addfd979c262e6441f126708539c (patch) | |
tree | 1b3bff6cd378c858ab245de3a40c3510d4ba4745 | |
parent | 2013c7e35aeba39777f9b3eef8a70207b3931152 (diff) |
dccp: Upgrade NDP count from 3 to 6 bytes
RFC 4340, 7.7 specifies up to 6 bytes for the NDP Count option, whereas the code
is currently limited to up to 3 bytes. This seems to be a relict of an earlier
draft version and is brought up to date by the patch.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
-rw-r--r-- | include/linux/dccp.h | 6 | ||||
-rw-r--r-- | net/dccp/ccids/ccid3.c | 2 | ||||
-rw-r--r-- | net/dccp/ccids/lib/packet_history.c | 6 | ||||
-rw-r--r-- | net/dccp/ccids/lib/packet_history.h | 6 | ||||
-rw-r--r-- | net/dccp/options.c | 14 |
5 files changed, 17 insertions, 17 deletions
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index aa0737019e37..6080449fbec9 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -364,8 +364,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | |||
364 | /* FIXME: for now we're default to 1 but it should really be 0 */ | 364 | /* FIXME: for now we're default to 1 but it should really be 0 */ |
365 | #define DCCPF_INITIAL_SEND_NDP_COUNT 1 | 365 | #define DCCPF_INITIAL_SEND_NDP_COUNT 1 |
366 | 366 | ||
367 | #define DCCP_NDP_LIMIT 0xFFFFFF | ||
368 | |||
369 | /** | 367 | /** |
370 | * struct dccp_minisock - Minimal DCCP connection representation | 368 | * struct dccp_minisock - Minimal DCCP connection representation |
371 | * | 369 | * |
@@ -437,7 +435,7 @@ extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | |||
437 | struct sk_buff *skb); | 435 | struct sk_buff *skb); |
438 | 436 | ||
439 | struct dccp_options_received { | 437 | struct dccp_options_received { |
440 | u32 dccpor_ndp; /* only 24 bits */ | 438 | u64 dccpor_ndp:48; |
441 | u32 dccpor_timestamp; | 439 | u32 dccpor_timestamp; |
442 | u32 dccpor_timestamp_echo; | 440 | u32 dccpor_timestamp_echo; |
443 | u32 dccpor_elapsed_time; | 441 | u32 dccpor_elapsed_time; |
@@ -533,7 +531,7 @@ struct dccp_sock { | |||
533 | __u16 dccps_r_ack_ratio; | 531 | __u16 dccps_r_ack_ratio; |
534 | __u16 dccps_pcslen; | 532 | __u16 dccps_pcslen; |
535 | __u16 dccps_pcrlen; | 533 | __u16 dccps_pcrlen; |
536 | unsigned long dccps_ndp_count; | 534 | __u64 dccps_ndp_count:48; |
537 | unsigned long dccps_rate_last; | 535 | unsigned long dccps_rate_last; |
538 | struct dccp_minisock dccps_minisock; | 536 | struct dccp_minisock dccps_minisock; |
539 | struct dccp_ackvec *dccps_hc_rx_ackvec; | 537 | struct dccp_ackvec *dccps_hc_rx_ackvec; |
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index a1929f33d703..523db262c18f 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -794,7 +794,7 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
794 | { | 794 | { |
795 | struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); | 795 | struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); |
796 | enum ccid3_fback_type do_feedback = CCID3_FBACK_NONE; | 796 | enum ccid3_fback_type do_feedback = CCID3_FBACK_NONE; |
797 | const u32 ndp = dccp_sk(sk)->dccps_options_received.dccpor_ndp; | 797 | const u64 ndp = dccp_sk(sk)->dccps_options_received.dccpor_ndp; |
798 | const bool is_data_packet = dccp_data_packet(skb); | 798 | const bool is_data_packet = dccp_data_packet(skb); |
799 | 799 | ||
800 | if (unlikely(hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)) { | 800 | if (unlikely(hcrx->ccid3hcrx_state == TFRC_RSTATE_NO_DATA)) { |
diff --git a/net/dccp/ccids/lib/packet_history.c b/net/dccp/ccids/lib/packet_history.c index 8b5c41ec7ee1..712930564c38 100644 --- a/net/dccp/ccids/lib/packet_history.c +++ b/net/dccp/ccids/lib/packet_history.c | |||
@@ -153,7 +153,7 @@ void tfrc_rx_packet_history_exit(void) | |||
153 | 153 | ||
154 | static inline void tfrc_rx_hist_entry_from_skb(struct tfrc_rx_hist_entry *entry, | 154 | static inline void tfrc_rx_hist_entry_from_skb(struct tfrc_rx_hist_entry *entry, |
155 | const struct sk_buff *skb, | 155 | const struct sk_buff *skb, |
156 | const u32 ndp) | 156 | const u64 ndp) |
157 | { | 157 | { |
158 | const struct dccp_hdr *dh = dccp_hdr(skb); | 158 | const struct dccp_hdr *dh = dccp_hdr(skb); |
159 | 159 | ||
@@ -166,7 +166,7 @@ static inline void tfrc_rx_hist_entry_from_skb(struct tfrc_rx_hist_entry *entry, | |||
166 | 166 | ||
167 | void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, | 167 | void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, |
168 | const struct sk_buff *skb, | 168 | const struct sk_buff *skb, |
169 | const u32 ndp) | 169 | const u64 ndp) |
170 | { | 170 | { |
171 | struct tfrc_rx_hist_entry *entry = tfrc_rx_hist_last_rcv(h); | 171 | struct tfrc_rx_hist_entry *entry = tfrc_rx_hist_last_rcv(h); |
172 | 172 | ||
@@ -356,7 +356,7 @@ static void __three_after_loss(struct tfrc_rx_hist *h) | |||
356 | */ | 356 | */ |
357 | int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, | 357 | int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, |
358 | struct tfrc_loss_hist *lh, | 358 | struct tfrc_loss_hist *lh, |
359 | struct sk_buff *skb, u32 ndp, | 359 | struct sk_buff *skb, const u64 ndp, |
360 | u32 (*calc_first_li)(struct sock *), struct sock *sk) | 360 | u32 (*calc_first_li)(struct sock *), struct sock *sk) |
361 | { | 361 | { |
362 | int is_new_loss = 0; | 362 | int is_new_loss = 0; |
diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h index c7eeda49cb20..6976156cda3c 100644 --- a/net/dccp/ccids/lib/packet_history.h +++ b/net/dccp/ccids/lib/packet_history.h | |||
@@ -64,7 +64,7 @@ struct tfrc_rx_hist_entry { | |||
64 | u64 tfrchrx_seqno:48, | 64 | u64 tfrchrx_seqno:48, |
65 | tfrchrx_ccval:4, | 65 | tfrchrx_ccval:4, |
66 | tfrchrx_type:4; | 66 | tfrchrx_type:4; |
67 | u32 tfrchrx_ndp; /* In fact it is from 8 to 24 bits */ | 67 | u64 tfrchrx_ndp:48; |
68 | ktime_t tfrchrx_tstamp; | 68 | ktime_t tfrchrx_tstamp; |
69 | }; | 69 | }; |
70 | 70 | ||
@@ -145,14 +145,14 @@ static inline int tfrc_rx_hist_new_loss_indicated(struct tfrc_rx_hist *h, | |||
145 | } | 145 | } |
146 | 146 | ||
147 | extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, | 147 | extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, |
148 | const struct sk_buff *skb, const u32 ndp); | 148 | const struct sk_buff *skb, const u64 ndp); |
149 | 149 | ||
150 | extern int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb); | 150 | extern int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb); |
151 | 151 | ||
152 | struct tfrc_loss_hist; | 152 | struct tfrc_loss_hist; |
153 | extern int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, | 153 | extern int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, |
154 | struct tfrc_loss_hist *lh, | 154 | struct tfrc_loss_hist *lh, |
155 | struct sk_buff *skb, u32 ndp, | 155 | struct sk_buff *skb, const u64 ndp, |
156 | u32 (*first_li)(struct sock *sk), | 156 | u32 (*first_li)(struct sock *sk), |
157 | struct sock *sk); | 157 | struct sock *sk); |
158 | extern u32 tfrc_rx_hist_sample_rtt(struct tfrc_rx_hist *h, | 158 | extern u32 tfrc_rx_hist_sample_rtt(struct tfrc_rx_hist *h, |
diff --git a/net/dccp/options.c b/net/dccp/options.c index 43bc24e761d0..dc7c158a2f4b 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c | |||
@@ -124,12 +124,12 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | |||
124 | mandatory = 1; | 124 | mandatory = 1; |
125 | break; | 125 | break; |
126 | case DCCPO_NDP_COUNT: | 126 | case DCCPO_NDP_COUNT: |
127 | if (len > 3) | 127 | if (len > 6) |
128 | goto out_invalid_option; | 128 | goto out_invalid_option; |
129 | 129 | ||
130 | opt_recv->dccpor_ndp = dccp_decode_value_var(value, len); | 130 | opt_recv->dccpor_ndp = dccp_decode_value_var(value, len); |
131 | dccp_pr_debug("%s rx opt: NDP count=%d\n", dccp_role(sk), | 131 | dccp_pr_debug("%s opt: NDP count=%llu\n", dccp_role(sk), |
132 | opt_recv->dccpor_ndp); | 132 | (unsigned long long)opt_recv->dccpor_ndp); |
133 | break; | 133 | break; |
134 | case DCCPO_CHANGE_L: | 134 | case DCCPO_CHANGE_L: |
135 | /* fall through */ | 135 | /* fall through */ |
@@ -307,9 +307,11 @@ static void dccp_encode_value_var(const u32 value, unsigned char *to, | |||
307 | *to++ = (value & 0xFF); | 307 | *to++ = (value & 0xFF); |
308 | } | 308 | } |
309 | 309 | ||
310 | static inline int dccp_ndp_len(const int ndp) | 310 | static inline u8 dccp_ndp_len(const u64 ndp) |
311 | { | 311 | { |
312 | return likely(ndp <= 0xFF) ? 1 : ndp <= 0xFFFF ? 2 : 3; | 312 | if (likely(ndp <= 0xFF)) |
313 | return 1; | ||
314 | return likely(ndp <= USHORT_MAX) ? 2 : (ndp <= UINT_MAX ? 4 : 6); | ||
313 | } | 315 | } |
314 | 316 | ||
315 | int dccp_insert_option(struct sock *sk, struct sk_buff *skb, | 317 | int dccp_insert_option(struct sock *sk, struct sk_buff *skb, |
@@ -336,7 +338,7 @@ EXPORT_SYMBOL_GPL(dccp_insert_option); | |||
336 | static int dccp_insert_option_ndp(struct sock *sk, struct sk_buff *skb) | 338 | static int dccp_insert_option_ndp(struct sock *sk, struct sk_buff *skb) |
337 | { | 339 | { |
338 | struct dccp_sock *dp = dccp_sk(sk); | 340 | struct dccp_sock *dp = dccp_sk(sk); |
339 | int ndp = dp->dccps_ndp_count; | 341 | u64 ndp = dp->dccps_ndp_count; |
340 | 342 | ||
341 | if (dccp_non_data_packet(skb)) | 343 | if (dccp_non_data_packet(skb)) |
342 | ++dp->dccps_ndp_count; | 344 | ++dp->dccps_ndp_count; |