Merging upstream version 2.10.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 09:05:05 +01:00
parent aa5ead0b5b
commit ab9af27b84
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
56 changed files with 405 additions and 112 deletions

View file

@ -1,9 +1,15 @@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
CLEANFILES = test*.log test*.trs \
test2.out test4.out test4err.out key.pem cert.pem test6.out
test2.out test4.out test4err.out key.pem cert.pem test6.out \
10queries.tmp.blob 10queries.tmp.out empty.out emptypayload.out \
largesttcp.out largestudp.out missingpayload.out querywithcookie.out \
shortpayload.out tooshortlength.out twoquerieswithnsid.out
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh test7.sh
EXTRA_DIST = $(TESTS) \
datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6
datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6 \
empty.blob emptypayload.blob largesttcp.blob largestudp.blob \
missingpayload.blob querywithcookie.blob shortpayload.blob \
tooshortlength.blob twoquerieswithnsid.blob

View file

@ -465,11 +465,17 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
CLEANFILES = test*.log test*.trs \
test2.out test4.out test4err.out key.pem cert.pem test6.out
test2.out test4.out test4err.out key.pem cert.pem test6.out \
10queries.tmp.blob 10queries.tmp.out empty.out emptypayload.out \
largesttcp.out largestudp.out missingpayload.out querywithcookie.out \
shortpayload.out tooshortlength.out twoquerieswithnsid.out
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh
TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh test7.sh
EXTRA_DIST = $(TESTS) \
datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6
datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6 \
empty.blob emptypayload.blob largesttcp.blob largestudp.blob \
missingpayload.blob querywithcookie.blob shortpayload.blob \
tooshortlength.blob twoquerieswithnsid.blob
all: all-am
@ -701,6 +707,13 @@ test6.sh.log: test6.sh
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
test7.sh.log: test7.sh
@p='test7.sh'; \
b='test7.sh'; \
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
@p='$<'; \
$(am__set_b); \

0
src/test/empty.blob Normal file
View file

BIN
src/test/emptypayload.blob Normal file

Binary file not shown.

1
src/test/largesttcp.blob Normal file

File diff suppressed because one or more lines are too long

1
src/test/largestudp.blob Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

BIN
src/test/shortpayload.blob Normal file

Binary file not shown.

83
src/test/test7.sh Executable file
View file

@ -0,0 +1,83 @@
#!/bin/sh -xe
# expect non-zero exit code
malformed_input_fmt() {
FILESTEM="$1"
! ../dnsperf -vvv -B -d "$srcdir/$FILESTEM.blob" > "$FILESTEM.out" 2>&1
grep -F "Error: input file contains no data" "$FILESTEM.out"
}
malformed_input_fmt "empty"
malformed_input_fmt "tooshortlength"
malformed_input_fmt "missingpayload"
test "$TEST_DNSPERF_WITH_NETWORK" = "1" || exit 0
check_sent_and_lost() {
FILESTEM="$1"
EXPECTEDCOUNT="$2"
grep "Queries sent: $EXPECTEDCOUNT$" "$FILESTEM.out"
grep -F "Queries lost: $EXPECTEDCOUNT (" "$FILESTEM.out"
}
# send to an address which does not reply anyway;
# typically for weird blobs which do not even have DNS header - so we cannot expect a response
blackhole() {
FILESTEM="$1"
EXTRAARGS="$2"
EXPECTEDCOUNT="$3"
../dnsperf -t 0.001 -vvv -B -d "$srcdir/$FILESTEM.blob" -s 192.0.2.1 $EXTRAARGS > "$FILESTEM.out" 2>&1
check_sent_and_lost "$FILESTEM" "$EXPECTEDCOUNT"
}
blackhole2() {
FILESTEM="$1"
EXTRAARGS="$2"
EXPECTEDCOUNT="$3"
../dnsperf -t 0.001 -vvv -B -d "$FILESTEM.blob" -s 192.0.2.1 $EXTRAARGS > "$FILESTEM.out" 2>&1
check_sent_and_lost "$FILESTEM" "$EXPECTEDCOUNT"
}
blackhole "emptypayload" "" 1
blackhole "shortpayload" "" 1
blackhole "largestudp" "" 1
# too large for UDP; at least it should not crash
blackhole "largesttcp" "" 0
grep -F 'failed to send packet' largesttcp.out
# valid DNS queries as blobs
expect_noerror() {
FILESTEM="$1"
EXTRAARGS="$2"
EXPECTEDCOUNT="$3"
../dnsperf -vvv -B -d "$srcdir/$FILESTEM.blob" -s 1.1.1.1 $EXTRAARGS > "$FILESTEM.out" 2>&1
grep "Queries sent: $EXPECTEDCOUNT$" "$FILESTEM.out"
grep -F "Queries completed: $EXPECTEDCOUNT (" "$FILESTEM.out"
}
# single plain run
expect_noerror "querywithcookie" "" 1
# loop over the binary twice
expect_noerror "querywithcookie" "-n 2" 2
# multiple queries in one file
expect_noerror "twoquerieswithnsid" "" 2
# file too big to cache
rm -f 10queries.tmp.blob
cat "$srcdir/twoquerieswithnsid.blob" "$srcdir/querywithcookie.blob" "$srcdir/emptypayload.blob" \
"$srcdir/largestudp.blob" "$srcdir/twoquerieswithnsid.blob" "$srcdir/querywithcookie.blob" \
"$srcdir/emptypayload.blob" "$srcdir/largestudp.blob" \
> 10queries.tmp.blob
blackhole2 "10queries.tmp" "" 10
# repeat non-cacheable file the same twice
blackhole2 "10queries.tmp" "-n 2" 20
# large binary on stdin should work too
cat 10queries.tmp.blob | ../dnsperf -t 0.001 -vvv -B -s 192.0.2.1 > "stdinlarge.out" 2>&1
check_sent_and_lost "stdinlarge" 10
# small binary on stdin
cat "$srcdir/twoquerieswithnsid.blob" | ../dnsperf -t 0.001 -vvv -B -s 192.0.2.1 > "stdinsmall.out" 2>&1
check_sent_and_lost "stdinsmall" 2

Binary file not shown.

Binary file not shown.