diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-04 01:30:19 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-09-04 01:45:37 -0400 |
commit | c8bf462bc567c3dcb083ff95cc13060dd06f138c (patch) | |
tree | c612129b23db7bb8613fff4c6e2d51301bc77f65 /net/dccp/options.c | |
parent | 5a577b488f687f339dea62e7bb4f4c5793ad523f (diff) |
dccp ccid-2: Separate option parsing from CCID processing
This patch replaces an almost identical replication of code: large parts
of dccp_parse_options() re-appeared as ccid2_ackvector() in ccid2.c.
Apart from the duplication, this caused two more problems:
1. CCIDs should not need to be concerned with parsing header options;
2. one can not assume that Ack Vectors appear as a contiguous area within an
skb, it is legal to insert other options and/or padding in between. The
current code would throw an error and stop reading in such a case.
The patch provides a new data structure and associated list housekeeping.
Only small changes were necessary to integrate with CCID-2: data structure
initialisation, adapt list traversal routine, and add call to the provided
cleanup routine.
The latter also lead to fixing the following BUG: CCID-2 so far ignored
Ack Vectors on all packets other than Ack/DataAck, which is incorrect,
since Ack Vectors can be present on any packet that has an Ack field.
Details:
--------
* received Ack Vectors are parsed by dccp_parse_options() alone, which passes
the result on to the CCID-specific routine ccid_hc_tx_parse_options();
* CCIDs interested in using/decoding Ack Vector information will add code
to fetch parsed Ack Vectors via this interface;
* a data structure, `struct dccp_ackvec_parsed' is provided as interface;
* this structure arranges Ack Vectors of the same skb into a FIFO order;
* a doubly-linked list is used to keep the required FIFO code small.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/options.c')
-rw-r--r-- | net/dccp/options.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/net/dccp/options.c b/net/dccp/options.c index 791e07853a79..e5a32979d7d7 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c | |||
@@ -128,13 +128,6 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | |||
128 | if (rc) | 128 | if (rc) |
129 | goto out_featneg_failed; | 129 | goto out_featneg_failed; |
130 | break; | 130 | break; |
131 | case DCCPO_ACK_VECTOR_0: | ||
132 | case DCCPO_ACK_VECTOR_1: | ||
133 | if (dccp_packet_without_ack(skb)) /* RFC 4340, 11.4 */ | ||
134 | break; | ||
135 | dccp_pr_debug("%s Ack Vector (len=%u)\n", dccp_role(sk), | ||
136 | len); | ||
137 | break; | ||
138 | case DCCPO_TIMESTAMP: | 131 | case DCCPO_TIMESTAMP: |
139 | if (len != 4) | 132 | if (len != 4) |
140 | goto out_invalid_option; | 133 | goto out_invalid_option; |
@@ -224,6 +217,16 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | |||
224 | pkt_type, opt, value, len)) | 217 | pkt_type, opt, value, len)) |
225 | goto out_invalid_option; | 218 | goto out_invalid_option; |
226 | break; | 219 | break; |
220 | case DCCPO_ACK_VECTOR_0: | ||
221 | case DCCPO_ACK_VECTOR_1: | ||
222 | if (dccp_packet_without_ack(skb)) /* RFC 4340, 11.4 */ | ||
223 | break; | ||
224 | /* | ||
225 | * Ack vectors are processed by the TX CCID if it is | ||
226 | * interested. The RX CCID need not parse Ack Vectors, | ||
227 | * since it is only interested in clearing old state. | ||
228 | * Fall through. | ||
229 | */ | ||
227 | case DCCPO_MIN_TX_CCID_SPECIFIC ... DCCPO_MAX_TX_CCID_SPECIFIC: | 230 | case DCCPO_MIN_TX_CCID_SPECIFIC ... DCCPO_MAX_TX_CCID_SPECIFIC: |
228 | if (ccid_hc_tx_parse_options(dp->dccps_hc_tx_ccid, sk, | 231 | if (ccid_hc_tx_parse_options(dp->dccps_hc_tx_ccid, sk, |
229 | pkt_type, opt, value, len)) | 232 | pkt_type, opt, value, len)) |