aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-09-08 19:37:22 +0200
committerHarald Welte <laforge@gnumonks.org>2013-09-08 19:37:22 +0200
commit56afaf688acc769c382b04725f279e926a2fe53e (patch)
tree98ef746fb5cab7f2b2f2d331dfee9ba6c4acbb51
parenta137c19b652132ba7fad867dd72d8a427d382184 (diff)
sctp_handler: Fix sctp_local_out() for packet injectionlaforge/fake_sms_ssf
When we call gen_sctp:send(), erlang is quite picky about which fields are permitted to be set or not in #sctp_sndrcvsinfo{} so rather than passing one through we received from the stack, we create a new one and fill in only stream, ppid and assoc_id.
-rw-r--r--src/sctp_handler.erl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sctp_handler.erl b/src/sctp_handler.erl
index 64eac7e..f0a6b50 100644
--- a/src/sctp_handler.erl
+++ b/src/sctp_handler.erl
@@ -195,8 +195,8 @@ handle_rx_data(_Mod, _L, From, SRInfo, Data) when is_binary(Data) ->
io:format("Unhandled Rx Data from SCTP from ~p: ~p, ~p~n", [From, SRInfo, Data]).
-sctp_local_out(L, From, OutData, SRInf) when is_record(L, loop_data),
- is_record(SRInf, sctp_sndrcvinfo) ->
+sctp_local_out(L, From, OutData, SRInf = #sctp_sndrcvinfo{ppid = 2, stream = Stream})
+ when is_record(L, loop_data) ->
case From of
from_msc ->
Sock = L#loop_data.stp_sock,
@@ -205,4 +205,5 @@ sctp_local_out(L, From, OutData, SRInf) when is_record(L, loop_data),
Sock = L#loop_data.msc_sock,
AssocId = L#loop_data.msc_assoc_id
end,
- gen_sctp:send(Sock, SRInf#sctp_sndrcvinfo{assoc_id = AssocId}, OutData).
+ SRInf2 = #sctp_sndrcvinfo{ppid = 2, stream = Stream, assoc_id = AssocId},
+ ok = gen_sctp:send(Sock, SRInf2, OutData).