DCCP protocol discussions
 help / color / mirror / Atom feed
From: Eddie Kohler <kohler@cs.ucla.edu>
To: dccp@vger.kernel.org
Subject: Re: Report: feat negot state
Date: Wed, 08 Mar 2006 16:08:53 +0000	[thread overview]
Message-ID: <440F0195.70002@cs.ucla.edu> (raw)
In-Reply-To: <39e6f6c70603061905i1db54071m6cc2776edd3828bb@mail.gmail.com>

Hi guys!

Andrea Bittau wrote:
> good.  only 2 queues:  one for "pending changes" and one for confirms.  You
> might have wondered why i had a "confirm" inside the pending change queue
> itself, and then a seperate confirm queue.
> 
> Basically, because i coded server priority features first, and then
> non-negotiable.  With NN features, you need to send confirms even for stuff you
> don't know about [or something like that] so i didn't know where to shove the
> confirm =D

I don't quite understand this.  If you don't know about the feature, then how 
can you tell whether it is NN?

> Anyway, it's much better like this [i was planning to do it at some point, but i
> just "died"]
>  
>  
>  	/* Check if nothing is being changed. */
> -	if (ccid_nr = new_ccid_nr)
> +	/* XXX handle multibyte values */
> +	if (ccid_nr = *val)
>  		return 0;
> 
> 
> ccid can only be 1 byte.  kill comment.  assert(len = 1);

It is worth pointing out here that ALL server-priority features specified in 
DCCP so far use one byte values.  So I'd just hold off implementing multi-byte 
SP features.

> +	rc = dccp_feat_change(dmsk, DCCPO_CHANGE_L, DCCPF_ACK_RATIO,
> +			      &dmsk->dccpms_ack_ratio, 1, gfp);
> 
> ack ratio is 2 bytes i think.

Yep.

> 1) Merge it
> 2) I'll try to re-write the multi-byte feature support patch.  I believe this is
>    important functionality which is missing.

For NN features, yes.

> So now feature negotiation is moved into the minisock stuff.  I don't know what
> it means exactly, but i think the minisock stuff is the socket created upon
> receiving a SYN... i.e. a half open connection.  The idea is to keep as little
> state as possible in order to avoid SYN floods and other lame dos attacks.
> 
> While I was writing feature negotiation, I spotted quite a nice dos attack.
> Actually, probably it sucks, but here it is.
> 
> The idea is that when you send a REQUEST, you can include your CHANGE options.
> The server will RESPOND with the various CONFIRM options.  Here are the nice
> implications of this:
> 
> * The server must remember which CONFIRMs it sent.  [In fact, the previous code
>   was bugged because of this I think---it would remember the features of ALL
>   clients in a single socket... anyway.]
> 
>   This means that the server must not trash memory, it has to hold some state,
>   and potentially even setup those options.  E.g. it might have to load a CCID,
>   etc etc.

The Init Cookie option lets the server package up all that state, send it to 
the client, and forget it.  The server might still have to load a CCID, but 
that doesn't worry me -- we only have 3 CCIDs.

> * The server must actually calculate the CONFIRMS.  With server priority, the
>   calculation works as follows:  Given preference list C and S of the client and
>   server respectively, the winning value is the first value which appears in S
>   and also in C.
> 
>   Basically:
> 
>   for each s in S
>     for each c in C
>       if (s = c)
>         w00t();

It's not that bad.  (1) All feature negotiation options are limited to 252 
bytes of feature value at most.  (2) All current SP features are one-byte 
valued.  So you can do this.

     uint32_t bitmap[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // 256 bits
     for each c in C
       turn on corresponding bit in bitmap;
     for each s in S
       if corresponding bit in bitmap is true
         w00t();

O(n^2) -> O(n).

For multi-byte SP features (if they ever exist), this trick doesn't work, but 
the DOS is less serious, since the maximum preference list length is 1/2 (1/3, 
1/4...) as long.

E

  parent reply	other threads:[~2006-03-08 16:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-07  3:05 Report: feat negot state Arnaldo Carvalho de Melo
2006-03-07  4:11 ` Ian McDonald
2006-03-08 12:51 ` Andrea Bittau
2006-03-08 15:51 ` Arnaldo Carvalho de Melo
2006-03-08 16:08 ` Eddie Kohler [this message]
2006-03-08 16:19 ` Arnaldo Carvalho de Melo
2006-03-08 16:28 ` Eddie Kohler
2006-03-08 16:39 ` Arnaldo Carvalho de Melo
2006-03-08 19:01 ` Andrea Bittau
2006-03-08 19:18 ` Eddie Kohler

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=440F0195.70002@cs.ucla.edu \
    --to=kohler@cs.ucla.edu \
    --cc=dccp@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