On Sun, 13 Sep 2026 11:03:50 GMT, Alan Bateman <[email protected]> wrote:
>> Lee Jiwon has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> 8392151: Disable IP_TOS support on ServerSocket by default
>
> src/jdk.net/share/classes/jdk/net/Sockets.java line 334:
>
>> 332: }
>> 333: if (Net.isServerSocketIPTosEnabled()) {
>> 334: set.add(StandardSocketOptions.IP_TOS);
>
> I would be tempted to just replace this method with something like the
> following. This would avoid the duplicate and avoids it getting out of sync
> with what each socket type supports.
>
> private static Map<Class<?>, Set<SocketOption<?>>> optionSets() {
> var map = new HashMap<Class<?>, Set<SocketOption<?>>>();
> try (var s = new Socket()) {
> map.put(Socket.class, s.supportedOptions());
> } catch (IOException e) {
> throw new IOError(e);
> }
> try (var s = new ServerSocket()) {
> map.put(ServerSocket.class, s.supportedOptions());
> } catch (IOException e) {
> throw new IOError(e);
> }
> try (var s = new DatagramSocket()) {
> map.put(DatagramSocket.class, s.supportedOptions());
> } catch (IOException e) {
> throw new IOError(e);
> }
> try (var s = new MulticastSocket(null)) {
> map.put(MulticastSocket.class, s.supportedOptions());
> } catch (IOException e) {
> throw new IOError(e);
> }
> return Map.copyOf(map);
> }
On macOS/aarch64, deriving the sets from socket instances adds five options for
`DatagramSocket` (`IP_DONTFRAGMENT`, `SO_BROADCAST`, and the three
`IP_MULTICAST_*` options), and two for `MulticastSocket` (`IP_DONTFRAGMENT` and
`SO_BROADCAST`).
Should I include these changes in this PR and update the CSR, or derive only
the `ServerSocket` set here and handle the others separately?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32808#discussion_r3999496602