Commit 452fa2171e for bind
commit 452fa2171e3948cc4a71124cc5312cb3d9ba37a7
Author: Nicki Křížek <nicki@isc.org>
Date: Fri Nov 6 13:11:44 2026 +0000
Check TYPE0 records in updates from pytest
Both cases fed hand-written hex to packet.pl. dnspython builds the
same packets but for the message ID and the record's owner, which the
hex gave as a compression pointer to the root name; named decodes both
to the same name before it rejects the TYPE0 record. The new module
also checks the FORMERR reply, not just the log line. The
requires_net_dns mark on the shell test stays for update_test.pl.
Assisted-by: Claude:claude-opus-5-5
diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh
index 8bacefc941..74a816d413 100755
--- a/bin/tests/system/nsupdate/tests.sh
+++ b/bin/tests/system/nsupdate/tests.sh
@@ -482,34 +482,6 @@ grep "status: NOERROR" dig.out.ns1.$n >/dev/null || ret=1
status=1
}
-n=$((n + 1))
-ret=0
-echo_i "check that TYPE=0 update is handled ($n)"
-nextpart ns1/named.run >/dev/null
-echo "a0e4280000010000000100000000060001c00c000000fe000000000000" \
- | $PERL ../packet.pl -a 10.53.0.1 -p ${PORT} -t tcp -b >/dev/null || ret=1
-wait_for_log 2 "message parsing failed: FORMERR" ns1/named.run || ret=1
-$DIG $DIGOPTS +tcp version.bind txt ch @10.53.0.1 >dig.out.ns1.$n || ret=1
-grep "status: NOERROR" dig.out.ns1.$n >/dev/null || ret=1
-[ $ret = 0 ] || {
- echo_i "failed"
- status=1
-}
-
-n=$((n + 1))
-ret=0
-echo_i "check that TYPE=0 additional data is handled ($n)"
-nextpart ns1/named.run >/dev/null
-echo "a0e4280000010000000000010000060001c00c000000fe000000000000" \
- | $PERL ../packet.pl -a 10.53.0.1 -p ${PORT} -t tcp -b >/dev/null || ret=1
-wait_for_log 2 "message parsing failed: FORMERR" ns1/named.run || ret=1
-$DIG $DIGOPTS +tcp version.bind txt ch @10.53.0.1 >dig.out.ns1.$n || ret=1
-grep "status: NOERROR" dig.out.ns1.$n >/dev/null || ret=1
-[ $ret = 0 ] || {
- echo_i "failed"
- status=1
-}
-
n=$((n + 1))
ret=0
echo_i "check that address family mismatch is handled ($n)"
diff --git a/bin/tests/system/nsupdate/tests_type0.py b/bin/tests/system/nsupdate/tests_type0.py
new file mode 100644
index 0000000000..97865034e0
--- /dev/null
+++ b/bin/tests/system/nsupdate/tests_type0.py
@@ -0,0 +1,48 @@
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+#
+# SPDX-License-Identifier: MPL-2.0
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, you can obtain one at https://mozilla.org/MPL/2.0/.
+#
+# See the COPYRIGHT file distributed with this work for additional
+# information regarding copyright ownership.
+
+import dns.name
+import dns.rdataclass
+import dns.rdatatype
+import dns.rrset
+import dns.update
+import pytest
+
+import isctest
+
+# what setup.sh and the servers leave behind
+pytestmark = pytest.mark.extra_artifacts(
+ [
+ "ns*/*.bk",
+ "ns*/*.db*",
+ "ns*/*.key",
+ "ns1/tls.conf",
+ "ns3/K*",
+ "ns3/dsset-*",
+ "verylarge",
+ ]
+)
+
+
+@pytest.mark.parametrize(
+ "section",
+ [dns.update.UpdateSection.UPDATE, dns.update.UpdateSection.ADDITIONAL],
+ ids=["update", "additional"],
+)
+def test_type0_record_in_update(section, ns1):
+ msg = dns.update.UpdateMessage(".")
+ rrset = dns.rrset.RRset(dns.name.root, dns.rdataclass.NONE, dns.rdatatype.TYPE0)
+ msg.section_from_number(section).append(rrset)
+
+ with ns1.watch_log_from_here() as watcher:
+ res = isctest.query.tcp(msg, ns1.ip)
+ isctest.check.formerr(res)
+ watcher.wait_for_line("message parsing failed: FORMERR")