From: claudio Date: Wed, 25 Sep 2024 14:42:39 +0000 (+0000) Subject: Add a maxattr regress test that causes the rdomain1 bgpd instance to trip X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4532df1c40b4df3d7f61b1694d736813cd3e74bf;p=openbsd Add a maxattr regress test that causes the rdomain1 bgpd instance to trip over 4096 bytes for a BGP UPDATE message. Check on the 3rd system that the affected prefixes are properly withdrawn. --- diff --git a/regress/usr.sbin/bgpd/integrationtests/Makefile b/regress/usr.sbin/bgpd/integrationtests/Makefile index 5208dc2d268..48e20128228 100644 --- a/regress/usr.sbin/bgpd/integrationtests/Makefile +++ b/regress/usr.sbin/bgpd/integrationtests/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.24 2024/04/09 09:35:57 claudio Exp $ +# $OpenBSD: Makefile,v 1.25 2024/09/25 14:42:39 claudio Exp $ REGRESS_TARGETS = network_statement md5 ovs capa policy pftable \ - mrt maxprefix maxprefixout maxcomm l3vpn \ - ixp lladdr \ + mrt maxprefix maxprefixout maxcomm maxattr \ + l3vpn ixp lladdr \ as0 med eval_all attr BGPD ?= /usr/sbin/bgpd @@ -42,6 +42,9 @@ maxprefixout: maxcomm: ${SUDO} ksh ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11 12 pair11 pair12 +maxattr: + ${SUDO} ksh ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11 12 pair11 pair12 + l3vpn: ${SUDO} ksh ${.CURDIR}/$@.sh ${BGPD} ${.CURDIR} 11 12 pair11 pair12 13 14 diff --git a/regress/usr.sbin/bgpd/integrationtests/bgpd.maxattr.rdomain1.conf b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxattr.rdomain1.conf new file mode 100644 index 00000000000..5120c724a40 --- /dev/null +++ b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxattr.rdomain1.conf @@ -0,0 +1,27 @@ +AS 4200000001 +router-id 10.12.57.1 +fib-update no + +log updates + +neighbor 10.12.57.2 { + descr "RDOMAIN2_1" + remote-as 4200000002 +} +neighbor 10.12.57.3 { + descr "RDOMAIN2_2" + remote-as 4200000003 +} + +match from any community 42:1 set prepend-self 1 +match from any community 42:2 set prepend-self 4 +match from any community 42:3 set { community 42:43 } +match from any community 42:4 set { + community 42:43 + community 42:10 + community 42:11 + community 42:12 +} + +allow from any +allow to any diff --git a/regress/usr.sbin/bgpd/integrationtests/bgpd.maxattr.rdomain2_1.conf b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxattr.rdomain2_1.conf new file mode 100644 index 00000000000..f19ab1280b9 --- /dev/null +++ b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxattr.rdomain2_1.conf @@ -0,0 +1,375 @@ +AS 4200000002 +router-id 10.12.57.2 +fib-update no + +log updates + +listen on 10.12.57.2 + +neighbor 10.12.57.1 { + descr "RDOMAIN1" + remote-as 4200000001 + local-address 10.12.57.2 +} + +match to any community 0:1 set { + community 0:10 + community 0:11 + community 0:12 + community 0:13 + community 0:14 + community 0:15 + community 0:16 + community 0:17 +} + +match to any community 0:10 set { + large-community local-as:0:1 + large-community local-as:0:2 + large-community local-as:0:3 + large-community local-as:0:4 + large-community local-as:0:5 + large-community local-as:0:6 + large-community local-as:0:7 + large-community local-as:0:8 + large-community local-as:0:9 + large-community local-as:0:10 + large-community local-as:0:11 + large-community local-as:0:12 + large-community local-as:0:13 + large-community local-as:0:14 + large-community local-as:0:15 + large-community local-as:0:16 + large-community local-as:0:17 + large-community local-as:0:18 + large-community local-as:0:19 + large-community local-as:0:20 + large-community local-as:0:21 + large-community local-as:0:22 + large-community local-as:0:23 + large-community local-as:0:24 + large-community local-as:0:25 + large-community local-as:0:26 + large-community local-as:0:27 + large-community local-as:0:28 + large-community local-as:0:29 + large-community local-as:0:30 + large-community local-as:0:31 + large-community local-as:0:32 + large-community local-as:0:33 + large-community local-as:0:34 + large-community local-as:0:35 + large-community local-as:0:36 + large-community local-as:0:37 + large-community local-as:0:38 + large-community local-as:0:39 + large-community local-as:0:40 + large-community local-as:0:41 + large-community local-as:0:42 + large-community local-as:0:43 + large-community local-as:0:44 + large-community local-as:0:45 + large-community local-as:0:46 + large-community local-as:0:47 + large-community local-as:0:48 + large-community local-as:0:49 + large-community local-as:0:50 +} +match to any community 0:11 set { + large-community local-as:1:1 + large-community local-as:1:2 + large-community local-as:1:3 + large-community local-as:1:4 + large-community local-as:1:5 + large-community local-as:1:6 + large-community local-as:1:7 + large-community local-as:1:8 + large-community local-as:1:9 + large-community local-as:1:10 + large-community local-as:1:11 + large-community local-as:1:12 + large-community local-as:1:13 + large-community local-as:1:14 + large-community local-as:1:15 + large-community local-as:1:16 + large-community local-as:1:17 + large-community local-as:1:18 + large-community local-as:1:19 + large-community local-as:1:20 + large-community local-as:1:21 + large-community local-as:1:22 + large-community local-as:1:23 + large-community local-as:1:24 + large-community local-as:1:25 + large-community local-as:1:26 + large-community local-as:1:27 + large-community local-as:1:28 + large-community local-as:1:29 + large-community local-as:1:30 + large-community local-as:1:31 + large-community local-as:1:32 + large-community local-as:1:33 + large-community local-as:1:34 + large-community local-as:1:35 + large-community local-as:1:36 + large-community local-as:1:37 + large-community local-as:1:38 + large-community local-as:1:39 + large-community local-as:1:40 + large-community local-as:1:41 + large-community local-as:1:42 + large-community local-as:1:43 + large-community local-as:1:44 + large-community local-as:1:45 + large-community local-as:1:46 + large-community local-as:1:47 + large-community local-as:1:48 + large-community local-as:1:49 + large-community local-as:1:50 +} +match to any community 0:12 set { + large-community local-as:2:1 + large-community local-as:2:2 + large-community local-as:2:3 + large-community local-as:2:4 + large-community local-as:2:5 + large-community local-as:2:6 + large-community local-as:2:7 + large-community local-as:2:8 + large-community local-as:2:9 + large-community local-as:2:10 + large-community local-as:2:11 + large-community local-as:2:12 + large-community local-as:2:13 + large-community local-as:2:14 + large-community local-as:2:15 + large-community local-as:2:16 + large-community local-as:2:17 + large-community local-as:2:18 + large-community local-as:2:19 + large-community local-as:2:20 + large-community local-as:2:21 + large-community local-as:2:22 + large-community local-as:2:23 + large-community local-as:2:24 + large-community local-as:2:25 + large-community local-as:2:26 + large-community local-as:2:27 + large-community local-as:2:28 + large-community local-as:2:29 + large-community local-as:2:30 + large-community local-as:2:31 + large-community local-as:2:32 + large-community local-as:2:33 + large-community local-as:2:34 + large-community local-as:2:35 + large-community local-as:2:36 + large-community local-as:2:37 + large-community local-as:2:38 + large-community local-as:2:39 + large-community local-as:2:40 + large-community local-as:2:41 + large-community local-as:2:42 + large-community local-as:2:43 + large-community local-as:2:44 + large-community local-as:2:45 + large-community local-as:2:46 + large-community local-as:2:47 + large-community local-as:2:48 + large-community local-as:2:49 + large-community local-as:2:50 +} +match to any community 0:13 set { + large-community local-as:3:1 + large-community local-as:3:2 + large-community local-as:3:3 + large-community local-as:3:4 + large-community local-as:3:5 + large-community local-as:3:6 + large-community local-as:3:7 + large-community local-as:3:8 + large-community local-as:3:9 + large-community local-as:3:10 + large-community local-as:3:11 + large-community local-as:3:12 + large-community local-as:3:13 + large-community local-as:3:14 + large-community local-as:3:15 + large-community local-as:3:16 + large-community local-as:3:17 + large-community local-as:3:18 + large-community local-as:3:19 + large-community local-as:3:20 + large-community local-as:3:21 + large-community local-as:3:22 + large-community local-as:3:23 + large-community local-as:3:24 + large-community local-as:3:25 + large-community local-as:3:26 + large-community local-as:3:27 + large-community local-as:3:28 + large-community local-as:3:29 + large-community local-as:3:30 + large-community local-as:3:31 + large-community local-as:3:32 + large-community local-as:3:33 + large-community local-as:3:34 + large-community local-as:3:35 + large-community local-as:3:36 + large-community local-as:3:37 + large-community local-as:3:38 + large-community local-as:3:39 + large-community local-as:3:40 + large-community local-as:3:41 + large-community local-as:3:42 + large-community local-as:3:43 + large-community local-as:3:44 + large-community local-as:3:45 + large-community local-as:3:46 + large-community local-as:3:47 + large-community local-as:3:48 + large-community local-as:3:49 + large-community local-as:3:50 +} +match to any community 0:14 set { + large-community local-as:4:1 + large-community local-as:4:2 + large-community local-as:4:3 + large-community local-as:4:4 + large-community local-as:4:5 + large-community local-as:4:6 + large-community local-as:4:7 + large-community local-as:4:8 + large-community local-as:4:9 + large-community local-as:4:10 + large-community local-as:4:11 + large-community local-as:4:12 + large-community local-as:4:13 + large-community local-as:4:14 + large-community local-as:4:15 + large-community local-as:4:16 + large-community local-as:4:17 + large-community local-as:4:18 + large-community local-as:4:19 + large-community local-as:4:20 + large-community local-as:4:21 + large-community local-as:4:22 + large-community local-as:4:23 + large-community local-as:4:24 + large-community local-as:4:25 + large-community local-as:4:26 + large-community local-as:4:27 + large-community local-as:4:28 + large-community local-as:4:29 + large-community local-as:4:30 + large-community local-as:4:31 + large-community local-as:4:32 + large-community local-as:4:33 + large-community local-as:4:34 + large-community local-as:4:35 + large-community local-as:4:36 + large-community local-as:4:37 + large-community local-as:4:38 + large-community local-as:4:39 + large-community local-as:4:40 + large-community local-as:4:41 + large-community local-as:4:42 + large-community local-as:4:43 + large-community local-as:4:44 + large-community local-as:4:45 + large-community local-as:4:46 + large-community local-as:4:47 + large-community local-as:4:48 + large-community local-as:4:49 + large-community local-as:4:50 +} +match to any community 0:15 set { + large-community local-as:5:1 + large-community local-as:5:2 + large-community local-as:5:3 + large-community local-as:5:4 + large-community local-as:5:5 + large-community local-as:5:6 + large-community local-as:5:7 + large-community local-as:5:8 + large-community local-as:5:9 + large-community local-as:5:10 + large-community local-as:5:11 + large-community local-as:5:12 + large-community local-as:5:13 + large-community local-as:5:14 + large-community local-as:5:15 + large-community local-as:5:16 + large-community local-as:5:17 + large-community local-as:5:18 + large-community local-as:5:19 + large-community local-as:5:20 + large-community local-as:5:21 + large-community local-as:5:22 + large-community local-as:5:23 + large-community local-as:5:24 + large-community local-as:5:25 + large-community local-as:5:26 + large-community local-as:5:27 + large-community local-as:5:28 + large-community local-as:5:29 + large-community local-as:5:30 + large-community local-as:5:31 + large-community local-as:5:32 + large-community local-as:5:33 + large-community local-as:5:34 + large-community local-as:5:35 + large-community local-as:5:36 + large-community local-as:5:37 + large-community local-as:5:38 + large-community local-as:5:39 + large-community local-as:5:40 + large-community local-as:5:41 + large-community local-as:5:42 + large-community local-as:5:43 + large-community local-as:5:44 + large-community local-as:5:45 + large-community local-as:5:46 + large-community local-as:5:47 + large-community local-as:5:48 + large-community local-as:5:49 + large-community local-as:5:50 +} +match to any community 0:16 set { + large-community local-as:6:1 + large-community local-as:6:2 + large-community local-as:6:3 + large-community local-as:6:4 + large-community local-as:6:5 + large-community local-as:6:6 + large-community local-as:6:7 + large-community local-as:6:8 + large-community local-as:6:9 + large-community local-as:6:10 + large-community local-as:6:11 + large-community local-as:6:12 + large-community local-as:6:13 + large-community local-as:6:14 + large-community local-as:6:15 + large-community local-as:6:16 + large-community local-as:6:17 + large-community local-as:6:18 + large-community local-as:6:19 + large-community local-as:6:20 + large-community local-as:6:21 + large-community local-as:6:22 + large-community local-as:6:23 + large-community local-as:6:24 + large-community local-as:6:25 + large-community local-as:6:26 + large-community local-as:6:27 + large-community local-as:6:28 + large-community local-as:6:29 + large-community local-as:6:30 + large-community local-as:6:31 + large-community local-as:6:32 + large-community local-as:6:33 +} + +allow from any +allow to any diff --git a/regress/usr.sbin/bgpd/integrationtests/bgpd.maxattr.rdomain2_2.conf b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxattr.rdomain2_2.conf new file mode 100644 index 00000000000..ddd64b6577c --- /dev/null +++ b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxattr.rdomain2_2.conf @@ -0,0 +1,18 @@ +AS 4200000003 +router-id 10.12.57.3 +fib-update no + +log updates + +listen on 10.12.57.3 + +socket "/var/run/bgpd.sock.12_2" + +neighbor 10.12.57.1 { + descr "RDOMAIN1" + remote-as 4200000001 + local-address 10.12.57.3 +} + +allow from any +allow to any diff --git a/regress/usr.sbin/bgpd/integrationtests/maxattr.sh b/regress/usr.sbin/bgpd/integrationtests/maxattr.sh new file mode 100644 index 00000000000..af5282f003b --- /dev/null +++ b/regress/usr.sbin/bgpd/integrationtests/maxattr.sh @@ -0,0 +1,111 @@ +#!/bin/ksh +# $OpenBSD: maxattr.sh,v 1.1 2024/09/25 14:42:39 claudio Exp $ + +set -e + +BGPD=$1 +BGPDCONFIGDIR=$2 +RDOMAIN1=$3 +RDOMAIN2=$4 +PAIR1=$5 +PAIR2=$6 + +RDOMAINS="${RDOMAIN1} ${RDOMAIN2}" +PAIRS="${PAIR1} ${PAIR2}" +PAIR1IP=10.12.57.1 +PAIR2IP=10.12.57.2 +PAIR2IP2=10.12.57.3 + +error_notify() { + echo cleanup + pfctl -q -t bgpd_integ_test -T kill + pkill -T ${RDOMAIN1} bgpd || true + pkill -T ${RDOMAIN2} bgpd || true + sleep 1 + ifconfig ${PAIR2} destroy || true + ifconfig ${PAIR1} destroy || true + route -qn -T ${RDOMAIN1} flush || true + route -qn -T ${RDOMAIN2} flush || true + ifconfig lo${RDOMAIN1} destroy || true + ifconfig lo${RDOMAIN2} destroy || true + if [ $1 -ne 0 ]; then + echo FAILED + exit 1 + else + echo SUCCESS + fi +} + +if [ "$(id -u)" -ne 0 ]; then + echo need root privileges >&2 + exit 1 +fi + +trap 'error_notify $?' EXIT + +echo check if rdomains are busy +for n in ${RDOMAINS}; do + if /sbin/ifconfig | grep -v "^lo${n}:" | grep " rdomain ${n} "; then + echo routing domain ${n} is already used >&2 + exit 1 + fi +done + +echo check if interfaces are busy +for n in ${PAIRS}; do + /sbin/ifconfig "${n}" >/dev/null 2>&1 && \ + ( echo interface ${n} is already used >&2; exit 1 ) +done + +set -x + +echo setup +ifconfig ${PAIR1} rdomain ${RDOMAIN1} ${PAIR1IP}/29 up +ifconfig ${PAIR2} rdomain ${RDOMAIN2} ${PAIR2IP}/29 up +ifconfig ${PAIR2} alias ${PAIR2IP2}/32 +ifconfig ${PAIR1} patch ${PAIR2} +ifconfig lo${RDOMAIN1} inet 127.0.0.1/8 +ifconfig lo${RDOMAIN2} inet 127.0.0.1/8 + +echo run bgpds +route -T ${RDOMAIN1} exec ${BGPD} \ + -v -f ${BGPDCONFIGDIR}/bgpd.maxattr.rdomain1.conf +sleep 2 +route -T ${RDOMAIN2} exec ${BGPD} \ + -v -f ${BGPDCONFIGDIR}/bgpd.maxattr.rdomain2_1.conf +route -T ${RDOMAIN2} exec ${BGPD} \ + -v -f ${BGPDCONFIGDIR}/bgpd.maxattr.rdomain2_2.conf +sleep 1 + +echo inject initial prefixes +route -T ${RDOMAIN2} exec bgpctl network add 10.12.60.0/24 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.61.0/24 community 0:1 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.62.0/24 community 0:1 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.63.0/24 community 0:1 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.64.0/24 community 0:1 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.65.0/24 community 0:1 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.66.0/24 community 0:1 + +sleep 4 +echo test1: check propagation +route -T ${RDOMAIN1} exec bgpctl show rib out | tee maxattr.test1.out +route -T ${RDOMAIN2} exec bgpctl -s /var/run/bgpd.sock.12_2 show rib | tee -a maxattr.test1.out + +echo update prefixes +route -T ${RDOMAIN2} exec bgpctl network add 10.12.62.0/24 community 0:1 community 42:1 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.63.0/24 community 0:1 community 42:2 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.64.0/24 community 0:1 community 42:3 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.65.0/24 community 0:1 community 42:4 +route -T ${RDOMAIN2} exec bgpctl network add 10.12.66.0/24 community 0:1 community 42:5 + +sleep 2 +echo test2: check propagation +route -T ${RDOMAIN1} exec bgpctl show rib out | tee maxattr.test2.out +route -T ${RDOMAIN2} exec bgpctl -s /var/run/bgpd.sock.12_2 show rib | tee -a maxattr.test2.out + +echo check results +diff -u ${BGPDCONFIGDIR}/maxattr.test1.ok maxattr.test1.out +diff -u ${BGPDCONFIGDIR}/maxattr.test2.ok maxattr.test2.out +echo OK + +exit 0 diff --git a/regress/usr.sbin/bgpd/integrationtests/maxattr.test1.ok b/regress/usr.sbin/bgpd/integrationtests/maxattr.test1.ok new file mode 100644 index 00000000000..5cef78fb16e --- /dev/null +++ b/regress/usr.sbin/bgpd/integrationtests/maxattr.test1.ok @@ -0,0 +1,28 @@ +flags: * = Valid, > = Selected, I = via IBGP, A = Announced, + S = Stale, E = Error, F = Filtered +origin validation state: N = not-found, V = valid, ! = invalid +aspa validation state: ? = unknown, V = valid, ! = invalid +origin: i = IGP, e = EGP, ? = Incomplete + +flags vs destination gateway lpref med aspath origin +* N-? 10.12.60.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.61.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.62.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.63.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.64.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.65.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.66.0/24 10.12.57.2 100 0 4200000001 4200000002 i +flags: * = Valid, > = Selected, I = via IBGP, A = Announced, + S = Stale, E = Error, F = Filtered +origin validation state: N = not-found, V = valid, ! = invalid +aspa validation state: ? = unknown, V = valid, ! = invalid +origin: i = IGP, e = EGP, ? = Incomplete + +flags vs destination gateway lpref med aspath origin +*> N-? 10.12.60.0/24 10.12.57.2 100 0 4200000001 4200000002 i +*> N-? 10.12.61.0/24 10.12.57.2 100 0 4200000001 4200000002 i +*> N-? 10.12.62.0/24 10.12.57.2 100 0 4200000001 4200000002 i +*> N-? 10.12.63.0/24 10.12.57.2 100 0 4200000001 4200000002 i +*> N-? 10.12.64.0/24 10.12.57.2 100 0 4200000001 4200000002 i +*> N-? 10.12.65.0/24 10.12.57.2 100 0 4200000001 4200000002 i +*> N-? 10.12.66.0/24 10.12.57.2 100 0 4200000001 4200000002 i diff --git a/regress/usr.sbin/bgpd/integrationtests/maxattr.test2.ok b/regress/usr.sbin/bgpd/integrationtests/maxattr.test2.ok new file mode 100644 index 00000000000..677366a4f5b --- /dev/null +++ b/regress/usr.sbin/bgpd/integrationtests/maxattr.test2.ok @@ -0,0 +1,24 @@ +flags: * = Valid, > = Selected, I = via IBGP, A = Announced, + S = Stale, E = Error, F = Filtered +origin validation state: N = not-found, V = valid, ! = invalid +aspa validation state: ? = unknown, V = valid, ! = invalid +origin: i = IGP, e = EGP, ? = Incomplete + +flags vs destination gateway lpref med aspath origin +* N-? 10.12.60.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.61.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.62.0/24 10.12.57.2 100 0 4200000001 4200000001 4200000002 i +* N-? 10.12.63.0/24 10.12.57.2 100 0 4200000001 4200000001 4200000001 4200000001 4200000001 4200000002 i +* N-? 10.12.64.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.65.0/24 10.12.57.2 100 0 4200000001 4200000002 i +* N-? 10.12.66.0/24 10.12.57.2 100 0 4200000001 4200000002 i +flags: * = Valid, > = Selected, I = via IBGP, A = Announced, + S = Stale, E = Error, F = Filtered +origin validation state: N = not-found, V = valid, ! = invalid +aspa validation state: ? = unknown, V = valid, ! = invalid +origin: i = IGP, e = EGP, ? = Incomplete + +flags vs destination gateway lpref med aspath origin +*> N-? 10.12.60.0/24 10.12.57.2 100 0 4200000001 4200000002 i +*> N-? 10.12.61.0/24 10.12.57.2 100 0 4200000001 4200000002 i +*> N-? 10.12.66.0/24 10.12.57.2 100 0 4200000001 4200000002 i