Re: [mobicents-public] Could not connect using SCTP

1,317 views
Skip to first unread message

Richard Good

unread,
Mar 14, 2013, 9:36:31 AM3/14/13
to mobicent...@googlegroups.com
Hi

Please turn on full trace debugging for org.jdiameter and org.mobicents.protocols.sctp and paste the log for a failed connection.

Regards
Richard.


On 13 March 2013 20:24, Domingos <luciano.a...@gmail.com> wrote:
Hi,

I,m trying to use Mobicents Diameter API to construct a HSS. It's working fine with TCP connections, but when I tried SCTP, my client (I'm using Seagull as  client) could not connect.
I would appreciate any help.


My jdiamenter-config.xml:

<Network>
    <Peers>
<!-- For SCTP we have to add portRange, a port range to use for establishing connections -->
        <Peer name="aaa://172.16.100.52:3868" portRange="30000-50000" attempt_connect="false" rating="1" />

    <Realms>
      ...

  </Network>

     <Extensions>
        <Connection value="org.jdiameter.client.impl.transport.sctp.SCTPClientConnection"/>
        <NetworkGuard value="org.jdiameter.server.impl.io.sctp.NetworkGuard"/>
    </Extensions>

The error message:

[Thread-6] WARN  org.mobicents.protocols.sctp.SelectorThread (SelectorThread.java:357) - Received connect request from non provisioned 172.16.100.52:39350 address. Closing Channel


--
You received this message because you are subscribed to the Google Groups "mobicents-public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobicents-publ...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.






This email is subject to the disclaimer of Smile Communications (PTY) Ltd. at http://www.smilecoms.com/disclaimer

Domingos

unread,
Mar 15, 2013, 1:37:30 PM3/15/13
to mobicent...@googlegroups.com
Hi,

I´ve found 2 scenarios
When the stack starts and the file server-management-ip-sctp.xml does not exist. (log1.txt)
When the stack starts and the file server-management-ip-sctp.xml exist (log2.txt)

Thanks in advance.
log1.txt
log2.txt
server-jdiameter-config.xml
server-management-172.16.100.122.3868_sctp.xml

Domingos

unread,
Jun 7, 2013, 3:43:57 PM6/7/13
to mobicent...@googlegroups.com
Hi,

After long time, I'm back to this problem. Well, I've done some tests with Seagull and a client using jdiameter stack.
With the jdiameter client, I have the following message sequence:

client                                 server
                  init ->
<- init_ack
cookie_echo ->
<- cookie_ack
<- shutdown
shutdown_ack ->
<- shutdown_complete
At this point I have one question: Why the server sends shut down ? Because it's a anonymous connection?
Server log:

