summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-08-28 13:14:40 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-08-28 13:14:40 +0000
commit043b552d442f9421a9ec1acfeb7644f797be81e7 (patch)
tree9e2cc82d0bb6d65e1c5db5e1ff8ee96e1b04ce83 /regress
parentef6c62b11b6e5fdfc5a5bc9f16812aaf86c9dcc9 (diff)
Extend maxprefix and maxprefixout tests to also check that the limits
are checked during reload.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefix.rdomain2.conf2
-rw-r--r--regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefixout.rdomain1.conf2
-rw-r--r--regress/usr.sbin/bgpd/integrationtests/maxprefix.sh45
-rw-r--r--regress/usr.sbin/bgpd/integrationtests/maxprefixout.sh45
4 files changed, 85 insertions, 9 deletions
diff --git a/regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefix.rdomain2.conf b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefix.rdomain2.conf
index 63a6e111766..714a7944970 100644
--- a/regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefix.rdomain2.conf
+++ b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefix.rdomain2.conf
@@ -7,7 +7,7 @@ log updates
neighbor 10.12.57.1 {
descr "RDOMAIN1"
remote-as 4200000001
- max-prefix 2
+ #MAX-PREFIX#
}
deny from any
diff --git a/regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefixout.rdomain1.conf b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefixout.rdomain1.conf
index a009d9ca0f3..74a24f8c9ce 100644
--- a/regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefixout.rdomain1.conf
+++ b/regress/usr.sbin/bgpd/integrationtests/bgpd.maxprefixout.rdomain1.conf
@@ -7,7 +7,7 @@ log updates
neighbor 10.12.57.2 {
descr "RDOMAIN2"
remote-as 4200000002
- max-prefix 2 out
+ #MAX-PREFIX#
}
deny from any
diff --git a/regress/usr.sbin/bgpd/integrationtests/maxprefix.sh b/regress/usr.sbin/bgpd/integrationtests/maxprefix.sh
index fa4baf568e1..0fcefe2a0b6 100644
--- a/regress/usr.sbin/bgpd/integrationtests/maxprefix.sh
+++ b/regress/usr.sbin/bgpd/integrationtests/maxprefix.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: maxprefix.sh,v 1.3 2023/02/15 14:19:08 claudio Exp $
+# $OpenBSD: maxprefix.sh,v 1.4 2024/08/28 13:14:39 claudio Exp $
set -e
@@ -64,12 +64,14 @@ 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
+echo test1: run bgpds
+sed -e 's/#MAX-PREFIX#/max-prefix 2/' \
+ ${BGPDCONFIGDIR}/bgpd.maxprefix.rdomain2.conf > \
+ ./bgpd.maxprefix.rdomain2.conf
route -T ${RDOMAIN1} exec ${BGPD} \
-v -f ${BGPDCONFIGDIR}/bgpd.maxprefix.rdomain1.conf
route -T ${RDOMAIN2} exec ${BGPD} \
- -v -f ${BGPDCONFIGDIR}/bgpd.maxprefix.rdomain2.conf
-
+ -v -f ./bgpd.maxprefix.rdomain2.conf
sleep 1
route -T ${RDOMAIN1} exec bgpctl nei RDOMAIN2 up
sleep 1
@@ -87,3 +89,38 @@ route -T ${RDOMAIN1} exec bgpctl network add 10.12.60.0/24
sleep 1
route -T ${RDOMAIN1} exec bgpctl show nei | \
grep '^ Last error received: Cease, received max-prefix exceeded'
+
+echo test1: cleanup
+pkill -T ${RDOMAIN1} bgpd || true
+pkill -T ${RDOMAIN2} bgpd || true
+sleep 1
+
+echo test2: run bgpds
+sed -e 's/#MAX-PREFIX#/max-prefix 10/' \
+ ${BGPDCONFIGDIR}/bgpd.maxprefix.rdomain2.conf > \
+ ./bgpd.maxprefix.rdomain2.conf
+route -T ${RDOMAIN1} exec ${BGPD} \
+ -v -f ${BGPDCONFIGDIR}/bgpd.maxprefix.rdomain1.conf
+route -T ${RDOMAIN2} exec ${BGPD} \
+ -v -f ./bgpd.maxprefix.rdomain2.conf
+sleep 1
+route -T ${RDOMAIN1} exec bgpctl nei RDOMAIN2 up
+sleep 1
+
+echo test2: add three networks
+route -T ${RDOMAIN1} exec bgpctl network add 10.12.58.0/24
+route -T ${RDOMAIN1} exec bgpctl network add 10.12.59.0/24
+route -T ${RDOMAIN1} exec bgpctl network add 10.12.60.0/24
+sleep 1
+route -T ${RDOMAIN1} exec bgpctl show nei | \
+ awk '/^ Prefixes/ { if ($2 == "3") { print "ok"; ok=1; exit 0; } }
+ END { if (ok != 1) { print "bad bgpctl output"; exit 2; } }'
+
+echo test2: reload config
+sed -e 's/#MAX-PREFIX#/max-prefix 2/' \
+ ${BGPDCONFIGDIR}/bgpd.maxprefix.rdomain2.conf > \
+ ./bgpd.maxprefix.rdomain2.conf
+route -T ${RDOMAIN2} exec bgpctl reload
+sleep 1
+route -T ${RDOMAIN1} exec bgpctl show nei | \
+ grep '^ Last error received: Cease, received max-prefix exceeded'
diff --git a/regress/usr.sbin/bgpd/integrationtests/maxprefixout.sh b/regress/usr.sbin/bgpd/integrationtests/maxprefixout.sh
index 77c1fcb6904..644be5d2207 100644
--- a/regress/usr.sbin/bgpd/integrationtests/maxprefixout.sh
+++ b/regress/usr.sbin/bgpd/integrationtests/maxprefixout.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: maxprefixout.sh,v 1.2 2023/02/15 14:19:08 claudio Exp $
+# $OpenBSD: maxprefixout.sh,v 1.3 2024/08/28 13:14:39 claudio Exp $
set -e
@@ -64,9 +64,12 @@ 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
+echo test1: run bgpds
+sed -e 's/#MAX-PREFIX#/max-prefix 2 out/' \
+ ${BGPDCONFIGDIR}/bgpd.maxprefixout.rdomain1.conf > \
+ ./bgpd.maxprefixout.rdomain1.conf
route -T ${RDOMAIN1} exec ${BGPD} \
- -v -f ${BGPDCONFIGDIR}/bgpd.maxprefixout.rdomain1.conf
+ -v -f ./bgpd.maxprefixout.rdomain1.conf
route -T ${RDOMAIN2} exec ${BGPD} \
-v -f ${BGPDCONFIGDIR}/bgpd.maxprefixout.rdomain2.conf
@@ -87,3 +90,39 @@ route -T ${RDOMAIN1} exec bgpctl network add 10.12.60.0/24
sleep 1
route -T ${RDOMAIN1} exec bgpctl show nei | \
grep '^ Last error sent: Cease, sent max-prefix exceeded'
+
+echo test1: cleanup
+pkill -T ${RDOMAIN1} bgpd || true
+pkill -T ${RDOMAIN2} bgpd || true
+sleep 1
+
+echo test2: run bgpds
+sed -e 's/#MAX-PREFIX#/max-prefix 20 out/' \
+ ${BGPDCONFIGDIR}/bgpd.maxprefixout.rdomain1.conf > \
+ ./bgpd.maxprefixout.rdomain1.conf
+route -T ${RDOMAIN1} exec ${BGPD} \
+ -v -f ./bgpd.maxprefixout.rdomain1.conf
+route -T ${RDOMAIN2} exec ${BGPD} \
+ -v -f ${BGPDCONFIGDIR}/bgpd.maxprefixout.rdomain2.conf
+
+sleep 1
+route -T ${RDOMAIN1} exec bgpctl nei RDOMAIN2 up
+sleep 1
+
+echo test2: add three networks
+route -T ${RDOMAIN1} exec bgpctl network add 10.12.58.0/24
+route -T ${RDOMAIN1} exec bgpctl network add 10.12.59.0/24
+route -T ${RDOMAIN1} exec bgpctl network add 10.12.60.0/24
+sleep 1
+route -T ${RDOMAIN1} exec bgpctl show nei | \
+ awk '/^ Prefixes/ { if ($2 == "3") { print "ok"; ok=1; exit 0; } }
+ END { if (ok != 1) { print "bad bgpctl output"; exit 2; } }'
+
+echo test2: reload config
+sed -e 's/#MAX-PREFIX#/max-prefix 2 out/' \
+ ${BGPDCONFIGDIR}/bgpd.maxprefixout.rdomain1.conf > \
+ ./bgpd.maxprefixout.rdomain1.conf
+route -T ${RDOMAIN1} exec bgpctl reload
+sleep 1
+route -T ${RDOMAIN1} exec bgpctl show nei | \
+ grep '^ Last error sent: Cease, sent max-prefix exceeded'