[jboss-jira] [JBoss JIRA] (WFCORE-2026) source-port is wrongly offsetted when configured to 0, i.e. ephemeral port; results in "Permission denied (Bind failed)"

Radoslav Husar (JIRA) issues at jboss.org
Mon Nov 21 15:01:00 EST 2016


    [ https://issues.jboss.org/browse/WFCORE-2026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13325951#comment-13325951 ] 

Radoslav Husar commented on WFCORE-2026:
----------------------------------------

This is also affecting messaging org.wildfly.extension.messaging.activemq.ActiveMQServerService#start.

> source-port is wrongly offsetted when configured to 0, i.e. ephemeral port; results in "Permission denied (Bind failed)"
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WFCORE-2026
>                 URL: https://issues.jboss.org/browse/WFCORE-2026
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 3.0.0.Alpha12
>            Reporter: Radoslav Husar
>            Assignee: Radoslav Husar
>             Fix For: 3.0.0.Alpha13
>
>
> There is a discrepancy between how 0 is handled.
> XSD
> {noformat}
>         <xs:attribute name="source-port" type="xs:positiveInteger" use="optional">
> {noformat}
> doesn't allow 0.
> MODEL
> {noformat}
>             .setAllowExpression(true).setValidator(new IntRangeValidator(0, 65535, true, true))
> {noformat}
> allows 0.
> IMPLEMENTATION
> {noformat}
>     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;
>     }
> {noformat}
> doesn't treat 0 at all, tests for null value only.
> Example to reproduce e.g. with modcluster integration in core:
> {noformat}
> [standalone at 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 at 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 at localhost:9990 /] :reload
> {
>     "outcome" => "success",
>     "result" => undefined
> }
> {noformat}
> Starting server with 
> {noformat}
> -Djboss.socket.binding.port-offset=100
> {noformat}
> yields
> {noformat}
> 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)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list