summaryrefslogtreecommitdiffstats
path: root/src/sctp_core.erl
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-09-08 22:22:01 +0200
committerHarald Welte <laforge@gnumonks.org>2013-09-08 22:22:29 +0200
commit48c07f08b1ee66c1006f980b0ad1ad782b362a40 (patch)
tree6b9bc5fb9d8e9bc2225fc9b7d1e64eac0267bc3c /src/sctp_core.erl
parente126068ec8ae05d73a07eb02af1c62e493b145de (diff)
make use of local IP address of #sigtran_peer actually work
Diffstat (limited to 'src/sctp_core.erl')
-rw-r--r--src/sctp_core.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sctp_core.erl b/src/sctp_core.erl
index ca3217d..1e9fc21 100644
--- a/src/sctp_core.erl
+++ b/src/sctp_core.erl
@@ -86,19 +86,21 @@ reconnect_sctp(L = #sctp_state{sctp_remote_ip = Ip, sctp_remote_port = Port, sct
build_openopt({sctp_local_port, Port}) ->
{port, Port};
+build_openopt({sctp_local_ip, undefined}) ->
+ [];
build_openopt({sctp_local_ip, Ip}) ->
{ip, Ip};
build_openopt(_) ->
[].
+build_openopts(PropList) ->
+ [{active, once}, {reuseaddr, true}] ++
+ lists:flatten(lists:map(fun build_openopt/1, PropList)).
init(InitOpts) ->
- OpenOptsBase = [{active, once}, {reuseaddr, true}],
Module = proplists:get_value(module, InitOpts),
ModuleArgs = proplists:get_value(module_args, InitOpts),
Role = proplists:get_value(sctp_role, InitOpts),
- OpenOpts = OpenOptsBase ++ lists:map(fun build_openopt/1, InitOpts),
- io:format("sctp_open(~p)~n", [OpenOpts]),
- {ok, SctpSock} = gen_sctp:open(OpenOpts),
+ {ok, SctpSock} = gen_sctp:open(build_openopts(InitOpts)),
case Module:init(ModuleArgs) of
{ok, ExtState} ->
LoopDat = #sctp_state{role = Role, sctp_sock = SctpSock,