--- old/src/java.base/unix/classes/java/net/PlainSocketImpl.java 2015-11-18 17:26:32.869896513 -0800 +++ new/src/java.base/unix/classes/java/net/PlainSocketImpl.java 2015-11-18 17:26:32.768896512 -0800 @@ -58,30 +58,39 @@ } protected void setOption(SocketOption name, T value) throws IOException { - if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) { + if (!(name.equals(ExtendedSocketOptions.SO_FLOW_SLA) + || (name.equals(ExtendedSocketOptions.SO_REUSEPORT)))) { super.setOption(name, value); } else { if (isClosedOrPending()) { throw new SocketException("Socket closed"); } - checkSetOptionPermission(name); - checkValueType(value, SocketFlow.class); - setFlowOption(getFileDescriptor(), (SocketFlow)value); + if (name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) { + checkSetOptionPermission(name); + checkValueType(value, SocketFlow.class); + setFlowOption(getFileDescriptor(), (SocketFlow)value); + } else { + setReusePortOption(getFileDescriptor(), ((Boolean)value).booleanValue()); + } } } @SuppressWarnings("unchecked") protected T getOption(SocketOption name) throws IOException { - if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) { + if (!(name.equals(ExtendedSocketOptions.SO_FLOW_SLA) + || (name.equals(ExtendedSocketOptions.SO_REUSEPORT)))) { return super.getOption(name); } if (isClosedOrPending()) { throw new SocketException("Socket closed"); } - checkGetOptionPermission(name); - SocketFlow flow = SocketFlow.create(); - getFlowOption(getFileDescriptor(), flow); - return (T)flow; + if (name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) { + checkGetOptionPermission(name); + SocketFlow flow = SocketFlow.create(); + getFlowOption(getFileDescriptor(), flow); + return (T)flow; + } + return (T)getReusePortOption(getFileDescriptor()); } protected Set> supportedOptions() { @@ -91,6 +100,9 @@ if (getSocket() != null && flowSupported()) { options.add(ExtendedSocketOptions.SO_FLOW_SLA); } + if (getSocket() != null && reuseportSupported()) { + options.add(ExtendedSocketOptions.SO_REUSEPORT); + } return options; }