Adding test

This commit is contained in:
Petr Sklenar 2022-01-04 19:52:20 +01:00
commit f664f37374
5 changed files with 179 additions and 0 deletions

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/bind/Regression/bind-does-not-listen-on-all-addresses-over-TCP
# Description: Test for BZ#1999691 (bind does not listen on all addresses over TCP)
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/bind/Regression/bind-does-not-listen-on-all-addresses-over-TCP
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.sh
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Petr Sklenar <psklenar@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1999691 (bind does not listen on all addresses over TCP)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: bind" >> $(METADATA)
@echo "Requires: bind lsof" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1999691" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /CoreOS/bind/Regression/bind-does-not-listen-on-all-addresses-over-TCP
Description: Test for BZ#1999691 (bind does not listen on all addresses over TCP)
Author: Petr Sklenar <psklenar@redhat.com>
Bug summary: bind does not listen on all addresses over TCP when listen-on/listen-on-v6 has specific IPs or any listed
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1999691

View file

@ -0,0 +1,26 @@
summary: Test for BZ#1999691 (bind does not listen on all addresses over TCP)
description: |
Bug summary: bind does not listen on all addresses over TCP when listen-on/listen-on-v6 has specific IPs or any listed
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1999691
contact: Petr Sklenar <psklenar@redhat.com>
component:
- bind
test: ./runtest.sh
framework: beakerlib
recommend:
- bind
- lsof
duration: 15m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1999691
adjust:
- enabled: false
when: distro == rhel-4, rhel-5
continue: false
extra-nitrate: TC#0612648
extra-summary: /CoreOS/bind/Regression/bind-does-not-listen-on-all-addresses-over-TCP
extra-task: /CoreOS/bind/Regression/bind-does-not-listen-on-all-addresses-over-TCP

View file

@ -0,0 +1,40 @@
#!/bin/bash
# modified reproducer from upstream issue
# https://gitlab.isc.org/isc-projects/bind9/-/issues/2852
# Pause bind on loading this file
mkfifo _bind.nta
named -g -c <(echo "options { port 5300; listen-on { any; }; listen-on-v6 { any; }; };") -n 1 &
NAMED_PID=$!
sleep 2
for i in {2..32}; do
sleep 0.05
sudo ip addr add 127.0.0.$i/32 dev lo
[ "$i" = 6 ] && echo -n '' > _bind.nta && GO=1
done
lsof -n -p ${NAMED_PID} | grep :domain
TCP=$(lsof -n -p ${NAMED_PID} | grep 'TCP 127.0.0.' | wc -l)
UDP=$(lsof -n -p ${NAMED_PID} | grep 'UDP 127.0.0.' | wc -l)
echo "TCP: $TCP UDP: $UDP"
sleep 5
#echo "Done adding addresses, press ENTER to terminate."
#read
kill -TERM "${NAMED_PID}"
timeout 5 cat _bind.nta
wait "${NAMED_PID}"
rm -f _bind.nta
for i in {2..32}; do
sudo ip addr del 127.0.0.$i/32 dev lo
done
echo "TCP: $TCP UDP: $UDP"
if [ "$TCP" -ne "$UDP" ]; then
echo "Mismatching listeners!"
exit 1
fi

View file

@ -0,0 +1,44 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/bind/Regression/bind-does-not-listen-on-all-addresses-over-TCP
# Description: Test for BZ#1999691 (bind does not listen on all addresses over TCP)
# Author: Petr Sklenar <psklenar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="bind"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlPhaseEnd
rlPhaseStartTest
# see reproducer.sh :
rlRun "bash ./reproducer.sh"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd