[erlang-questions] DIAMETER: sharing connections between applications

Andreas Schultz aschultz@REDACTED
Tue Jan 26 10:49:21 CET 2016


Hi,

I have a problem where a transport connection between client
should be shared by multiple DIAMETER application. It does work
when the transport is added once, but when I add the a transport
for the same destination twice with different application restrictions,
the connection will not be established and the error event will
contain bogus error reasons.

The following example is a bit contrived, but reflects the real
use case as close as possible.

start() ->
    SvcName = ?MODULE,
    SvcOpts = [{'Origin-Host', <<"host.local">>},
	       {'Origin-Realm', <<"realm.local">>},
	       {'Origin-State-Id', diameter:origin_state_id()},
	       {'Host-IP-Address', [{127,0,0,1}]},
	       {'Vendor-Id', 1234},
	       {'Product-Name', "Client"},
	       {'Auth-Application-Id', [1, 4]},
	       {string_decode, false},
	       {application, [{alias, nas},
			      {dictionary, rfc4005_nas},
			      {module, nas_cb}]},
	       {application, [{alias, cc},
			      {dictionary, rfc4006_cc},
			      {module, cc_cb}]}],

    diameter:subscribe(SvcName),

    ok = diameter:start_service(SvcName, SvcOpts),

    TransportOpts = [{transport_module, diameter_sctp},
                     {transport_config, [{raddr, {127,0,0,1}},
		                         {rport, 1234}]}],

    {ok, _} = diameter:add_transport(SvcName, {connect, [{applications, [1]} | TransportOpts]}),
    {ok, _} = diameter:add_transport(SvcName, {connect, [{applications, [4]} | TransportOpts]}),

    ok.

This sample will fail to establish the connections if the remote side
supports only one of the applications and report an diameter event:

#diameter_event{
    info =
        {closed,#Ref<0.0.8.1>,
            {'CEA',
                #diameter_base_CEA{ ... },
                #diameter_service{ ... },
                diameter_gen_base_rfc3588,
                {app_not_configured,4}},
...
}

The value for 'app_not_configured' is bogus and contains either 1 or 4 in
this example and has no relation to what the other side supports.

The sample works when I'm call the add_transport only once without application
restriction.

According to the documentation, the 'applications' options will restrict the
transport to the specified id. So why does it acct like are 'require'
when used with multiple add_transport?

Andreas 



More information about the erlang-questions mailing list