Re: [rtcweb] Data Channel Protocol: Prevent DATA_CHANNEL_OPEN glare

Peter Thatcher <pthatcher@google.com> Tue, 11 February 2014 18:33 UTC

Return-Path: <pthatcher@google.com>
X-Original-To: rtcweb@ietfa.amsl.com
Delivered-To: rtcweb@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A104B1A06E0 for <rtcweb@ietfa.amsl.com>; Tue, 11 Feb 2014 10:33:26 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.926
X-Spam-Level:
X-Spam-Status: No, score=-1.926 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RP_MATCHES_RCVD=-0.548, SPF_PASS=-0.001] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RO2VAgDV5oKb for <rtcweb@ietfa.amsl.com>; Tue, 11 Feb 2014 10:33:22 -0800 (PST)
Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com [IPv6:2607:f8b0:400e:c03::235]) by ietfa.amsl.com (Postfix) with ESMTP id 19D471A06F2 for <rtcweb@ietf.org>; Tue, 11 Feb 2014 10:33:22 -0800 (PST)
Received: by mail-pa0-f53.google.com with SMTP id lj1so7982249pab.26 for <rtcweb@ietf.org>; Tue, 11 Feb 2014 10:33:21 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=2KFnnASy5wCtVHyIwBKmrBLg+sMnr5SfpcKip9evhyg=; b=k19ur++HmJMwT50Octp4l94t+TjopE3RC8DBiEY0TXSIMRC9hb+1UVe+FJwMjhGWtF k2yT+sz4siap47zn1TmUJYzKz7Es7dscPwylaFDDElkw8+Xm1tG/ZNwBcCKa2VHvzz0/ nKmQ+bolvJJkh1yaJs/g7baxUl+Zg7AADmwOBkmSkDZf65wmlvBXP1evZCng+pRCWiLP 0z5K8dle7UUgPE8tHw3YQzEYV7kjxKrsYTDCe/ZR6lrvX9XxwF4U8aWgKgDgZLHKrk9o T6pPwwMKWqBbqGamjc76IQ0YQZ5CxX6k4+Q5pq+mDMyxlms0oKaxKufcJYVAuAMqD3GT 7d+w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=2KFnnASy5wCtVHyIwBKmrBLg+sMnr5SfpcKip9evhyg=; b=O/IG11sQJZ1wk35vCzGNZnB5YiGQCu9lbjlYbSY0jycNQotgX502P8rvRqJO0p9OX0 m4lyJtogpXYSOdRKL++HhXNq+uoI7zzrp8cIv5m4l2JjrPa5o7o47EzrNlAfDNktd3qN V9BtT2IFmEnwd47rP/jH5iNovMMxb3IlD4Kev2gB/VhRefc304orVC/r1mR6B0qSTroA mWvSN3VshCl/vpO8KheTMOVCCXDPyy1dSr8e8l3UA1E/YKFq4lsWg9Tazni1avzniRiv hvqgzNhrR65ZFf7Bqq1MKNtZzOI/pRuWTgs+LdkemF4D67x4T/UClKOgvvGfyMJHGybG RjTg==
X-Gm-Message-State: ALoCoQk6ZFJt0iXpD6JMY1wgaksy8EdjeM17t8Gp/lGadFRb4KnhOEKU7L0HW5KFv+dSiYk1Uk8hmmxbKP1EcPA/vGEfRSTfuQsPZDep2iV3qCHmTPPOb18htD2nUkIiU7WiOuObWje6vdZaLpwbXY/w1waT/oMDGjZHAT78KkVQeIwOxw0ivgvt6UizQ82G3Stg8fS1Cm9t
X-Received: by 10.68.203.225 with SMTP id kt1mr41688470pbc.130.1392143601505; Tue, 11 Feb 2014 10:33:21 -0800 (PST)
MIME-Version: 1.0
Received: by 10.66.163.234 with HTTP; Tue, 11 Feb 2014 10:32:41 -0800 (PST)
In-Reply-To: <7594FB04B1934943A5C02806D1A2204B1D16D2F3@ESESSMB209.ericsson.se>
References: <7594FB04B1934943A5C02806D1A2204B1D166CFA@ESESSMB209.ericsson.se> <4616BFFA-F461-4CE8-9D85-211B86D4BE93@lurchi.franken.de> <7594FB04B1934943A5C02806D1A2204B1D166D7B@ESESSMB209.ericsson.se> <71288EED-3C82-44A7-950B-EFEFA62616E6@lurchi.franken.de> <7594FB04B1934943A5C02806D1A2204B1D166F8C@ESESSMB209.ericsson.se> <EDF758D1-A388-40D4-83EA-238C7DC82F31@lurchi.franken.de> <7594FB04B1934943A5C02806D1A2204B1D167A2E@ESESSMB209.ericsson.se> <52F9786F.60809@alum.mit.edu> <CAJrXDUEgr91ATJVFJcabzhavGBiX9MUgMimNKWFVPcdjL2Xbbw@mail.gmail.com> <7594FB04B1934943A5C02806D1A2204B1D16D2F3@ESESSMB209.ericsson.se>
From: Peter Thatcher <pthatcher@google.com>
Date: Tue, 11 Feb 2014 10:32:41 -0800
Message-ID: <CAJrXDUFoYXtwXrKHBw1bKG+dbDcVkAtrxHx8QFfd0d2f6aKacw@mail.gmail.com>
To: Christer Holmberg <christer.holmberg@ericsson.com>
Content-Type: multipart/alternative; boundary="047d7b15a811d840f204f225b0a7"
Cc: "<rtcweb@ietf.org>" <rtcweb@ietf.org>
Subject: Re: [rtcweb] Data Channel Protocol: Prevent DATA_CHANNEL_OPEN glare
X-BeenThere: rtcweb@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Real-Time Communication in WEB-browsers working group list <rtcweb.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/rtcweb/>
List-Post: <mailto:rtcweb@ietf.org>
List-Help: <mailto:rtcweb-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 11 Feb 2014 18:33:26 -0000

