[erlang-patches] [PATCH] Fix SCTP multihoming for IPv6
Raimo Niskanen
raimo+erlang-patches@REDACTED
Tue Aug 21 10:20:55 CEST 2012
I think you missed one clause, see below.
On Mon, Aug 20, 2012 at 06:34:58PM +0200, Tomas Abrahamsson wrote:
> On Sun, May 13, 2012 at 11:52 PM, Tomas Abrahamsson
> <tomas.abrahamsson@REDACTED> wrote:
> > regarding the SCTP multihoming, here are three commits on a branch,
> > I think I've addressed all issues I know of, and hope I haven't introduced
> > any new issues :)
> >
> > https://github.com/tomas-abrahamsson/otp/compare/sctp-multihoming
> > https://github.com/tomas-abrahamsson/otp/compare/sctp-multihoming.patch
>
> Hi, please refetch!
>
> I have changed the second commit to also work on sles 10(.4)
> (I was notified off-list that there was a failure in one of the
> tests in gen_sctp_SUITE.erl, on SLES or SLED 10, and I believe
> that this change fixes it. I have tried SLES 10.4 and could
> reproduce the failing test.)
>
> > The second commit changes the way the inet_drv.c binds:
> > the first address is bound using bind, the subsequent addresses
> > are added one at a time using sctp_bindx.
>
> I have applied the change below: on SLES 10(.4), calling
> sctp_bindx with port 0 resulted in einval being returned from the os.
> Now, when opening an sctp socket on port 0, the code now uses
> the resulting port number from bind any the subsequent call to sctp_bindx.
>
> in inet.erl, the following change was made:
>
> @@ -1046,6 +1046,11 @@ bindx(S, [Addr], Port0) ->
> bindx(S, Addrs, Port0) ->
> [{IP, Port} | Rest] = [set_bindx_port(Addr, Port0) || Addr <- Addrs],
> case prim_inet:bind(S, IP, Port) of
> + {ok, AssignedPort} when Port =:= 0 ->
> + %% On newer Linux kernels, Solaris and FreeBSD, calling
> + %% bindx with port 0 is ok, but on SuSE 10, it results in einval
> + Rest2 = [change_bindx_0_port(Addr, AssignedPort) || Addr <- Rest],
> + prim_inet:bind(S, add, Rest2);
> {ok, _} ->
> prim_inet:bind(S, add, Rest);
> Error ->
> @@ -1057,6 +1062,11 @@ set_bindx_port({_IP, _Port}=Addr, _OtherPort) ->
> set_bindx_port(IP, Port) ->
> {IP, Port}.
>
> +change_bindx_0_port({IP, 0}, AssignedPort) ->
> + {IP, AssignedPort};
> +change_bindx_0_port({_IP, _Port}=Addr, _AssignedPort) ->
+ Addr;
+change_bindx_0_port(Addr, AssignedPort) ->
+ {Addr, AssignedPort}.
> +
>
>
> BRs
> Tomas
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-patches
mailing list