--- old/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java 2015-11-18 17:26:32.609896511 -0800 +++ new/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java 2015-11-18 17:26:32.509896510 -0800 @@ -44,30 +44,40 @@ } 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 (isClosed()) { 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 { + checkValueType(value, Boolean.class); + 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 (isClosed()) { 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() { @@ -77,6 +87,9 @@ if (flowSupported()) { options.add(ExtendedSocketOptions.SO_FLOW_SLA); } + if (reuseportSupported()) { + options.add(ExtendedSocketOptions.SO_REUSEPORT); + } return options; }