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

Michael Tuexen <Michael.Tuexen@lurchi.franken.de> Mon, 10 February 2014 19:08 UTC

Return-Path: <Michael.Tuexen@lurchi.franken.de>
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 C3C771A046A for <rtcweb@ietfa.amsl.com>; Mon, 10 Feb 2014 11:08:36 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HELO_EQ_DE=0.35, RP_MATCHES_RCVD=-0.548, SPF_HELO_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 TFvSMjmqFbTn for <rtcweb@ietfa.amsl.com>; Mon, 10 Feb 2014 11:08:35 -0800 (PST)
Received: from mail-n.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) by ietfa.amsl.com (Postfix) with ESMTP id 059EB1A03A5 for <rtcweb@ietf.org>; Mon, 10 Feb 2014 11:08:35 -0800 (PST)
Received: from [192.168.1.103] (p508F3BD7.dip0.t-ipconnect.de [80.143.59.215]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTP id 3EA261C0E97BB; Mon, 10 Feb 2014 20:08:34 +0100 (CET)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\))
From: Michael Tuexen <Michael.Tuexen@lurchi.franken.de>
In-Reply-To: <7594FB04B1934943A5C02806D1A2204B1D167A2E@ESESSMB209.ericsson.se>
Date: Mon, 10 Feb 2014 20:08:32 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <C26A9264-1FC5-4C85-B08A-1A70DF20E963@lurchi.franken.de>
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>
To: Christer Holmberg <christer.holmberg@ericsson.com>
X-Mailer: Apple Mail (2.1510)
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: Mon, 10 Feb 2014 19:08:36 -0000

On Feb 10, 2014, at 6:29 PM, Christer Holmberg <christer.holmberg@ericsson.com> 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.
But what if the side not allowed to send DATA_CHANNEL_OPEN messages creates a data channel?
The JS API allows both sides to create data channels.
> 
> 
>>>> 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.
That is fine. Then you have two choices:
* Use the data channel (establishment) protocol and manage yourself that only
  on side creates a data channel.
* Don't use the data channel protocol and create the channel manually. You need
  to negotiate the parameters out of band.
> 
> Now, one can of course solve this by reseting one of the data channels, but then the question is which endpoint should reset :)
You could always close the data channel with the lower stream id. Both sides can close it...

Best regards
Michael
> 
> Regards,
> 
> Christer
> 
>