On Tue, Feb 11, 2014 at 10:22 AM, Christer Holmberg <
christer.holmberg@ericsson.com> wrote:

> Hi Peter,
>
> > I believe the API already gives you all the tools you need for this use
> case.  Here's one way to create a data channel where both ends call
> createDataChannel() at the same time, with no "middle":
> >
> > 1.  Both sides call createDataChannel() with the same label.
>
> Or, with the same Protocol.
>
> It is a little unclear to me what "label" really is. The data channel
> draft says it's a "name of the channel"...
>

​Label is whatever the JS  or native app chooses it to be.​  You can give
it whatever semantics you want.


>
> > 2.  If an endpoint ends up with two data channels with the same label,
> close the one with the higher .id, and keep the one with the lower .id.
>
> What is ".id"? Is it something API specific? Keep in mind that non-WebRTC
> clients may also use the data channel.
>
>
In​
​
​ JS, it's this:
http://dev.w3.org/2011/webrtc/editor/webrtc.html#widl-RTCDataChannel-id

​On the wire, it's the SCTP SID.​
​

 > Now both sides will use the same channel, and you can pretend like the
other never existed.   If you're worried about data sent before this
process completes, either accept data on both channels for a while, or
don't send data until the process completes.

> >
> > Is there any reason this would not work?
>
> Assuming it's generic, and not API specific, I guess it could work.
>
>
​​
​Yes, it's generic.  The logic is basically, "if you end up with two SIDs
with the same label, close the channel with the higher SID".  Applies to
any endpoint.​



