glassfish
  1. glassfish
  2. GLASSFISH-18404

RoundRobinPolicy.getAddressPortList does not support IPV6

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0_b84_RC1
    • Component/s: orb
    • Labels:
      None
    • Environment:

      windows

      Description

      all of the V2,V3 and V4 have the method of RoundRobinPolicy.getAddressPortList,in the enviroment of V3 and V4 have the following code

       for (InetAddress addr : addresses) {
          if (addr instanceof Inet4Address) {
               addrs.add( addr ) ;
          }
      }

      but there is not above code in the enviroment of V2.

      Beacause of add these codes ,the V3 and V4 do not support IPV6.So I do not know why need to add these codes.
      If I add following code,the V3 and V4 will support IPV6?

       for (InetAddress addr : addresses) {
          if (addr instanceof Inet6Address) {
               addrs.add( addr ) ;
          }
      }

        Activity

        Hide
        Cheng Fang added a comment -

        Posting the complete method here. Note the comment about not supporting IPv6. Not sure why.

            public List<String> getAddressPortList(String host, String port) {
                // Get the ip addresses corresponding to the host.
                // XXX this currently does NOT support IPv6.
                try {
                    InetAddress [] addresses = InetAddress.getAllByName(host);
                    List<InetAddress> addrs = new ArrayList<InetAddress>() ;
                    for (InetAddress addr : addresses) {
                        if (addr instanceof Inet4Address) {
                            addrs.add( addr ) ;
                        }
                    }
        
                    List<String> ret = new ArrayList<String>() ;
                    for (InetAddress addr : addrs) {
                        ret.add( addr.getHostAddress() + ":" + port ) ;
                    }
        
                    // We return a list of <IP ADDRESS>:<PORT> values
                    return ret;
                } catch (UnknownHostException ukhe) {
                    warnLog( "unknown.host", host, ukhe.getMessage() );
                    return new ArrayList<String>() ;
                }
            }
        

        The change is part of the following commit:
        r41437 | kcavanaugh | 2010-10-06 17:17:04 -0400 (Wed, 06 Oct 2010) | 6 lines
        Changed paths:
        M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GroupInfoServiceObserverImpl.java
        M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RoundRobinPolicy.java
        M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContext.java
        M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContextProviderImpl.java
        M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialInitContextFactory.java
        M /trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java
        M /trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java
        M /trunk/v3/pom.xml
        M /trunk/v3/security/ejb.security/src/main/java/com/sun/enterprise/iiop/security/SecIORInterceptor.java

        Re(re)-integration of IIOP FOLB.

        • Fixed a problem in IiopFolbGmsClient that cause the QL failure
        • Also integrating the (corrected) ORB b007.

        QL tests all passed this time (I missed one failure last time).

        Show
        Cheng Fang added a comment - Posting the complete method here. Note the comment about not supporting IPv6. Not sure why. public List<String> getAddressPortList(String host, String port) { // Get the ip addresses corresponding to the host. // XXX this currently does NOT support IPv6. try { InetAddress [] addresses = InetAddress.getAllByName(host); List<InetAddress> addrs = new ArrayList<InetAddress>() ; for (InetAddress addr : addresses) { if (addr instanceof Inet4Address) { addrs.add( addr ) ; } } List<String> ret = new ArrayList<String>() ; for (InetAddress addr : addrs) { ret.add( addr.getHostAddress() + ":" + port ) ; } // We return a list of <IP ADDRESS>:<PORT> values return ret; } catch (UnknownHostException ukhe) { warnLog( "unknown.host", host, ukhe.getMessage() ); return new ArrayList<String>() ; } } The change is part of the following commit: r41437 | kcavanaugh | 2010-10-06 17:17:04 -0400 (Wed, 06 Oct 2010) | 6 lines Changed paths: M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GroupInfoServiceObserverImpl.java M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RoundRobinPolicy.java M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContext.java M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContextProviderImpl.java M /trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialInitContextFactory.java M /trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java M /trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java M /trunk/v3/pom.xml M /trunk/v3/security/ejb.security/src/main/java/com/sun/enterprise/iiop/security/SecIORInterceptor.java Re(re)-integration of IIOP FOLB. Fixed a problem in IiopFolbGmsClient that cause the QL failure Also integrating the (corrected) ORB b007. QL tests all passed this time (I missed one failure last time).
        Hide
        Cheng Fang added a comment -

        Harshad, can you take a look from orb side?

        Show
        Cheng Fang added a comment - Harshad, can you take a look from orb side?
        Hide
        lzg5039 added a comment -

        Because there is bug of GLASSFISH-19428 in the glassfish v3/v4,so glassfish v3/v4 does not support IPV6.
        If the GLASSFISH-19428 is fixed,v3/v4 will support IPV6. But the method of RoundRobinPolicy.getAddressPortList still only add IPV4 address to list,so I modify the RoundRobinPolicy.getAddressPortList as following(I modify the code which is marked ★)

         
            public List<String> getAddressPortList(String host, String port) {
                // Get the ip addresses corresponding to the host.
                // XXX this currently does NOT support IPv6.
                try {
                    InetAddress [] addresses = InetAddress.getAllByName(host);
                    List<InetAddress> addrs = new ArrayList<InetAddress>() ;
                    for (InetAddress addr : addresses) {
                        // add "|| addr instanceof Inet6Address", it will add IPV6 address to addrs
                        if (addr instanceof Inet4Address || addr instanceof Inet6Address) { ★
                            addrs.add( addr ) ;
                        }
                    }
        
                    List<String> ret = new ArrayList<String>() ;
                    for (InetAddress addr : addrs) {
                        ret.add( addr.getHostAddress() + ":" + port ) ;
                    }
        
                    // We return a list of <IP ADDRESS>:<PORT> values
                    return ret;
                } catch (UnknownHostException ukhe) {
                    warnLog( "unknown.host", host, ukhe.getMessage() );
                    return new ArrayList<String>() ;
                }
        

        }

        Show
        lzg5039 added a comment - Because there is bug of GLASSFISH-19428 in the glassfish v3/v4,so glassfish v3/v4 does not support IPV6. If the GLASSFISH-19428 is fixed,v3/v4 will support IPV6. But the method of RoundRobinPolicy.getAddressPortList still only add IPV4 address to list,so I modify the RoundRobinPolicy.getAddressPortList as following(I modify the code which is marked ★) public List<String> getAddressPortList(String host, String port) { // Get the ip addresses corresponding to the host. // XXX this currently does NOT support IPv6. try { InetAddress [] addresses = InetAddress.getAllByName(host); List<InetAddress> addrs = new ArrayList<InetAddress>() ; for (InetAddress addr : addresses) { // add "|| addr instanceof Inet6Address", it will add IPV6 address to addrs if (addr instanceof Inet4Address || addr instanceof Inet6Address) { ★ addrs.add( addr ) ; } } List<String> ret = new ArrayList<String>() ; for (InetAddress addr : addrs) { ret.add( addr.getHostAddress() + ":" + port ) ; } // We return a list of <IP ADDRESS>:<PORT> values return ret; } catch (UnknownHostException ukhe) { warnLog( "unknown.host", host, ukhe.getMessage() ); return new ArrayList<String>() ; } }
        Hide
        Harshad Vilekar added a comment -
        • What is the impact on the customer of the bug? Support literal ipv6 address in IIOP endpoint list.

        How likely is it that a customer will see the bug and how serious is the bug? Only when using ipv6 address, rather than host name.

        • Is it a regression? Does it meet other bug fix criteria (security, performance, etc.)? Not a regression.
        • What CTS failures are caused by this bug? No CTS failures.
        • What is the cost/risk of fixing the bug? Fix is ready, under regression test.

        How risky is the fix? How much work is the fix? Is the fix complicated? Fix is isolated. Not very complex.

        • Is there an impact on documentation or message strings? No.
        • Which tests should QA (re)run to verify the fix did not destabilize GlassFish? Cluster Tests with Remote EJB Apps.
        • Which is the targeted build of 4.0 for this fix? b84
        • Is this an integration of a new version of a component from another project ? No
        Show
        Harshad Vilekar added a comment - What is the impact on the customer of the bug? Support literal ipv6 address in IIOP endpoint list. How likely is it that a customer will see the bug and how serious is the bug? Only when using ipv6 address, rather than host name. Is it a regression? Does it meet other bug fix criteria (security, performance, etc.)? Not a regression. What CTS failures are caused by this bug? No CTS failures. What is the cost/risk of fixing the bug? Fix is ready, under regression test. How risky is the fix? How much work is the fix? Is the fix complicated? Fix is isolated. Not very complex. Is there an impact on documentation or message strings? No. Which tests should QA (re)run to verify the fix did not destabilize GlassFish? Cluster Tests with Remote EJB Apps. Which is the targeted build of 4.0 for this fix? b84 Is this an integration of a new version of a component from another project ? No
        Hide
        Tom Mueller added a comment -

        Approved for 4.0.

        Show
        Tom Mueller added a comment - Approved for 4.0.
        Hide
        Harshad Vilekar added a comment -

        Reviewed and Committed the fix suggested by lzg5039. svn revision #61237.

        Show
        Harshad Vilekar added a comment - Reviewed and Committed the fix suggested by lzg5039. svn revision #61237.

          People

          • Assignee:
            Harshad Vilekar
            Reporter:
            lzg5039
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: