aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/minisocks.c
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2007-12-13 09:31:26 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:57:50 -0500
commit8109616e2ef978d142ea45850efd4f102b9bdce4 (patch)
tree338aa4e2bf9d9424090b0d698d20b3c465cf229c /net/dccp/minisocks.c
parent8b819412481494fb6861c08d360b75fabcbbfbbf (diff)
[DCCP]: Add (missing) option parsing to request_sock processing
This adds option-parsing code to processing of Acks in the listening state on request_socks on the server, serving two purposes (i) resolves a FIXME (removed); (ii) paves the way for feature-negotiation during connection-setup. There is an intended subtlety here with regard to dccp_check_req: Parsing options happens only after testing whether the received packet is a retransmitted Request. Otherwise, if the Request contained (a possibly large number of) feature-negotiation options, recomputing state would have to happen each time a retransmitted Request arrives, which opens the door to an easy DoS attack. Since in a genuine retransmission the options should not be different from the original, reusing the already computed state seems better. The other point is - if there are timestamp options on the Request, they will not be answered; which means that in the presence of retransmission (likely due to loss and/or other problems), the use of Request/Response RTT sampling is suspended, so that startup problems here do not propagate. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-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/minisocks.c')
-rw-r--r--net/dccp/minisocks.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 831b76e08d02..b1d5da61f6af 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -200,10 +200,10 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,
200 struct request_sock **prev) 200 struct request_sock **prev)
201{ 201{
202 struct sock *child = NULL; 202 struct sock *child = NULL;
203 struct dccp_request_sock *dreq = dccp_rsk(req);
203 204
204 /* Check for retransmitted REQUEST */ 205 /* Check for retransmitted REQUEST */
205 if (dccp_hdr(skb)->dccph_type == DCCP_PKT_REQUEST) { 206 if (dccp_hdr(skb)->dccph_type == DCCP_PKT_REQUEST) {
206 struct dccp_request_sock *dreq = dccp_rsk(req);
207 207
208 if (after48(DCCP_SKB_CB(skb)->dccpd_seq, dreq->dreq_isr)) { 208 if (after48(DCCP_SKB_CB(skb)->dccpd_seq, dreq->dreq_isr)) {
209 dccp_pr_debug("Retransmitted REQUEST\n"); 209 dccp_pr_debug("Retransmitted REQUEST\n");
@@ -227,22 +227,22 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,
227 goto drop; 227 goto drop;
228 228
229 /* Invalid ACK */ 229 /* Invalid ACK */
230 if (DCCP_SKB_CB(skb)->dccpd_ack_seq != dccp_rsk(req)->dreq_iss) { 230 if (DCCP_SKB_CB(skb)->dccpd_ack_seq != dreq->dreq_iss) {
231 dccp_pr_debug("Invalid ACK number: ack_seq=%llu, " 231 dccp_pr_debug("Invalid ACK number: ack_seq=%llu, "
232 "dreq_iss=%llu\n", 232 "dreq_iss=%llu\n",
233 (unsigned long long) 233 (unsigned long long)
234 DCCP_SKB_CB(skb)->dccpd_ack_seq, 234 DCCP_SKB_CB(skb)->dccpd_ack_seq,
235 (unsigned long long) 235 (unsigned long long) dreq->dreq_iss);
236 dccp_rsk(req)->dreq_iss);
237 goto drop; 236 goto drop;
238 } 237 }
239 238
239 if (dccp_parse_options(sk, dreq, skb))
240 goto drop;
241
240 child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, req, NULL); 242 child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, req, NULL);
241 if (child == NULL) 243 if (child == NULL)
242 goto listen_overflow; 244 goto listen_overflow;
243 245
244 /* FIXME: deal with options */
245
246 inet_csk_reqsk_queue_unlink(sk, req, prev); 246 inet_csk_reqsk_queue_unlink(sk, req, prev);
247 inet_csk_reqsk_queue_removed(sk, req); 247 inet_csk_reqsk_queue_removed(sk, req);
248 inet_csk_reqsk_queue_add(sk, req, child); 248 inet_csk_reqsk_queue_add(sk, req, child);