netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, dccp@vger.kernel.org,
	Gerrit Renker <gerrit@erg.abdn.ac.uk>,
	Ian McDonald <ian.mcdonald@jandi.co.nz>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 07/12] [DCCP]: Add (missing) option parsing to request_sock processing
Date: Thu, 13 Dec 2007 13:06:00 -0200	[thread overview]
Message-ID: <1197558365-31134-8-git-send-email-acme@redhat.com> (raw)
In-Reply-To: <1197558365-31134-7-git-send-email-acme@redhat.com>

From: Gerrit Renker <gerrit@erg.abdn.ac.uk>

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>
---
 net/dccp/minisocks.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 831b76e..b1d5da6 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,
 			    struct request_sock **prev)
 {
 	struct sock *child = NULL;
+	struct dccp_request_sock *dreq = dccp_rsk(req);
 
 	/* Check for retransmitted REQUEST */
 	if (dccp_hdr(skb)->dccph_type == DCCP_PKT_REQUEST) {
-		struct dccp_request_sock *dreq = dccp_rsk(req);
 
 		if (after48(DCCP_SKB_CB(skb)->dccpd_seq, dreq->dreq_isr)) {
 			dccp_pr_debug("Retransmitted REQUEST\n");
@@ -227,22 +227,22 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,
 		goto drop;
 
 	/* Invalid ACK */
-	if (DCCP_SKB_CB(skb)->dccpd_ack_seq != dccp_rsk(req)->dreq_iss) {
+	if (DCCP_SKB_CB(skb)->dccpd_ack_seq != dreq->dreq_iss) {
 		dccp_pr_debug("Invalid ACK number: ack_seq=%llu, "
 			      "dreq_iss=%llu\n",
 			      (unsigned long long)
 			      DCCP_SKB_CB(skb)->dccpd_ack_seq,
-			      (unsigned long long)
-			      dccp_rsk(req)->dreq_iss);
+			      (unsigned long long) dreq->dreq_iss);
 		goto drop;
 	}
 
+	if (dccp_parse_options(sk, dreq, skb))
+		 goto drop;
+
 	child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, req, NULL);
 	if (child == NULL)
 		goto listen_overflow;
 
-	/* FIXME: deal with options */
-
 	inet_csk_reqsk_queue_unlink(sk, req, prev);
 	inet_csk_reqsk_queue_removed(sk, req);
 	inet_csk_reqsk_queue_add(sk, req, child);
-- 
1.5.3.4


  reply	other threads:[~2007-12-13 15:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13 15:05 [PATCHES 0/12]: DCCP patches for 2.6.25 Arnaldo Carvalho de Melo
2007-12-13 15:05 ` [PATCH 01/12] [DCCP]: Perform SHUT_RD and SHUT_WR on receiving close Arnaldo Carvalho de Melo
2007-12-13 15:05   ` [PATCH 02/12] [DCCP]: Shift the retransmit timer for active-close into output.c Arnaldo Carvalho de Melo
2007-12-13 15:05     ` [PATCH 03/12] [DCCP]: Use maximum-RTO backoff from DCCP spec Arnaldo Carvalho de Melo
2007-12-13 15:05       ` [PATCH 04/12] [DCCP]: Support for server holding timewait state Arnaldo Carvalho de Melo
2007-12-13 15:05         ` [PATCH 05/12] [DCCP]: Collapse repeated `len' statements into one Arnaldo Carvalho de Melo
2007-12-13 15:05           ` [PATCH 06/12] [DCCP]: Allow to parse options on Request Sockets Arnaldo Carvalho de Melo
2007-12-13 15:06             ` Arnaldo Carvalho de Melo [this message]
2007-12-13 15:06               ` [PATCH 08/12] [DCCP]: Handle timestamps on Request/Response exchange separately Arnaldo Carvalho de Melo
2007-12-13 15:06                 ` [PATCH 09/12] [DCCP]: Support inserting options during the 3-way handshake Arnaldo Carvalho de Melo
2007-12-13 15:06                   ` [PATCH 10/12] [DCCP]: Remove unused and redundant validation functions Arnaldo Carvalho de Melo
2007-12-13 15:06                     ` [PATCH 11/12] [DCCP]: Make code assumptions explicit Arnaldo Carvalho de Melo
2007-12-13 15:06                       ` [PATCH 12/12] [DCCP]: Ignore feature negotiation on Data packets Arnaldo Carvalho de Melo
2007-12-13 17:43 ` [PATCHES 0/12]: DCCP patches for 2.6.25 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1197558365-31134-8-git-send-email-acme@redhat.com \
    --to=acme@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dccp@vger.kernel.org \
    --cc=gerrit@erg.abdn.ac.uk \
    --cc=ian.mcdonald@jandi.co.nz \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).