[erlang-questions] : sctp_peer_addr_params

Mikael Lixenstrand <>
Wed Jan 28 08:54:02 CET 2009


Thank you.

This helped me a great deal. I had some compilation problems with R12B-5 but
when i solved that i worked perfect.

/ Mikael

2009/1/22 Raimo Niskanen
<<raimo%>
>

> On Thu, Jan 22, 2009 at 08:53:51AM +0100, Raimo Niskanen wrote:
> > On Wed, Jan 21, 2009 at 07:52:56AM +0100, Mikael Lixenstrand wrote:
> > > I'm trying to change the sack delay in gen_sctp
> > >
> > >  {ok,Socket} = gen_sctp:open([{ip, ServerIPAddress}, {port,
> ServerPort}]
> > >   ++ [{sctp_peer_addr_params, #sctp_paddrparams{ assoc_id = 0, address
> =
> > > {ServerIPAddress ,ServerPort} ,sackdelay = 400}},
> > >   {mode, binary},
> > >   {active, false},
> > >   {sctp_events,#sctp_event_subscribe{address_event = false,
> > > shutdown_event=false}}]),
> > >
> > > I tried several approaches but with the same result:
> > >
> > > Error in process <0.7100.1> on node '' with exit value:
> > >
> {badarg,[{gen_sctp,open,[[{ip,{10,70,160,17}},{port,3868},{sctp_peer_addr_params,{sctp_paddrparams,0,{{10,70,160,17},3868},200,5,600,400,[]}},{mode,binary},{active,false},{sctp_events,{sctp_event_subscribe,undefined,undefined,false,undefined,undefined...
> > >
> > > I'm running R12B-0 on rhel 5.2
> > >
> >
> > Congratulations, you have found a bug!
> >
> > You have dived down to the untested parts of the SCTP code.
> > It is still something we have left to do to write thorough
> > test cases for gen_sctp. Unfortunately there are a _lot_
> > of options and functionality to test so it is a big task.
> >
> > Nevertheless..
> >
> > The decoding in the inet driver for #sctp_paddrparams{address={IP,P}}
> > is wrong; it does not expect the address family byte that it gets
> > and detects a parameter length mismatch.
> >
> > I had a small patch yesterday, but I could not set default
> > sctp_peer_addr_params for future associations, so I started
> > to read the spec, and indeed it should be possible.
> >
> > So yesterdays 2 character patch of inet_drv.c now is a patch
> > for erts/configure.in, inet_drv.c and prim_inet.erl. I will
> > do some more testing and post a patch hopefully during the day.
>
> Here is the patch. Unfortunately it is a minimal path for the
> current development branch so it will not be applied cleanly
> to R12B-5 or any other released source. But applying it manually
> should be no problem for the initiated user.
>
> erts/configure.in: Spelling error `ssh_data' -> `ssf_data'
>        To do this manually to its autoconf result erts/configure
>        change all occurences of `ssh_data' to `ssf_data' while
>        preserving case. I have searched and there are
>        no false occurences.
>
> erts/emulator/drivers/common/inet_drv.c:
>        Two changes of inet_set_address -> inet_set_faddress.
>        A few changes of HAVE_SCTP_* -> HAVE_STRUCT_SCTP_*.
>        Use the patch to find the places.
>
> erts/preloaded/src/prim_inet.erl:
>        This file has moved in our development branch;
>        I think it was in lib/kernerl/src in R12B-5.
>
> With these patches it appears to work. Note that it is the
> peers address and port you use in the option! To set it
> on future associations you must not specify the peer
> address or association id. This is now possible thanks
> to the prim_inet.erl patch. Without that patch you
> could use address={{0,0,0,0},0} and assoc_id=0.
> See http://tools.ietf.org/html/draft-ietf-tsvwg-sctpsocket-13#section-7
> just before section 7.1, and
> http://tools.ietf.org/html/draft-ietf-tsvwg-sctpsocket-13#section-7.1.13
>
> In one erlang shell:
>
> Erlang R13A (erts-5.7) [64-bit] [smp:4] [async-threads:0]
> [kernel-poll:false]
>
> Eshell V5.7  (abort with ^G)
> 1> gen_sctp:open([{ip,loopback}]).
> {ok,#Port<0.444>}
> 2> {ok,S} = v(-1).
> {ok,#Port<0.444>}
> 3> gen_sctp:listen(S, true).
> ok
> 4> inet:port(S).
> {ok,32850}
>
> And then the action in another erlang shell:
>
> Erlang R13A (erts-5.7) [64-bit] [smp:4] [async-threads:0]
> [kernel-poll:false]
>
> Eshell V5.7  (abort with ^G)
> 1> rr(inet).
> [connect_opts,hostent,listen_opts,sctp_adaptation_event,
>  sctp_assoc_change,sctp_assoc_value,sctp_assocparams,
>  sctp_event_subscribe,sctp_initmsg,sctp_opts,
>  sctp_paddr_change,sctp_paddrinfo,sctp_paddrparams,
>  sctp_pdapi_event,sctp_prim,sctp_remote_error,sctp_rtoinfo,
>  sctp_send_failed,sctp_setadaptation,sctp_setpeerprim,
>  sctp_shutdown_event,sctp_sndrcvinfo,sctp_status,udp_opts]
> 2> {ok,S} = gen_sctp:open([{sctp_peer_addr_params,
> #sctp_paddrparams{sackdelay=400,flags=[sackdelay_enable]}}]).
> {ok,#Port<0.456>}
> 3> gen_sctp:connect(S, localhost, 32850, []).
> {ok,#sctp_assoc_change{state = comm_up,error = 0,
>                       outbound_streams = 10,inbound_streams = 10,
>                       assoc_id = 1}}
> 4> inet:setopts(S, [{sctp_peer_addr_params,
> #sctp_paddrparams{sackdelay=500,flags=[sackdelay_enable],assoc_id=1,address={loopback,32850}}}]).
> ok
> 5> inet:getopts(S, [sctp_peer_addr_params]).
> {ok,[{sctp_peer_addr_params,
>         #sctp_paddrparams{
>             assoc_id = 0,
>             address = {{0,0,0,0},0},
>             hbinterval = 30000,pathmaxrxt = 5,pathmtu = 0,
>             sackdelay = 400,
>             flags = [hb_enable,pmtud_enable,sackdelay_enable]}}]}
> 6> inet:getopts(S, [{sctp_peer_addr_params,
> #sctp_paddrparams{assoc_id=1,address={loopback,32850}}}]).
> {ok,[{sctp_peer_addr_params,
>         #sctp_paddrparams{
>             assoc_id = 1,
>             address = {{127,0,0,1},32850},
>             hbinterval = 30000,pathmaxrxt = 5,pathmtu = 16436,
>             sackdelay = 500,
>             flags = [hb_enable,pmtud_enable,sackdelay_enable]}}]}
>
>
> >
> > > Thanks
> >
> > > _______________________________________________
> > > erlang-questions mailing list
> > > 
> > > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> > --
> >
> > / Raimo Niskanen, Erlang/OTP, Ericsson AB
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://www.erlang.org/mailman/listinfo/erlang-questions
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090128/e71fff2e/attachment.html>


More information about the erlang-questions mailing list