RFR: 8267938: (sctp) SCTP channel factory methods should check platform support

Alan Bateman alanb at openjdk.java.net
Fri May 28 14:35:04 UTC 2021


On Fri, 28 May 2021 13:11:43 GMT, Chris Hegarty <chegar at openjdk.org> wrote:

> The SCTP channel factory methods, namely SctpChannel::open, SctpServerChannel::open, and SctpMultiChannel::open, are specified to throw UnsupportedOperationException, if the SCTP protocol is not supported. Currently, underlying platform support is assumed once the appropriate libsctp.so.1 library is present (along with its supported interface functions). This may not always be the case, e.g. if the Linux sctp kernel module is not present or loaded. In which case a SocketException is thrown.
> 
> It would be more appropriate to check for EPROTONOSUPPORT and ESOCKTNOSUPPORT, and throw UOE rather than SE.
> 
> The existing java/net/SctpSanity.java tests already covers this case, when run on platforms without support.

Marked as reviewed by alanb (Reviewer).

EPROTONOSUPPORT and ESOCKTNOSUPPORT are subtly different and I don't know if ESOCKTNOSUPPORT is possible. Checking both errors is okay/harmless so I think this change is okay.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4246


More information about the net-dev mailing list