mirror of
https://git.savannah.gnu.org/git/inetutils.git
synced 2026-01-12 00:19:39 +08:00
Allow testing without IPv6.
Pass a semaphor to the test scripts to indicate whether to disable IPv6 tests or not.
This commit is contained in:
21
ChangeLog
21
ChangeLog
@@ -1,3 +1,24 @@
|
||||
2015-02-27 Mats Erik Andersson <gnu@gisladisker.se>
|
||||
|
||||
Allow testing without IPv6.
|
||||
Configuration with `--disable-ipv6' as well as individual
|
||||
tests with `TEST_IPV6=no' need to avoid mandatory IPv6.
|
||||
|
||||
* configure.ac (TEST_IPV6): New exported variable.
|
||||
* tests/Makefile.am (tools_subst): Add substitution of TEST_IPV6.
|
||||
* tests/tools.sh.in (TEST_IPV6): New variable.
|
||||
|
||||
* tests/ftp-localhost.sh: Check `$TEST_IPV6 != no' before adding
|
||||
any test cases with IPv6 addressing.
|
||||
* tests/syslogd.sh: Likewise.
|
||||
* tests/telnet-localhost.sh: Likewise.
|
||||
(TARGET46): New variable, defaulting to `::ffff:$TARGET'.
|
||||
|
||||
* tests/tftp.sh (TARGET, TARGET6): New variables.
|
||||
<$ADDRESSES = sense>: Compute this case before building a default
|
||||
address list. Add switch `-a' when executing $IFCONFIG.
|
||||
(ADDRESSES): Start with TARGET, add TARGET6 if `$TEST_IPV6 != no'.
|
||||
|
||||
2015-01-31 Mats Erik Andersson <gnu@gisladisker.se>
|
||||
|
||||
telnet: Printing of uninitialized characters.
|
||||
|
||||
@@ -420,6 +420,7 @@ AC_ARG_ENABLE([ipv6],
|
||||
esac],
|
||||
[ipv6=auto]
|
||||
)
|
||||
AC_SUBST(TEST_IPV6, [$ipv6])
|
||||
|
||||
working_ipv6=yes
|
||||
if test ! "$ipv6" = "no" && test "$working_ipv6" = "yes"; then
|
||||
|
||||
@@ -101,7 +101,8 @@ tools_subst = sed -e 's,[@]GREP[@],$(GREP),g' \
|
||||
-e 's,[@]SED[@],$(SED),g' \
|
||||
-e 's,[@]DD[@],$(DD),g' \
|
||||
-e 's,[@]MKTEMP[@],$(MKTEMP),g' \
|
||||
-e 's,[@]NETSTAT[@],$(NETSTAT),g'
|
||||
-e 's,[@]NETSTAT[@],$(NETSTAT),g'\
|
||||
-e 's,[@]TEST_IPV6[@],$(TEST_IPV6),g'
|
||||
|
||||
tools.sh: tools.sh.in Makefile
|
||||
$(tools_subst) < $(srcdir)/tools.sh.in > $@
|
||||
|
||||
@@ -260,8 +260,6 @@ fi
|
||||
|
||||
cat <<EOT > "$TMPDIR/.netrc"
|
||||
machine $TARGET login $FTPUSER password foobar
|
||||
machine $TARGET6 login $FTPUSER password foobar
|
||||
machine $TARGET46 login $FTPUSER password foobar
|
||||
EOT
|
||||
|
||||
if test $? -ne 0; then
|
||||
@@ -269,6 +267,13 @@ if test $? -ne 0; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if test "$TEST_IPV6" != "no"; then
|
||||
cat <<-EOT >> "$TMPDIR/.netrc"
|
||||
machine $TARGET6 login $FTPUSER password foobar
|
||||
machine $TARGET46 login $FTPUSER password foobar
|
||||
EOT
|
||||
fi
|
||||
|
||||
chmod 600 "$TMPDIR/.netrc"
|
||||
|
||||
# Some simple, but variable content.
|
||||
@@ -466,35 +471,36 @@ $FTP "$TARGET" $PORT -N"$TMPDIR/.netrc" -4 -v -t >$TMPDIR/ftp.stdout 2>&1
|
||||
|
||||
test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET"
|
||||
|
||||
# Test a passive connection: EPSV and IPv6.
|
||||
#
|
||||
echo "EPSV to $TARGET6 (IPv6) using inetd."
|
||||
cat <<STOP |
|
||||
rstatus
|
||||
dir
|
||||
STOP
|
||||
HOME=$TMPDIR $FTP "$TARGET6" $PORT -6 -v -p -t >$TMPDIR/ftp.stdout 2>&1
|
||||
if test "$TEST_IPV6" != "no" && test -n "$TARGET6"; then
|
||||
# Test a passive connection: EPSV and IPv6.
|
||||
#
|
||||
echo "EPSV to $TARGET6 (IPv6) using inetd."
|
||||
cat <<-STOP |
|
||||
rstatus
|
||||
dir
|
||||
STOP
|
||||
HOME=$TMPDIR $FTP "$TARGET6" $PORT -6 -v -p -t >$TMPDIR/ftp.stdout 2>&1
|
||||
|
||||
test_report $? "$TMPDIR/ftp.stdout" "EPSV/$TARGET6"
|
||||
test_report $? "$TMPDIR/ftp.stdout" "EPSV/$TARGET6"
|
||||
|
||||
# Test an active connection: EPRT and IPv6.
|
||||
#
|
||||
echo "EPRT to $TARGET6 (IPv6) using inetd."
|
||||
cat <<STOP |
|
||||
rstatus
|
||||
dir
|
||||
`$do_transfer && test -n "$DLDIR" && echo "\
|
||||
# Test an active connection: EPRT and IPv6.
|
||||
#
|
||||
echo "EPRT to $TARGET6 (IPv6) using inetd."
|
||||
cat <<-STOP |
|
||||
rstatus
|
||||
dir
|
||||
`$do_transfer && test -n "$DLDIR" && echo "\
|
||||
cd $DLDIR"`
|
||||
`$do_transfer && echo "\
|
||||
`$do_transfer && echo "\
|
||||
lcd $TMPDIR
|
||||
image
|
||||
put $GETME $PUTME"`
|
||||
STOP
|
||||
HOME=$TMPDIR $FTP "$TARGET6" $PORT -6 -v -t >$TMPDIR/ftp.stdout 2>&1
|
||||
STOP
|
||||
HOME=$TMPDIR $FTP "$TARGET6" $PORT -6 -v -t >$TMPDIR/ftp.stdout 2>&1
|
||||
|
||||
test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET6"
|
||||
test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET6"
|
||||
|
||||
$do_transfer && \
|
||||
$do_transfer && \
|
||||
if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
|
||||
test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
|
||||
date "+%s" >> "$TMPDIR/$GETME"
|
||||
@@ -502,6 +508,7 @@ $do_transfer && \
|
||||
echo >&2 'Binary transfer failed.'
|
||||
exit 1
|
||||
fi
|
||||
fi # TEST_IPV6
|
||||
|
||||
# Availability of IPv4-mapped IPv6 addresses.
|
||||
#
|
||||
@@ -556,7 +563,8 @@ fi
|
||||
|
||||
# Test functionality of IPv4-mapped IPv6 addresses.
|
||||
#
|
||||
if $have_address_mapping && test -n "$TARGET46" ; then
|
||||
if $have_address_mapping && test -n "$TARGET46" &&
|
||||
test "$TEST_IPV6" != "no"; then
|
||||
# Test a passive connection: EPSV and IPv4-mapped-IPv6.
|
||||
#
|
||||
echo "EPSV to $TARGET46 (IPv4-as-IPv6) using inetd."
|
||||
@@ -610,7 +618,7 @@ put $GETME $PUTME"`
|
||||
else
|
||||
# The IPv4-as-IPv6 tests were not performed.
|
||||
echo 'Skipping two tests of IPv4 mapped as IPv6.'
|
||||
fi
|
||||
fi # have_address_mapping && TEST_IPV6
|
||||
|
||||
# Test name mapping with PASV and IPv4.
|
||||
# Needs a writable destination!
|
||||
|
||||
@@ -429,11 +429,14 @@ if $do_socket_length; then
|
||||
fi
|
||||
|
||||
if $do_inet_socket; then
|
||||
TESTCASES=`expr $TESTCASES + 2`
|
||||
TESTCASES=`expr $TESTCASES + 1`
|
||||
$LOGGER -4 -h "$TARGET:$PORT" -p user.info -t "$TAG" \
|
||||
"Sending IPv4 message. (pid $$)"
|
||||
$LOGGER -6 -h "$TARGET6:$PORT" -p user.info -t "$TAG" \
|
||||
"Sending IPv6 message. (pid $$)"
|
||||
if test "$TEST_IPV6" != "no"; then
|
||||
TESTCASES=`expr $TESTCASES + 1`
|
||||
$LOGGER -6 -h "$TARGET6:$PORT" -p user.info -t "$TAG" \
|
||||
"Sending IPv6 message. (pid $$)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate a more elaborate message routing, aimed at confirming
|
||||
@@ -537,7 +540,6 @@ locate_port $PROTO 514 && do_standard_port=false
|
||||
|
||||
if $do_standard_port; then
|
||||
echo 'Checking also standard port 514/udp.' >&2
|
||||
TESTCASES=`expr $TESTCASES + 2`
|
||||
|
||||
# New configuration, but continuing old message file.
|
||||
rm -f "$PID"
|
||||
@@ -549,10 +551,16 @@ if $do_standard_port; then
|
||||
$SYSLOGD --rcfile="$CONF" --pidfile="$PID" --socket='' \
|
||||
--inet --ipany $OPTIONS
|
||||
sleep 1
|
||||
|
||||
TESTCASES=`expr $TESTCASES + 1`
|
||||
$LOGGER -4 -h "$TARGET" -p user.info -t "$TAG" \
|
||||
"IPv4 to standard port. (pid $$)"
|
||||
$LOGGER -6 -h "$TARGET6" -p user.info -t "$TAG" \
|
||||
"IPv6 to standard port. (pid $$)"
|
||||
|
||||
if test "$TEST_IPV6" != "no"; then
|
||||
TESTCASES=`expr $TESTCASES + 1`
|
||||
$LOGGER -6 -h "$TARGET6" -p user.info -t "$TAG" \
|
||||
"IPv6 to standard port. (pid $$)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Delay detection due to observed race condition.
|
||||
|
||||
@@ -43,6 +43,7 @@ The following environment variables are used:
|
||||
VERBOSE Be verbose, if set.
|
||||
TARGET Receiving IPv4 address.
|
||||
TARGET6 Receiving IPv6 address.
|
||||
TARGET46 Receiving IPv4-mapped-IPV6 address.
|
||||
|
||||
HERE
|
||||
exit 0
|
||||
@@ -61,7 +62,7 @@ ADDRPEEK=${ADDRPEEK:-./addrpeek$EXEEXT}
|
||||
# Selected targets.
|
||||
TARGET=${TARGET:-127.0.0.1}
|
||||
TARGET6=${TARGET6:-::1}
|
||||
TARGET46="::ffff:$TARGET"
|
||||
TARGET46=${TARGET46:-::ffff:$TARGET}
|
||||
|
||||
# Step into `tests/', should the invokation
|
||||
# have been made outside of it.
|
||||
@@ -133,13 +134,18 @@ PORT=`expr 4973 + ${RANDOM:-$$} % 973`
|
||||
|
||||
cat > "$INETD_CONF" <<-EOF ||
|
||||
$TARGET:$PORT stream tcp4 nowait $USER $ADDRPEEK addrpeek addr
|
||||
$TARGET6:$PORT stream tcp6 nowait $USER $ADDRPEEK addrpeek addr
|
||||
EOF
|
||||
{
|
||||
echo 'Could not create configuration file for Inetd. Aborting.' >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if test "$TEST_IPV6" != "no"; then
|
||||
cat >> "$INETD_CONF" <<-EOF
|
||||
$TARGET6:$PORT stream tcp6 nowait $USER $ADDRPEEK addrpeek addr
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Must use '-d' consistently to prevent daemonizing, but we
|
||||
# would like to suppress the verbose output.
|
||||
#
|
||||
@@ -183,7 +189,7 @@ if test -n "$TARGET"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$TARGET6"; then
|
||||
if test "$TEST_IPV6" != "no" && test -n "$TARGET6"; then
|
||||
output=`$TELNET $telnet_opts $TARGET6 $PORT 2>/dev/null`
|
||||
echo "$output" | eval "$GREP 'Your address is $TARGET6.' $display"
|
||||
if test $? -ne 0; then
|
||||
@@ -192,7 +198,7 @@ if test -n "$TARGET6"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$TARGET46"; then
|
||||
if test "$TEST_IPV6" != "no" && test -n "$TARGET46"; then
|
||||
output=`$TELNET $telnet_opts $TARGET46 $PORT 2>/dev/null`
|
||||
echo "$output" | eval "$GREP 'Your address is .*$TARGET.' $display"
|
||||
if test $? -ne 0; then
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
# * (root only) Reload configuration for chrooted mode.
|
||||
# Read one binary file with a relative name, and one ascii
|
||||
# file with absolute location.
|
||||
#
|
||||
# The values of TARGET and TARGET6 replace the loopback addresses
|
||||
# 127.0.0.1 and ::1, whenever the variables are set. However,
|
||||
# Setting the variable ADDRESSES to a list of addresses takes
|
||||
# precedence over all other choices. The particular value "sense"
|
||||
# tries to find all local addresses, then go ahead with these.
|
||||
|
||||
. ./tools.sh
|
||||
|
||||
@@ -139,17 +145,21 @@ posttesting () {
|
||||
|
||||
trap posttesting EXIT HUP INT QUIT TERM
|
||||
|
||||
# Use only "127.0.0.1 ::1" as default address list.
|
||||
# Use only "127.0.0.1 ::1" as default address list,
|
||||
# but take account of TARGET and TARGET6.
|
||||
# Other configured addresses might be set under
|
||||
# strict filter policies, thus might block.
|
||||
#
|
||||
# Allow a setting "ADDRESSES=sense" to compute the
|
||||
# available addresses and then to test them all.
|
||||
ADDRESSES="${ADDRESSES:-127.0.0.1 ::1}"
|
||||
if test "$ADDRESSES" = "sense"; then
|
||||
ADDRESSES=`$IFCONFIG -a | $SED -e "/$AF /!d" \
|
||||
-e "s/^.*$AF \([:.0-9]\{1,\}\) .*$/\1/g"`
|
||||
fi
|
||||
|
||||
if [ "$ADDRESSES" = "sense" ]; then
|
||||
ADDRESSES="`$IFCONFIG | $SED -e "/$AF /!d" \
|
||||
-e "s/^.*$AF \([:.0-9]\{1,\}\) .*$/\1/g"`"
|
||||
if test -z "$ADDRESSES"; then
|
||||
ADDRESSES="${TARGET:-127.0.0.1}"
|
||||
test "$TEST_IPV6" = "no" || ADDRESSES="$ADDRESSES ${TARGET6:-::1}"
|
||||
fi
|
||||
|
||||
# Work around the peculiar output of netstat(1m,solaris).
|
||||
|
||||
@@ -22,6 +22,7 @@ SED=${SED:-@SED@}
|
||||
DD=${DD:-@DD@}
|
||||
MKTEMP=${MKTEMP:-@MKTEMP@}
|
||||
NETSTAT=${NETSTAT:-@NETSTAT@}
|
||||
TEST_IPV6=${TEST_IPV6:-@TEST_IPV6@}
|
||||
|
||||
# Variables for signalling presence of a utility:
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user