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

source-port is wrongly offsetted when configured to 0, i.e. ephemeral port; results in "Permission denied (Bind failed)"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.0.0.Alpha13
    • 3.0.0.Alpha12
    • Server
    • None

    Description

      There is a discrepancy between how 0 is handled.

      XSD

              <xs:attribute name="source-port" type="xs:positiveInteger" use="optional">
      

      doesn't allow 0.

      MODEL

                  .setAllowExpression(true).setValidator(new IntRangeValidator(0, 65535, true, true))
      

      allows 0.

      IMPLEMENTATION

          public Integer getAbsoluteSourcePort() {
              if (this.sourcePort == null) {
                  return null;
              }
              if (this.fixedSourcePort) {
                  return this.sourcePort;
              }
              final int portOffset = this.socketBindingManager.getPortOffset();
              return this.sourcePort + portOffset;
          }
      

      doesn't treat 0 at all, tests for null value only.

      Example to reproduce e.g. with modcluster integration in core:

      [standalone@localhost:9990 /] /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=proxy1:add(port=9090,host=127.0.0.1,source-port=0
      {
          "outcome" => "success",
          "response-headers" => {"process-state" => "reload-required"}
      }
      [standalone@localhost:9990 /] /subsystem=modcluster/mod-cluster-config=configuration:write-attribute(name=proxies,value=[proxy1])
      {
          "outcome" => "success",
          "response-headers" => {
              "operation-requires-reload" => true,
              "process-state" => "reload-required"
          }
      }
      [standalone@localhost:9990 /] :reload
      {
          "outcome" => "success",
          "result" => undefined
      }
      

      Starting server with

      -Djboss.socket.binding.port-offset=100
      

      yields

      20:15:40,471 ERROR [org.jboss.modcluster] (UndertowEventHandlerAdapter - 1) MODCLUSTER000043: Failed to send INFO command to localhost/127.0.0.1:9090: Permission denied (Bind failed)
      

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-rhusar Radoslav Husar
              rhn-engineering-rhusar Radoslav Husar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: