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