> Also, as has been indicated, specific protocols can specify rules
> regarding who opens the channel.
>
> I think it would be good to have some informative guidance text about this
> somewhere, e.g. in the Data Channel draft.
>
> Regards,
>
> Christer
>
>
>
>
>
>
> On Mon, Feb 10, 2014 at 5:10 PM, Paul Kyzivat <pkyzivat@alum.mit.edu>
> wrote:
> You two guys are talking past one another.
>
> Christer's point is that the *application" distributed between the two
> endpoints, needs a *single* instance of a channel for a particular
> application specific purpose. But the two ends are generally symmetric.
> There is no obvious choice of which side should create the channel. So how
> do we use the mechanism to achieve this result?
>
> I think I can predict what Michael is going to say: it isn't a protocol
> issue - the two ends should negotiate this some other way. (In the normal
> rtcweb scenario, a *single* app in the middle can arrange for one side to
> do the open.)
>
> This is a problem with a sip app - there is no middle, just two ends.
>
>
> Previously Christer said:
> Couldn’t we e.g. say that, by default, the DTLS client is responsible for
> sending the DATA_CHANNEL_OPEN? Then there is no risk for glare, and it
> could even use both an even or odd stream id value.
>
> That is a bad thing for data channel in general. But I suppose the app can
> choose to follow this rule if it wants for particular channels.
>
>         Thanks,
>         Paul
>
>
>
>
>
>
> On 2/10/14 12:29 PM, Christer Holmberg wrote:
>
> Hi,
> As is defined in the data channel protocol, an entity can send data once
> DATA_CHANNEL_OPEN has been sent, before the associated DATA_CHANNEL_ACK is
> received.
>
> The draft also says that, if both endpoints send DATA_CHANNEL_OPEN at the
> same time, using different stream id values, the result may be TWO data
> channels, with data sent on both.
>
> However, as is also indicated, the draft does not provide a mechanism to
> prevent/handle such glare situation.
>
> I personally think there shall be a way to prevent such situation, or
> otherwise I'm sure we are going to end up with interoperability problems.
>
> Couldn't we e.g. say that, by default, the DTLS client is responsible for
> sending the DATA_CHANNEL_OPEN? Then there is no risk for glare, and it
> could even use both an even or odd stream id value.
> Section 4 reads:
>
> To avoid glare in opening Channels, each side MUST use either even
> or  odd Streams when sending a DATA_CHANNEL_OPEN message.  The method
> used to determine which side uses odd or even is based on the
> underlying DTLS connection role when used in WebRTC, with the side
> acting as the DTLS client using even stream identifiers.
>
> So there is no problem in setting up data channels.
>
> This should not be confused by both sides setting up a data channel with
> the same Label. This ends up in two data channels with the same label.
> You can even create more data channels with the same label.
>
> My point is that I don't want to end up with more than one channel.
> And you won't, see above.
>
> I am not sure I understand. What text do you refer to?
> To avoid glare in opening Channels, each side MUST use either even
> or  odd Streams when sending a DATA_CHANNEL_OPEN message.  The method
> used to determine which side uses odd or even is based on the
> underlying DTLS connection role when used in WebRTC, with the side
> acting as the DTLS client using even stream identifiers.
>
> That part I understand.
>
> But, this means that both endpoints may send DATA_CHANNEL_OPEN, for the
> same protocol, and THAT is what I would like to avoid. I don't want to have
> two bi-directional data channels for the same thing.
>
> For that reason I suggested that we could also specify which endpoint is
> responsisble for sending DATA_CHANNEL_OPEN.
>
> However, there is no mechanism to ensure uniqueness for labels. The WebRTC
> API already allows one side to create n data channels with the same label.
>
> I am not saying it should be forbidden to do so. But, for protocol X, I
> want to end up with ONE data channel between my peers.
> Then only one side should create a data channel.
>
> If I end up with two data channels for protocol X, can I send data on
> whichever I want to?
> Sure. These would be two independent bidirectional data channels.
>
> Possible for the same protocol - and that is what I would want to avoid. I
> want to send my protocol X messages on one data channel, and I would like
> to receive the protocol X messages from my peer on the same data channel.
>
> Now, one can of course solve this by reseting one of the data channels,
> but then the question is which endpoint should reset :)
>
> Regards,
>
> Christer
>
> _______________________________________________
> rtcweb mailing list
> rtcweb@ietf.org
> https://www.ietf.org/mailman/listinfo/rtcweb
>
> _______________________________________________
> rtcweb mailing list
> rtcweb@ietf.org
> https://www.ietf.org/mailman/listinfo/rtcweb
>
>