[erlang-questions] Diameter client issue

Anders Svensson anders.otp@REDACTED
Wed Mar 27 10:03:05 CET 2013


Hi Rudolph.

On Wed, Mar 27, 2013 at 9:01 AM, Rudolph van Graan <rvg.mailing@REDACTED> wrote:
> Hi Samuel,
>
> I managed to get mine to work to an extent. The one issue was as Anders
> pointed out the ssl tuple and two other issues:
>
> 1. The dictionaries and IDs in the dictionaries must be all correct, if they
> don't match, the peer connections don't come up and

Yes, this is a fairly common source if woe. Right now there's a fairly
bloody app_not_configured crash (which I've cleaned up a bit for
R16B01) but there's no check that the two match up. I'll fix it.

> 2. The fact that I needed to include a local IP address in the connection
> configuration. This is really annoying because I am using a VPN to test and
> this IP address can change at any time, even in the same session.

It's not really the connection configuration that needs the local IP
address, it's capabilities exchange that needs one for a
Host-IP-Address AVP. Right now diameter_tcp isn't smart enough to do
something reasonable without an explicitly configured address but that
can change. I should probably make start/3 return the local address
returned by inet:sockname/1 if no address is configured, the returned
address being what gets used as Host-IP-Address. I'll look into it.

/Anders, Erlang/OTP


> I traced the diameter tcp module and had to figure out the negotiation
> between the applications to get it right.
>
> Regards,
>
> Rudolph van Graan
>
>
>
>
>
> On 26 Mar 2013, at 14:48, S X <erlangprogram@REDACTED> wrote:
>
> Hi, Rudolph & Anders,
>
> Not sure your problem is resolved or not.
>
> I was able to use the diameter sample code with the local/remote mode, i.e.
> Start a diameter server in an erts on a pc, and start a diameter client in
> an erts on another pc (I use virtual machines as pcs here). They can
> communicate different types of diameter messages without problems.
>
> However, when I try to use a diameter client (the sample code) from an erts
> to connect a diameter server which is not running within an erts (other
> diameter server not implemented in erlang). It doesn't work(can not build up
> a connection). I am not quite familiar with the detailed implementation of
> the erlang diameter library now. I am feeling that the erlang diameter
> relies on the erlang nodes, which means all the peers are built up only on
> the erts (distributed erlang runtimes). Does the erlang diameter only work
> within erlang environment? Or in order to talk to other diameter servers,
> does it need to write another erlang client using some functions from the
> erlang diameter library, like encode/decode? The sample client code doesn't
> work in this situation.
>
> I am not sure my understanding above is correct or not. Can you provide some
> guidance?
>
> Thanks,
>
> Samuel
>
>
>
> On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson <anders.otp@REDACTED>
> wrote:
>>
>> One more time to the list ...
>>
>> On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson <anders.otp@REDACTED>
>> wrote:
>> > The problem looks to be that there's an {ssl, false} option being into
>> > diameter_tcp and then down to gen_tcp, which causes it to raise
>> > badarg. What OTP release is this? I can't say I recall the example
>> > code passing this tuple.
>> >
>> > /Anders, Erlang/OTP
>> >
>> >
>> >
>> > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan <rvg.mailing@REDACTED>
>> > wrote:
>> >> Hi there,
>> >>
>> >> I'm trying to start up the Erlang diameter demo application shipped
>> >> with
>> >> Erlang/OTP. The issue is that, no matter what format I try, I can't get
>> >> the
>> >> client to connect to a remote diameter server.
>> >>
>> >> In that example, I started the application as follows:
>> >>
>> >> 3>  diameter:start(), client:start().
>> >> ok
>> >>
>> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}).
>> >> {ok,#Ref<0.0.0.643>}
>> >>
>> >> 7> client:call().
>> >> {error,no_connection}
>> >>
>> >>
>> >> Here, my local IP address is {10,151,0,166} and the remote one is
>> >> {10,249,20,174}.
>> >>
>> >> TCP to the server is working:
>> >>
>> >> telnet 10.249.20.174 3868
>> >> Trying 10.249.20.174...
>> >> Connected to 10.249.20.174.
>> >> Escape character is '^]'.
>> >>
>> >>
>> >> I traced diameter_tcp and I can see that it is getting a badarg error
>> >> somewhere:
>> >>
>> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>,
>> >>                                                    [{10,151,0,166}]}
>> >> (<0.116.0>) call
>> >>
>> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>})
>> >> (<0.116.0>) call
>> >>
>> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>})
>> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok
>> >>
>> >> Does anyone have an idea what I am doing wrong? My feeling is that it
>> >> has to
>> >> do with the local ip address. I don't understand why I even need to
>> >> supply a
>> >> local IP address and the documentation isn't very clear.
>> >>
>> >> Thanks,
>> >>
>> >> Rudolph
>> >>
>> >>
>> >>  Here is the trace:
>> >>
>> >> (<0.84.0>) call diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>})
>> >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>})
>> >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>})
>> >> (<0.116.0>) returned from diameter_tcp:i/1 ->
>> >> {monitor,<0.114.0>,<0.115.0>}
>> >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.116.0>}
>> >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false},
>> >>  {ip,{10,151,0,166}},
>> >>  {raddr,{10,249,20,174}},
>> >>  {rport,3868},
>> >>  {reuseaddr,true}])
>> >> (<0.115.0>) call diameter_tcp:ssl_opts([])
>> >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false
>> >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false,
>> >>                                                  [{ssl,false},
>> >>                                                   {ip,{10,151,0,166}},
>> >>
>> >> {raddr,{10,249,20,174}},
>> >>                                                   {rport,3868},
>> >>                                                   {reuseaddr,true}]}
>> >> (<0.115.0>) call
>> >>
>> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false},
>> >>  {ip,{10,151,0,166}},
>> >>  {raddr,{10,249,20,174}},
>> >>  {rport,3868},
>> >>  {reuseaddr,true}],[])
>> >> (<0.115.0>) call
>> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false},
>> >>  {ip,{10,151,0,166}},
>> >>  {raddr,{10,249,20,174}},
>> >>  {rport,3868},
>> >>  {reuseaddr,true}],[])
>> >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[])
>> >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[])
>> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166}
>> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,151,0,166}
>> >> (<0.115.0>) call diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[])
>> >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[])
>> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174}
>> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,249,20,174}
>> >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}])
>> >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868
>> >> (<0.115.0>) call
>> >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}])
>> >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary,
>> >>                                                       {packet,0},
>> >>                                                       {active,once},
>> >>
>> >> {ip,{10,151,0,166}},
>> >>                                                       {ssl,false},
>> >>                                                       {reuseaddr,true}]
>> >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.115.0>,
>> >>
>> >> [{10,151,0,166}]}
>> >> (<0.115.0>) call
>> >> diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary,
>> >>  {packet,0},
>> >>  {active,once},
>> >>  {ip,{10,151,0,166}},
>> >>  {ssl,false},
>> >>  {reuseaddr,true}])
>> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>,
>> >>                                                    [{10,151,0,166}]}
>> >> (<0.116.0>) call
>> >>
>> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>})
>> >> (<0.116.0>) call
>> >>
>> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>})
>> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok
>> >> (<0.116.0>) call
>> >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg})
>> >> (<0.116.0>) call
>> >>
>> >> diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>})
>> >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> erlang-questions mailing list
>> >> erlang-questions@REDACTED
>> >> http://erlang.org/mailman/listinfo/erlang-questions
>> >>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>



More information about the erlang-questions mailing list