[sctp-dev] Problem with SCTP_SET_PEER_PRIMARY_ADDR option

Chris Hegarty chris.hegarty at oracle.com
Mon Dec 6 07:28:25 PST 2010


Hi Mehmet,

Unfortunately there is no way of setting the peer primary address on 
Linux (using lksctp) because of CR 7004439 (which I filed for this issue).

What the Java implementation currently does (when setting the peer 
primary address) is that it converts all IPv4 addresses to IPv4-mapped 
addresses. And it does not correctly set the native sock_addr in the 
sctp_setpeerprim struct. I need to resolve this issues in the JDK, but I 
also wanted to understand why IPv4-mapped addresses are not accepted 
when they are for other native calls.

What I will do is create a changeset to resolve the JDK issue as I 
understand lksctp to work today, and follow up with the native 
clarification separately. Either way I guess if lksctp is ever to change 
it would be a some point in the future, and old kernels will always 
behave as they do today.

Please give me a few days and I'll send a code review request copying 
this mailing list. Then the fix will be in a JDK7 promoted build within 
about 2 weeks.

-Chris.

On 12/ 3/10 09:33 PM, Mehmet Aslan wrote:
> Hi Chris,
> Thank you for your kind interest. It would be definitely a pleasure for
> me if it was a contribution in any way.
> I am looking forward to your update.
> By the way, I read your mail in lksctp-developers site. The following
> quotation from your mail is really interesting for my purposes:
> " ... when I use the IPv4 address it appears to work as expected. ..."
>
> For the moment, being able to set the peer primary address using IPv4
> addresses is quite enough for my application. Using the statement in
> your mail as a clue, I tried changing my addresses by using Inet4Address
> class, but I get the same exception again.
> Is there a possibility that you could explain how I can achieve it? Or
> is there a work around to set the peer primary address with the same
> switching time comparable to using the setOption() method.
>
> Sorry for the inconvenience in your busy time, but it is really important.
> Regards,
> MehmetAslan
>
>
> 2010/12/3 Chris Hegarty <chris.hegarty at oracle.com
> <mailto:chris.hegarty at oracle.com>>
>
>     Hi Mehmet,
>
>     There is certainly a bug in the Java implementation where we set
>     SCTP_SET_PEER_PRIMARY_ADDR, but it is not clear to me that the
>     native lksctp stack is behaving as expected. I've sent a mail to the
>     lksctp-developers mailing list to request clarification on the
>     expected behavior of the native call. Once I have clarification I
>     will make the appropriate changes in the JDK.
>
>     I filed a bug, CR 7004439 "(sctp) SCTP_SET_PEER_PRIMARY_ADDR throws
>     SocketException on Linux", against this problem for the JDK.
>
>     Thanks for finding and reporting this issue. I will update this
>     thread (hopefully within the next few days) with more information as
>     it becomes available.
>
>     Thanks,
>     -Chris.
>
>
>     On 02/12/2010 07:57, Mehmet Aslan wrote:
>
>         Hi All,
>         Actually I asked the following question in a reply message to
>         the prior
>         thread. Maybe because this, it did not draw any attention. The
>         problem
>         still exists and I can not go forward and I am not sure if it is a
>         setting issue on SCTP side or if it is a problem in my setup. I
>         will try
>         my chance in a new thread hoping that I can get some useful
>         response, as
>         it happened in the previous thread.
>         Currently,
>
>         net.sctp.addip_noauth_enable = 1
>         net.sctp.addip_enable = 1
>
>         Now, I can bind new addresses to a connected association or
>         unbind any
>         of local addresses from it. However I can not set peer primary
>         address
>         using related setOption() method.
>         The simple scenario and the case;
>         Server                                         Client
>         192.168.1.25 :3456                      192.168.1.25   :6060
>                                                            192.168.1.133
>         :6060
>
>         I would like to change peer primary address from ... .25:6060 to ...
>         .133:6060 instructing from the client side (using
>         setOption(SCTP_SET_PEER_PRIMARY_ADDR, sockAddr). When I applied the
>         instruction, I get a java.net <http://java.net>
>         <http://java.net/> exception. Here are the
>
>         related code parts:
>
>         Server:
>         ...
>         ssc.getOption(SCTP_PRIMARY_ADDR); // This gives out ... .25
>         :6060  as
>         the primary addr
>
>         Client:
>         ...
>         // I want the server to use the other address (... .133 :6060)
>         as the
>         primary address
>         // and I want to make this change by means of an instruction
>         from client
>         side. I use the code below;
>         sockAddr = new InetSocketAddress("192.168.1.133", 6060);
>         sc.setOption(SCTP_SET_PEER_PRIMARY_ADDR, sockAddr);
>         ....
>
>         In the output window of client, at the line of setOption()
>         method I get
>         the following exception and no change in the primary address:
>         "java.net.SocketException: Cannot assign requested address"
>
>         I will appreciate much if an explanation is posted about how I
>         can solve
>         this issue.
>         Additionally, is the following setting enough to enable Dynamic
>         Address
>         Reconfiguration extension completely?
>
>         net.sctp.addip_noauth_enable = 1
>         net.sctp.addip_enable = 1
>
>         Thanks in advance,
>         regards,
>         MehmetAslan
>
>


More information about the sctp-dev mailing list