16:40:27,997 [Thread-5] DEBUG org.jdiameter.server.impl.MutablePeerTableImpl$4 (MutablePeerTableImpl.java:370) - newNetworkConnection. connection [aaa://172.16.100.52:40113]
16:40:27,998 [Thread-5] DEBUG org.jdiameter.server.impl.MutablePeerTableImpl$4 (MutablePeerTableImpl.java:512) - Inserted connection [aaa://172.16.100.52:40113] into IncConnections
16:40:27,998 [Thread-5] DEBUG org.jdiameter.server.impl.MutablePeerTableImpl$4 (MutablePeerTableImpl.java:515) - Added listener [org.jdiameter.server.impl.MutablePeerTableImpl$4$1@135d7ad] to connection [aaa://172.16.100.52:40113]
16:40:27,999 [Thread-5] INFO  org.mobicents.protocols.sctp.SelectorThread (SelectorThread.java:324) - Rejected anonymous Association [name=null, associationType=ANONYMOUS_SERVER, ipChannelType=SCTP, hostAddress=null, hostPort=0, peerAddress=172.16.100.52, peerPort=40113, serverName=vm1.build.lab-adrims:3868, extraHostAddress=[]]


After this the client starts the sctp protocol again, now with success.

client                                server
init ->
<- init_ack
cookie_echo ->
<- cookie_ack
CER ->
<- sack
<- CEA
sack ->

16:40:28,501 [Thread-5] INFO  org.mobicents.protocols.sctp.SelectorThread (SelectorThread.java:269) - Connected Association [name=172.16.100.52:40113, associationType=SERVER, ipChannelType=SCTP, hostAddress=null, hostPort=0, peerAddress=172.16.100.52, peerPort=40113, serverName=vm1.build.lab-adrims:3868, extraHostAddress=[]]
16:40:28,502 [Thread-5] INFO  org.mobicents.protocols.sctp.AssociationHandler (AssociationHandler.java:79) - New association setup for Association=172.16.100.52:40113 with 10 outbound streams, and 32 inbound streams.

16:40:28,503 [Thread-5] DEBUG jdiameter.server.impl.io.sctp.SCTPTransportServer$ServerAssociationListener (SCTPTransportServer.java:209) - onCommunicationUp called for [org.jdiameter.server.impl.io.sctp.SCTPTransportServer$ServerAssociationListener@1c821b9]
16:40:28,504 [Thread-5] DEBUG jdiameter.server.impl.io.sctp.SCTPServerConnection (SCTPServerConnection.java:302) - In onEvent for connection [aaa://172.16.100.52:40113]. Getting lock

Now, using Seagull as a client:
 
client                                 server
                  init ->
<- init_ack
cookie_echo ->
<- cookie_ack
CER->
<-SACK
<-ABORT

In this case Seagull does not restarts the sctp protocol, finishing the task with error.
It seems to me that the sctp protocol is ok, but there is some issue on jdiameter implementation that is making impossible the server use with a Seagull client.

Domingos

unread,
Jun 11, 2013, 9:11:50 AM6/11/13
to mobicent...@googlegroups.com
I found a solution for this issue, but I had to change the code of SelectorThread class.
The problem is related with initialization of anonymAssociation variable.
I'd like to know if my changes are correct and if it can be incorporated on sctp-impl code.

Another point changed is concerned the initialization of ServerImpl class in order to accept anonymous connections when the server-management*_sctp.xml file already exists.

I'm sending the files changed.
SelectorThread.java
ServerImpl.java

Sergey Vetyutnev

unread,
Jun 13, 2013, 3:24:46 PM6/13/13
to mobicent...@googlegroups.com
Hello!

Can you please explain your changes (in SelectorThread and ServerImpl). It is too difficult to me to compare a currecnt code version and your files. What has been changed?

Domingos

unread,
Jun 14, 2013, 8:33:07 AM6/14/13
to mobicent...@googlegroups.com
Hello,

I've changed the code in order to achieve my objective, that is accept a anonymous connection.
I got the 1.4.0-SNAPSHOT version of sctp-impl component.
I'm not familiarized with all the code so I can't assure that I found the better way, but it's working for me.

On SelectorThread class, I changed the doAccept method.

Orignal code:

try {
this.management.getServerListener().onNewRemoteConnection(srv, anonymAssociation);
} catch (Throwable e) {
logger.warn(String.format("Exception when invoking ServerListener.onNewRemoteConnection() Ass=%s", anonymAssociation), e);
try {
socketChannel.close();
} catch (Exception ee) {
}
return;
}
if (!anonymAssociation.isStarted()) {
// connection is rejected
logger.info(String.format("Rejected anonymous %s", anonymAssociation));
try {
socketChannel.close();
} catch (Exception ee) {
}
return;
}
I added some lines, to get a anonymous association created:

try {
this.management.getServerListener().onNewRemoteConnection(srv, anonymAssociation);
} catch (Throwable e) {
logger.warn(String.format("Exception when invoking ServerListener.onNewRemoteConnection() Ass=%s", anonymAssociation), e);
try {
socketChannel.close();
} catch (Exception ee) {
}
return;
}
// changes begin
// get anonymAssociation created
try {
   AssociationImpl tmpAssociation = (AssociationImpl)this.management.getAssociation(anonymAssociation.getPeerAddress() +":"+anonymAssociation.getPeerPort());
        if (tmpAssociation != null) {
tmpAssociation.setSocketChannel(socketChannel);
            tmpAssociation.setManagement(this.management);
            anonymAssociation = tmpAssociation;
        }
    } catch (Exception e) {
        logger.error(String.format("Rejected anonymous %s", anonymAssociation), e);
    }
// changes - end
if (!anonymAssociation.isStarted()) {
// connection is rejected
logger.info(String.format("Rejected anonymous %s", anonymAssociation));
try {
socketChannel.close();
} catch (Exception ee) {
}
return;
}

On ServerImpl the attribute acceptAnonymousConnections was initialized with true value, so by default the server must accept anonymous connection:
Original code:
    
private String name;
private String hostAddress;
private int hostport;
private volatile boolean started = false;
private IpChannelType ipChannelType;
private boolean acceptAnonymousConnections;
private int maxConcurrentConnectionsCount;
private String[] extraHostAddresses;

private ManagementImpl management = null;


My change:

private String name;
private String hostAddress;
private int hostport;
private volatile boolean started = false;
private IpChannelType ipChannelType;
private boolean acceptAnonymousConnections = true; // changed
private int maxConcurrentConnectionsCount;
private String[] extraHostAddresses;

private ManagementImpl management = null;

Sergey Vetyutnev

unread,
Jun 14, 2013, 5:03:26 PM6/14/13
to mobicent...@googlegroups.com
Hello!

I still do not understand what target does this code has, sorry.
If your server supports anonymous connections it should accept them without this code, or I am mistaken ?

Domingos

unread,
Jun 17, 2013, 3:34:40 PM6/17/13
to mobicent...@googlegroups.com
Hello,

As I had said in my posts, there is a problem related with anonymous associations.
The problem arise when a new anonymous association is created, the SelectorThread puts the log message 
"Rejected anonymous <anonymous association name>" and close the socket channel.
 
On doAccept method, in the SelectorThread class, when a new anonymous connection arrives, a AssociationImpl object is
created:

 "AssociationImpl anonymAssociation = new AssociationImpl(firstInetAddress.getHostAddress(), firstPort, srv.getName(),
srv.getIpChannelType(), srvv);"
After this, this object "anonymAssociation" is passed as a parameter on method "onNewRemoteConnection" : 

" try {
this.management.getServerListener().onNewRemoteConnection(srv, anonymAssociation);
} "
Inside this method, a new AssociationImpl object is created and started (inside ManagementImpl class).
After this the method returns and the SelectorThread verifies if the anonymous association is started:

" if (!anonymAssociation.isStarted()) {
// connection is rejected
logger.info(String.format("Rejected anonymous %s", anonymAssociation));
try { "

The problem is that this object "anonymAssociation" does not change. As I told early, a new  AssociationImpl object is created and started.
So, I use the anonymous association identification to get the AssociationImpl object that was created:

"
// changes begin
// get anonymAssociation created
try {
   AssociationImpl tmpAssociation = (AssociationImpl)this.management.getAssociation(anonymAssociation.getPeerAddress() +":"+anonymAssociation.getPeerPort());
        if (tmpAssociation != null) {
            tmpAssociation.setSocketChannel(socketChannel);
            tmpAssociation.setManagement(this.management);
            anonymAssociation = tmpAssociation;
        }
    } catch (Exception e) {
logger.error(String.format("Rejected anonymous %s", anonymAssociation), e);
    }
// changes - end

Now the test "if (!anonymAssociation.isStarted())" will not fail, because now I'm using a correct object.

Tharaka Devinda

unread,
Jun 4, 2014, 7:18:37 AM6/4/14
to mobicent...@googlegroups.com
Hi guys, is there an easy way to implement this to an existing server? do I need to download the entire mobicents jboss AS code and compile it for this to work?

Alexandre Mendonça

unread,
Jun 22, 2014, 12:31:14 PM6/22/14
to Mobicents Public
Hi,

I am not following if the changes are required or not, but in case they are all you need to get and recompile is the mobicents sctp library.

Regards,


--
You received this message because you are subscribed to the Google Groups "mobicents-public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobicents-publ...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tharaka Devinda

unread,
Jun 23, 2014, 6:58:10 AM6/23/14
to mobicent...@googlegroups.com
I did recompile. I had to do some tweaks regarding the acceptance of anonymous connections. in SelectorThread.java

//if (!provisioned && srv.isAcceptAnonymousConnections() && this.management.getServerListener() != null) {
//The mux will now accept all anon connections with no questions asked
if (!provisioned && this.management.getServerListener() != null) {

I don't know why this is happening. Maybe because there is no way to tell the sctp library from the jdiameter config file, about the acceptance of anon connections.

I was super frustrated about this. But, at last works.

Sergey Vetyutnev

unread,
Jun 23, 2014, 7:19:11 AM6/23/14
to mobicent...@googlegroups.com
Hello, Domingos!

Sorry for a late response, but the topic is still interenting for me.

> Inside this method, a new AssociationImpl object is created and started (inside ManagementImpl class).
It looks like I understand now why you create a new AssociationImpl inside "onNewRemoteConnection(srv, anonymAssociation);" instead of using an Assiciation that is created in SelectorThread.doAccept()
You just add this new assiciation into an association list of SCTP ManagementImpl (or I am mistaken ?)

1) You do not need to use addAssociation() or addServerAssociation() methods of ManagementImpl for any new incoming anonymous Association. Instead of this you need to use the Association that is come into a method "onNewRemoteConnection(srv, anonymAssociation);"
Also a method "this.management.getAssociation()" will not return any Assiciation for all established incoming anonymous Associations.

2) The popurse of the method "onNewRemoteConnection(srv, anonymAssociation);" is an asking for an user application if the user application wants to to accept a new anonymous Association or not.

3) If you are still insisting on using "addAssociation() or addServerAssociation()" inside "onNewRemoteConnection(srv, anonymAssociation);", can you please explain why you can not use "regular" using of SCTP stack ?
Reply all
Reply to author
Forward
0 new messages