8290349: IP_DONTFRAGMENT doesn't set DF bit in IPv4 header

Reviewed-by: michaelm, alanb
This commit is contained in:
Daniel Jeliński 2022-08-04 10:52:15 +00:00
parent 26e5c112da
commit ce61eb6ff9
9 changed files with 74 additions and 134 deletions

View file

@ -133,11 +133,11 @@ public abstract class ExtendedSocketOptions {
}
/** Sets the value of a socket option, for the given socket. */
public abstract void setOption(FileDescriptor fd, SocketOption<?> option, Object value)
public abstract void setOption(FileDescriptor fd, SocketOption<?> option, Object value, boolean isIPv6)
throws SocketException;
/** Returns the value of a socket option, for the given socket. */
public abstract Object getOption(FileDescriptor fd, SocketOption<?> option)
public abstract Object getOption(FileDescriptor fd, SocketOption<?> option, boolean isIPv6)
throws SocketException;
protected ExtendedSocketOptions(Set<SocketOption<?>> options) {
@ -206,7 +206,7 @@ public abstract class ExtendedSocketOptions {
}
@Override
public void setOption(FileDescriptor fd, SocketOption<?> option, Object value)
public void setOption(FileDescriptor fd, SocketOption<?> option, Object value, boolean isIPv6)
throws SocketException
{
throw new UnsupportedOperationException(
@ -214,7 +214,7 @@ public abstract class ExtendedSocketOptions {
}
@Override
public Object getOption(FileDescriptor fd, SocketOption<?> option)
public Object getOption(FileDescriptor fd, SocketOption<?> option, boolean isIPv6)
throws SocketException
{
throw new UnsupportedOperationException(

View file

@ -402,9 +402,10 @@ public class Net {
// only simple values supported by this method
Class<?> type = name.type();
boolean isIPv6 = (family == StandardProtocolFamily.INET6);
if (extendedOptions.isOptionSupported(name)) {
extendedOptions.setOption(fd, name, value);
extendedOptions.setOption(fd, name, value, isIPv6);
return;
}
@ -451,7 +452,6 @@ public class Net {
}
boolean mayNeedConversion = (family == UNSPEC);
boolean isIPv6 = (family == StandardProtocolFamily.INET6);
setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg, isIPv6);
}
@ -467,7 +467,8 @@ public class Net {
Class<?> type = name.type();
if (extendedOptions.isOptionSupported(name)) {
return extendedOptions.getOption(fd, name);
boolean isIPv6 = (family == StandardProtocolFamily.INET6);
return extendedOptions.getOption(fd, name, isIPv6);
}
// only simple values supported by this method