ejabberd_stun crashing with badfun,undefined when receiving unexpected TURN packet
MarcelWaldvogel opened this issue · 4 comments
What version of ejabberd are you using?
17.07
What operating system (version) are you using?
Ubuntu 17.04
How did you install ejabberd (source, package, distribution)?
Package
What did not work as expected? Are there error messages in the log? What
was the unexpected behavior? What was the expected result?
When a TURN message with credentials is received but use_turn
has not been explicitly set to true
in ejabberd, the STUN process crashes:
2017-08-07 15:00:50.678 [error] <0.6671.1>@ejabberd_listener:udp_recv:319 failed to process UDP packet:
** Source: {{192,0,2,1}, 49745}
** Reason: {{badfun,undefined},[{stun,process,2,[{file,"src/stun.erl"},{line,232}]},{ejabberd_listener,udp_recv,3,[{file,"src/ejabberd_listener.erl"},{line,317}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
** Packet: <<0,3,0,76,33,18,164,66,147,192,145,48,234,247,85,140,228,23,150,152,0,25,0,4,17,0,0,0,0,13,0,4,0,0,14,16,0,6,0,4,115,116,117,110,0,20,0,0,0,21,0,10,50,49,54,48,54,50,54,48,51,53,0,0,0,8,0,20,68,53,203,248,222,198,133,165,142,12,108,151,149,81,179,52,15,9,126,19,128,40,0,4,209,187,56,199>>
It seems that AuthFunc
is not set, and its absence is not properly handled.
I am receiving a error related with this:
** Packet: <<0,3,0,84,33,18,164,66,31,241,167,27,119,69,247,82,240,165,23,219,0,25,0,4,17,0,0,0,0,13,0,4,0,0,14,16,0,6,0,11,112,97,99,105,102,105,99,97,100,111,114,0,0,20,0,0,0,21,0,10,51,49,55,51,52,48,48,49,56,55,0,0,0,8,0,20,81,24,92,111,212,234,43,167,220,183,3,83,5,47,193,166,178,209,47,241,128,40,0,4,51,221,165,79>>
2017-08-08 15:45:19.201 [error] <0.439.0>@ejabberd_listener:udp_recv:356 failed to process UDP packet:
** Source: {{10,67,205,125}, 60652}
** Reason: {{badfun,undefined},[{stun,process,2,[{file,"src/stun.erl"},{line,232}]},{ejabberd_listener,udp_recv,3,[{file,"src/ejabberd_listener.erl"},{line,354}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}
But I set use_turn:
-
port: 3478
transport: udp
user_turn: true
turn_ip: "10.67.125.28"
module: ejabberd_stun
certfile: "/opt/ejabberd-16.03/conf/server.pem"
My client (JSXC) configs:
RTCPeerConfig: {
/** Time-to-live for config from url */
ttl: 3600,
/** [optional] If set, jsxc requests and uses RTCPeerConfig from this url */
url: null,
/** If true, jsxc send cookies when requesting RTCPeerConfig from the url above */
withCredentials: false,
/** ICE servers like defined in http://www.w3.org/TR/webrtc/#idl-def-RTCIceServer */
iceServers: [{
urls: 'turn:'+localStorage["JABBER_IP"]+':3478?transport=udp',
username: 'LOGIN',
credential: 'PASSWORD',
credentialType: 'password'
},{
urls: 'turn:'+localStorage["JABBER_IP"]+':3478?transport=tcp',
username: 'LOGIN',
credential: 'PASSWORD',
credentialType: 'password'
}]
}
PS: Ubuntu 16.04 - ejabberd 16.03
@diegobill your snippet says user_turn
rather than use_turn
@facundoolano , thanks, I passed to use https://github.com/coturn/coturn
So, can this ticket be closed?