Re: [BEHAVE] (no subject)

Simon Perreault <simon.perreault@viagenie.ca> Thu, 27 June 2013 05:45 UTC

Return-Path: <simon.perreault@viagenie.ca>
X-Original-To: behave@ietfa.amsl.com
Delivered-To: behave@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B5D4321F9C11 for <behave@ietfa.amsl.com>; Wed, 26 Jun 2013 22:45:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rBbR76n0lpTT for <behave@ietfa.amsl.com>; Wed, 26 Jun 2013 22:45:48 -0700 (PDT)
Received: from jazz.viagenie.ca (jazz.viagenie.ca [IPv6:2620:0:230:8000::2]) by ietfa.amsl.com (Postfix) with ESMTP id 35A2321F9C10 for <behave@ietf.org>; Wed, 26 Jun 2013 22:45:47 -0700 (PDT)
Received: from porto.nomis80.org (87-231-137-212.rev.numericable.fr [87.231.137.212]) by jazz.viagenie.ca (Postfix) with ESMTPSA id 1E97B4043D; Thu, 27 Jun 2013 01:45:45 -0400 (EDT)
Message-ID: <51CBD188.4060408@viagenie.ca>
Date: Thu, 27 Jun 2013 07:45:44 +0200
From: Simon Perreault <simon.perreault@viagenie.ca>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6
MIME-Version: 1.0
To: ivan@cacaoweb.org
References: <CB1B483277FEC94E9B58357040EE5D02325A6E93@xmb-rcd-x15.cisco.com> <2f7dce8264c8a9a72640629502a44295@cacaoweb.org> <51C1681A.5030909@viagenie.ca> <f8741fad1af1cee094de9c59408b7425@cacaoweb.org> <51C40374.8080403@viagenie.ca> <21e25b7ae1501228a67656b2fa4bc009@cacaoweb.org> <51CAA20F.4070307@viagenie.ca> <88c0ada2b8ebad078fb249ac6572fd8b@cacaoweb.org>
In-Reply-To: <88c0ada2b8ebad078fb249ac6572fd8b@cacaoweb.org>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Cc: behave@ietf.org
Subject: Re: [BEHAVE] (no subject)
X-BeenThere: behave@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: mailing list of BEHAVE IETF WG <behave.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/behave>, <mailto:behave-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/behave>
List-Post: <mailto:behave@ietf.org>
List-Help: <mailto:behave-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/behave>, <mailto:behave-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 27 Jun 2013 05:45:48 -0000

Le 2013-06-26 15:51, ivan c a écrit :
>>> We have, for all UDP communications and all outbound TCP sessions:
>>> - one socket is bound to one local endpoint on the host. Additionally,
>>> two sockets have to bind to two different local endpoints.
>>
>> Not true. If you call connect() on a UDP socket, it behaves just like a
>> TCP socket.
>
> "Not true". interesting...
> Do you mind providing a counterexample, ie some pseudo-code that binds two
> sockets of the same protocol to the same local endpoint?

s1 = socket(..., SOCK_DGRAM, ...);
s2 = socket(..., SOCK_DGRAM, ...);
connect(s1, ...);
connect(s2, ...);

The kernel is free to use the same local endpoint for those two sockets 
as long as the remote endpoint is different.

If you really want to force reusing the same local endpoint, you do the 
SO_REUSEADDR+bind() dance before calling connect().

Simon
-- 
DTN made easy, lean, and smart --> http://postellation.viagenie.ca
NAT64/DNS64 open-source        --> http://ecdysis.viagenie.ca
STUN/TURN server               --> http://numb.viagenie.ca