public static boolean isActiveStackLoopbackIP(String ipAddress) {
    if (preferIPv4Stack) {
      // IPv6 stack is completely disabled on Java side
      return LOOPBACK_ADDRESS_IPV4.equals(ipAddress);
    } else if (preferIPv6Addresses) {
      // Dual stack is enabled, and IPv6 addresses are preferred
      return LOOPBACK_ADDRESSES_IPV6.contains(ipAddress);
    } else {
      // Dual stack is enabled, and IPv6 addresses are not preferred
      return LOOPBACK_ADDRESS_IPV4.equals(ipAddress);
    }
  }
Check if the provided IP address is a loopback interface for the active IP stack.
@return boolean
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/common/IPStackUtils.java