You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Shawn Jiang (JIRA)" <ji...@apache.org> on 2009/02/03 06:47:59 UTC

[jira] Created: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Can't bind the connector to localhost or actuall IP correctly.
--------------------------------------------------------------

                 Key: AMQ-2094
                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
             Project: ActiveMQ
          Issue Type: Bug
          Components: Geronimo Integration
    Affects Versions: 5.2.0, 4.1.2
         Environment: Windows XP + SUN JDK 1.5
            Reporter: Shawn Jiang


ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  

* expected result:
** localhost  ---> bind to 127.0.0.1
** actual IP  ----> bind to  actual IP

* actual result:
** localhost  ---> bind to 0.0.0.0
** actual IP  ----> bind to 0.0.0.0


{code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
      InetAddress addr = InetAddress.getByName(host);

       try {
           if (host.trim().equals("localhost") || \
addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
            this.serverSocket = \
serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
           else {
            //#2  start the socket with the ip spcified in addr.
            this.serverSocket = \
serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
{code}
Since if you config the real IP as a host setting, \
addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Jeff Peterson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50158#action_50158 ] 

Jeff Peterson commented on AMQ-2094:
------------------------------------

One other thing to think about: I'm pretty sure that tcp://localhost... is all over the documentation. You may want to consider whether the documentation will need to be updated after this fix.

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Jeff Peterson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52516#action_52516 ] 

Jeff Peterson edited comment on AMQ-2094 at 6/26/09 10:27 PM:
--------------------------------------------------------------

Or how about:

{noformat}
0.0.0.0 --> bind to 0.0.0.0 (e.g. still bind to wildcard)
localhost or 127.0.0.1 --> bind to 127.0.0.1 (only loopback)
actual host name or actual ip --> bind to actual ip
{noformat}

I vote that correct behavior is more important than backwards compatibility.  Adjusting configs/etc is a normal part of the upgrade process.

      was (Author: jpeterson):
    Or how about:

{noformat}
0.0.0.0 --> bind to 0.0.0.0 (e.g. still bind to wildcard)
localhost or 127.0.0.1 --> bind to 127.0.0.1 (only loopback)
actual host name or actual ip --> bind to actual ip
{noformat}
  
> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52895#action_52895 ] 

Gary Tully commented on AMQ-2094:
---------------------------------

+1 to Jeff and leaving the change in place. Localhost != 0.0.0.0  - http://en.wikipedia.org/wiki/Localhost

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "c obrien (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

c  obrien reopened AMQ-2094:
----------------------------


Makes the assumption  InetAddress.getLocalHost() is unambiguous . 
There is some workaround code here:
https://issues.apache.org/jira/browse/JCS-40

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52592#action_52592 ] 

Stan Lewis commented on AMQ-2094:
---------------------------------

Just to add to this, with this change clustering in servicemix requires another step, namely that you've got to change the config to point to 0.0.0.0 instead of localhost, otherwise you see connection refused exceptions as the brokers fail to connect to each other.  The configuration file out of the box should probably specify 0.0.0.0 instead of localhost, that way the previous behavior is preserved (you can connect to the broker remotely) but it's also the correct behavior with regards to the configuration.

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Shawn Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shawn Jiang updated AMQ-2094:
-----------------------------

    Patch Info: [Patch Available]

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "c obrien (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60319#action_60319 ] 

c  obrien edited comment on AMQ-2094 at 6/28/10 10:29 PM:
----------------------------------------------------------

method resolveHostName assumes lookup performed by   InetAddress.getLocalHost() is unambiguous .  
There is some workaround code at the link below that might be of use. 
https://issues.apache.org/jira/browse/JCS-40

      was (Author: cobrien):
    Makes the assumption  InetAddress.getLocalHost() is unambiguous . 
There is some workaround code here:
https://issues.apache.org/jira/browse/JCS-40
  
> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Shawn Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shawn Jiang updated AMQ-2094:
-----------------------------

    Attachment: AMQ-2094.patch

Please help review the patch, thanks.

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Jeff Peterson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50116#action_50116 ] 

Jeff Peterson commented on AMQ-2094:
------------------------------------

Im noticing this behavior as well.  This is an important security problem for us. Please resolve ASAP.

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Jeff Peterson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52516#action_52516 ] 

Jeff Peterson commented on AMQ-2094:
------------------------------------

Or how about:

{noformat}
0.0.0.0 --> bind to 0.0.0.0 (e.g. still bind to wildcard)
localhost or 127.0.0.1 --> bind to 127.0.0.1 (only loopback)
actual host name or actual ip --> bind to actual ip
{noformat}

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52606#action_52606 ] 

Gary Tully commented on AMQ-2094:
---------------------------------

I updated the default xml configuration to use the wildcard 0.0.0.0 address. r790100

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "David Jencks (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Jencks resolved AMQ-2094.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 5.3.0

I applied the patch in rev 749464.  I think Hiram is a bit unconvinced about this patch but the removed code is clearly wrong and I can't see anythign wrong with the patch.

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Colin MacNaughton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colin MacNaughton reopened AMQ-2094:
------------------------------------


I was running some testing with 5.3 today and noticed that specifying localhost no longer binds to 0.0.0.0 (meaning that folks who have configured their brokers to be accessible from other hosts via localhost will no longer be able to connect). From looking at the issue, it seems like the more appropriate fix would be:

localhost --> bind to 0.0.0.0 (e.g. still bind to wildcard)
127.0.0.1 --> bind to 127.0.0.0 (only loopback)
actual host name --> bind to actual ip

        host = (host == null || host.length() == 0) ? "localhost" : host;
        InetAddress addr = InetAddress.getByName(host);

        try {
            if (host.trim().equals("localhost")) {
                this.serverSocket = serverSocketFactory.createServerSocket(bind.getPort(), backlog);
                addr = InetAddress.getLocalHost();
            } else {
                this.serverSocket = serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);
            }
            configureServerSocket(this.serverSocket);

        }

The question is would the ability of specifying 127.0.0.1 explicitly without it resolving to 0.0.0.0 be enough to resolve this?

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50233#action_50233 ] 

Gary Tully commented on AMQ-2094:
---------------------------------

the patch killed a unit test: org.apache.activemq.transport.tcp.SslContextNBrokerServiceTest
The connector URI did not match the address bound. Just committed a fix.

To listen on all interfaces on a host, use the wildcard address: tcp://0.0.0.0:61616

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>             Fix For: 5.3.0
>
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (AMQ-2094) Can't bind the connector to localhost or actuall IP correctly.

Posted by "David Jencks (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Jencks reassigned AMQ-2094:
---------------------------------

    Assignee: David Jencks

> Can't bind the connector to localhost or actuall IP correctly.
> --------------------------------------------------------------
>
>                 Key: AMQ-2094
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2094
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Geronimo Integration
>    Affects Versions: 4.1.2, 5.2.0
>         Environment: Windows XP + SUN JDK 1.5
>            Reporter: Shawn Jiang
>            Assignee: David Jencks
>         Attachments: AMQ-2094.patch
>
>
> ActiveMQ server socket created with TcpTransportServer  can't bind to localhost or actuall IP correctly.  
> * expected result:
> ** localhost  ---> bind to 127.0.0.1
> ** actual IP  ----> bind to  actual IP
> * actual result:
> ** localhost  ---> bind to 0.0.0.0
> ** actual IP  ----> bind to 0.0.0.0
> {code:title="org.apache.activemq.transport.tcp.TcpTransportServer"}  
>       InetAddress addr = InetAddress.getByName(host);
>        try {
>            if (host.trim().equals("localhost") || \
> addr.equals(InetAddress.getLocalHost())) {  //#1 start the socket with 0.0.0.0
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog);  }
>            else {
>             //#2  start the socket with the ip spcified in addr.
>             this.serverSocket = \
> serverSocketFactory.createServerSocket(bind.getPort(), backlog, addr);  }
> {code}
> Since if you config the real IP as a host setting, \
> addr.equals(InetAddress.getLocalHost()) will allways be true so that the #1 will be used to start the socket with 0.0.0.0 by default.  Which causes a defect of geronimo: https://issues.apache.org/jira/browse/GERONIMO-4404

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.