0N/A#!/bin/sh
0N/A
0N/A#
2362N/A# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
0N/A# published by the Free Software Foundation.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
0N/A#
0N/A
0N/A
0N/A# @test
0N/A# @bug 4773521
0N/A# @build Lookup
0N/A# @run shell lookup.sh
0N/A# @summary Test that reverse lookups of IPv4 addresses work when IPv6
0N/A# is enabled.
0N/A
0N/A# The host that we try to resolve
0N/A
0N/AHOST=javaweb.sfbay.sun.com
0N/A
0N/ACLASSPATH=${TESTCLASSES}
0N/Aexport CLASSPATH
0N/AJAVA="${TESTJAVA}/bin/java"
0N/A
0N/A
0N/A# First check that host resolves to IPv4 address.
0N/A
0N/Aecho ''
0N/AADDR=`$JAVA -Djava.net.preferIPv4Stack=true Lookup -q=A $HOST`
0N/Aif [ $? != 0 ]; then
0N/A echo "$HOST can't be resolved - test skipped."
0N/A exit 0
0N/Afi
0N/Aecho "$HOST --> $ADDR"
0N/A
0N/A
0N/A# IPv4 reverse lookup
0N/Aecho ''
0N/AOUT1=`$JAVA -Djava.net.preferIPv4Stack=true Lookup -q=PTR $ADDR`
0N/Aecho "(IPv4) $ADDR --> $OUT1"
0N/A
0N/A
0N/A# reverse lookup (default)
0N/Aecho ''
0N/AOUT2=`$JAVA Lookup -q=PTR $ADDR`
0N/Aecho "(default) $ADDR --> $OUT2"
0N/A
0N/A
0N/A# Compare results
0N/Aif [ "$OUT1" != "$OUT2" ]; then
0N/A echo ''
0N/A echo "Mistmatch between default and java.net.preferIPv4Stack=true results"
0N/A exit 1
0N/Afi
0N/A