[erlang-questions] gen_sctp multi-homing

Serge Aleynikov saleyn@REDACTED
Mon Jun 2 14:11:32 CEST 2008


Mikael,

I suspect that the issue is that the SCTP implementation in the OS 
kernel doesn't allow for this.  Traditionally in multi-homing setup if a 
client is multi-homed, it notifies the server about all of its IP 
addresses in the INIT messages' parameter list during connection 
establishment.  Likewise, the server provides all of its IP addresses to 
the client in the INIT-ACK message.  Therefore the client is only 
required to know one IP address of the server to establish a multi-homed 
connection.

So I believe I confused you with my previous wrongful email.  The way to 
  have a multi-homed setup would be to open a socket on the server side 
using:

{ok, S} = gen_sctp:open([{ip, IP1},
                          {ip, IP2},{port,Port}, ...]),
ok = gen_sctp:listen(S, true)

Open a multi-homed client socket:
{ok, S} = gen_sctp:open([{ip, {10,80,250,112}},
                          {ip, {10,70,128,96}},{port,33333}, ...]),

And then on the client do:
{ok, Assoc} = gen_sctp:connect(S, Host, Port, Options),


You should be able to verify with eithereal/sharkwire that the INIT and 
INIT-ACK indeed carry all the intended IPs.  At the set-up of an 
association one of the IP addresses from the returned list is selected 
as initial primary path that used as default for transmitting data until 
there's a connectivity issue, in which case SCTP fails over to the 
alternative path.

Regards,

Serge





Mikael Lixenstrand wrote:
> Still haven't figured out what the problem might be. I try another time here
> 
> I tried this in the erlang shell with a running program with
> gen_sctp:open([{ip, {10,80,250,112}},{ip, {10,70,128,96}} ,{port,33333}] ++
> ?sctp_options),
> 
> {ok, Socket} = gen_sctp:open([{ip, {10,30,40,50}}]).
> {ok, Assoc1} =gen_sctp:connect(Socket,{10,80,250,112},33333,[], 6000).
> {ok,{sctp_assoc_change,comm_up,0,10,10,1}}
> 
> {ok, Asso21} = gen_sctp:connect(Socket,{10,70,128,96},33333,[], 6000).
> 
> =ERROR REPORT==== 2-Jun-2008::08:52:19 ===
> Error in process <0.38.0> on node 'asd@REDACTED' with exit value:
> {{badmatch,{error,eisconn}},[{erl_eval,expr,3}]}
> 
> ** exited: {{badmatch,{error,eisconn}},[{erl_eval,expr,3}]} **
> 
> Someone have any idea what the problem might be?
> I'm using R11B-5.
> 
> 2008/5/29, Mikael Lixenstrand <mikael@REDACTED>:
>> I try this but get Error Reason: eisconn (The socket is already connected.)
>>
>> Could i have done anything else wrong?
>>
>> gen_sctp:open(lists:merge(IP,?sctp_client_options)) of
>>     {ok, Socket} ->
>>         AssocList = lists:foldl(fun(IP, AccList) ->
>>             case gen_sctp:connect(Socket, IP, Port,[],
>> ?sctp_connect_timeout) of
>>                 {ok, Assoc} ->
>>                     [Assoc | AccList];
>>                 {error, Reason} ->
>>                     AccList
>>             end
>>         end, [], IPList),
>>
>> thanks for the help
>>
>>
>>
>> 2008/5/29, Serge Aleynikov <saleyn@REDACTED>:
>>> You can call gen_sctp:connect/4 multiple times.  Note that this call
>>> doesn't create new sockets but establishes a new association on a given
>>> socket.
>>>
>>> Serge
>>>
>>> Mikael Lixenstrand wrote:
>>>
>>>> I have some questions regarding gen_sctp and multihoming. It´s possible
>>>> to
>>>> create a socket to multiple local peers but i haven't figured out how to
>>>> connect a socket to multiple IPs on another host.
>>>>
>>>> Is this possible with gen_sctp or would i need to implement something
>>>> using
>>>> more sockets?
>>>> I would like to have one socket with multiple associations, one for each
>>>> peer on remote host.
>>>>
>>>> /mikael
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> erlang-questions@REDACTED
>>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>
>>
>> --
>> ****************************
>>   Mikael Lixenstrand
>>   Slättadammsgatan 9 a 12
>>   417 27 Göteborg
>>   mob   : 0707 593809
>>   icq   :169264851
>>   msn: lixen@REDACTED
>> ****************************
> 




More information about the erlang-questions mailing list