From cfd058d622102c18ea9b6ef9cd37530d62debea7 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Tue, 27 Jul 2021 17:55:08 -0700 Subject: [PATCH 1/2] Add a regression test in the RRL system test This commit modifies the MTU of the loopback interface on Linux systems to 1500, so that oversized UDP packets can trigger EMSGSIZE errors, and tests that named handles such errors correctly. Note that the loopback MTU size has not yet been modified for other platforms. --- bin/tests/system/ifconfig.sh.in | 7 ++++++- bin/tests/system/rrl/ns4/named.conf.in | 1 + bin/tests/system/rrl/ns4/tld4.db | 3 +++ bin/tests/system/rrl/tests.sh | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/tests/system/ifconfig.sh.in b/bin/tests/system/ifconfig.sh.in index 52b4a5796d..1e8ccc2521 100755 --- a/bin/tests/system/ifconfig.sh.in +++ b/bin/tests/system/ifconfig.sh.in @@ -19,6 +19,9 @@ # fd92:7065:b8e:99ff::{1..2} # fd92:7065:b8e:ff::{1..2} # +# On Linux, we also set the MTU on the 1500 bytes to match the default MTU on +# physical interfaces, so we can properly test the cases with packets bigger +# than interface MTU. top_srcdir=@abs_top_srcdir@ @@ -73,12 +76,14 @@ case "$1" in if [ $use_ip ]; then ip address add 10.53.$i.$ns/24 \ dev lo:$int + ip link set dev lo:$int mtu 1500 [ "$ipv6" ] && ip address add \ fd92:7065:b8e:${ipv6}ff::$ns/64 \ dev lo else ifconfig lo:$int 10.53.$i.$ns up \ - netmask 255.255.255.0 + netmask 255.255.255.0 \ + mtu 1500 [ "$ipv6" ] && ifconfig lo inet6 add \ fd92:7065:b8e:${ipv6}ff::$ns/64 fi diff --git a/bin/tests/system/rrl/ns4/named.conf.in b/bin/tests/system/rrl/ns4/named.conf.in index 028281fe74..864b67f25d 100644 --- a/bin/tests/system/rrl/ns4/named.conf.in +++ b/bin/tests/system/rrl/ns4/named.conf.in @@ -22,6 +22,7 @@ options { notify no; recursion yes; dnssec-validation yes; + max-udp-size 4096; rate-limit { responses-per-second 2; diff --git a/bin/tests/system/rrl/ns4/tld4.db b/bin/tests/system/rrl/ns4/tld4.db index 5b746a01ab..1527775ca7 100644 --- a/bin/tests/system/rrl/ns4/tld4.db +++ b/bin/tests/system/rrl/ns4/tld4.db @@ -40,3 +40,6 @@ a8 A 192.0.2.8 ; a9 for all-per-second limit $GENERATE 101-180 all$.a9 A 192.0.2.8 + +; oversized TXT record +$GENERATE 1-100 big 1 TXT "txt$" diff --git a/bin/tests/system/rrl/tests.sh b/bin/tests/system/rrl/tests.sh index 846f692989..126578f343 100644 --- a/bin/tests/system/rrl/tests.sh +++ b/bin/tests/system/rrl/tests.sh @@ -270,6 +270,10 @@ $DIG $DIGOPTS @$ns4 A a7.tld4 > /dev/null 2>&1 $DIG $DIGOPTS @$ns4 A a7.tld4 > /dev/null 2>&1 $DIG $DIGOPTS @$ns4 A a7.tld4 > /dev/null 2>&1 +# regression test for GL #2839 +DIGOPTS="+bufsize=4096 +ignore -p ${PORT}" +$DIG $DIGOPTS @$ns4 TXT big.tld4 > /dev/null 2>&1 + grep "would limit" ns4/named.run >/dev/null 2>&1 || setret "\"would limit\" not found in log file." From d8363845b683b2db638cedb8f4b866e4a910271d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Wed, 25 Aug 2021 14:58:46 +0200 Subject: [PATCH 2/2] Lower loopback MTU size on other unix systems as well This change should cover recent versions of: Solaris, illumos, OpenBSD, FreeBSD, Dragonfly BSD, NetBSD. --- bin/tests/system/ifconfig.sh.in | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/tests/system/ifconfig.sh.in b/bin/tests/system/ifconfig.sh.in index 1e8ccc2521..d149962f5e 100755 --- a/bin/tests/system/ifconfig.sh.in +++ b/bin/tests/system/ifconfig.sh.in @@ -19,9 +19,9 @@ # fd92:7065:b8e:99ff::{1..2} # fd92:7065:b8e:ff::{1..2} # -# On Linux, we also set the MTU on the 1500 bytes to match the default MTU on -# physical interfaces, so we can properly test the cases with packets bigger -# than interface MTU. +# We also set the MTU on the 1500 bytes to match the default MTU on physical +# interfaces, so we can properly test the cases with packets bigger than +# interface MTU. top_srcdir=@abs_top_srcdir@ @@ -68,6 +68,7 @@ case "$1" in *-*-solaris2.[8-9]|*-*-solaris2.1[0-9]) /sbin/ifconfig lo0:$int plumb /sbin/ifconfig lo0:$int 10.53.$i.$ns up + /sbin/ifconfig lo0:$int mtu 1500 /sbin/ifconfig lo0:$int inet6 plumb [ "$ipv6" ] && /sbin/ifconfig lo0:$int \ inet6 fd92:7065:b8e:${ipv6}ff::$ns up @@ -90,13 +91,15 @@ case "$1" in ;; *-unknown-freebsd*) ifconfig lo0 10.53.$i.$ns alias \ - netmask 0xffffffff + netmask 0xffffffff \ + mtu 1500 [ "$ipv6" ] && ifconfig lo0 inet6 \ fd92:7065:b8e:${ipv6}ff::$ns alias ;; *-unknown-dragonfly*|*-unknown-netbsd*|*-unknown-openbsd*) ifconfig lo0 10.53.$i.$ns alias \ - netmask 255.255.255.0 + netmask 255.255.255.0 \ + mtu 1500 [ "$ipv6" ] && ifconfig lo0 inet6 \ fd92:7065:b8e:${ipv6}ff::$ns alias ;;