Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-4699

preferIPv6Addresses and preferIPv4Stack System Properties are Mishandled in the Config


    • Hide

      1. Disable IPv6 in the kernel:

      1. sysctl -w net.ipv6.conf.all.disable_ipv6=1
      2. sysctl -w net.ipv6.conf.default.disable_ipv6=1

      2. Start JBoss EAP:

      $ standalone.sh -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true -b

      1. Disable IPv6 in the kernel: sysctl -w net.ipv6.conf.all.disable_ipv6=1 sysctl -w net.ipv6.conf.default.disable_ipv6=1 2. Start JBoss EAP: $ standalone.sh -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true -b

      Error is thrown on startup.

      Caused by: java.net.SocketException: Protocol family unavailable
      at sun.nio.ch.Net.bind0(Native Method)
      at sun.nio.ch.Net.bind(Net.java:433)
      at sun.nio.ch.Net.bind(Net.java:425)
      at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
      at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
      at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:179)
      at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:310)
      at io.undertow.protocols.ssl.UndertowXnioSsl.createSslConnectionServer(UndertowXnioSsl.java:301)
      at org.wildfly.extension.undertow.HttpsListenerService.startListening(HttpsListenerService.java:127)

      The customer ships a turn key solution that has the two system properties set: -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true because they are needed for some cases for customers running IPv6, but others want to harden their systems by disabling IPv4.

      This works on JBoss EAP 6, but it throws the error on JBoss EAP 7 on the same version of Java. Furthermore, adding just Djava.net.preferIPv4Stack=false has the same issue, even though it the default value, while leaving it off starts.

      This appears to be related to controller/src/main/java/org/jboss/as/controller/interfaces/OverallInterfaceCriteria.java#pruneIPTypes where if both properties are null, it leaves the set of candidate addresses alone, but it either are set, it strips out all IPv4 addresses.

            rhn-support-tmiyargi Teresa Miyar Gil (Inactive)
            rhn-support-tmiyargi Teresa Miyar Gil (Inactive)
            0 Vote for this issue
            1 Start watching this issue