blob: c54ccc5bf200184ac80433948695b0147d18c6d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/ksh
# $OpenBSD: mrt.sh,v 1.1 2019/06/22 08:26:26 claudio Exp $
set -e
BGPD=$1
BGPDCONFIGDIR=$2
RDOMAIN1=$3
error_notify() {
echo cleanup
pkill -T ${RDOMAIN1} bgpd || true
sleep 1
echo cleanup rdomain
route -qn -T ${RDOMAIN1} flush || true
echo cleanup interfaces
ifconfig mpe${RDOMAIN1} destroy || true
ifconfig lo${RDOMAIN1} destroy || true
if [ $1 -ne 0 ]; then
echo FAILED
exit 1
else
echo SUCCESS
fi
}
trap 'error_notify $?' EXIT
echo check if rdomains are busy
if /sbin/ifconfig lo${RDOMAIN1} > /dev/null 2>&1; then
echo routing domain ${RDOMAIN1} is already used >&2; exit 1;
fi
echo setup
ifconfig mpe${RDOMAIN1} rdomain ${RDOMAIN1} mplslabel 42
ifconfig lo${RDOMAIN1} inet 127.0.0.1/8
route -T ${RDOMAIN1} exec ${BGPD} \
-v -f ${BGPDCONFIGDIR}/bgpd.mrt.conf
sleep 2
pkill -USR1 -T ${RDOMAIN1} -U 0 bgpd
sleep 2
for i in table-v2 table-mp table; do
echo test $i
bgpctl show mrt detail file mrt-$i.mrt | \
grep -v 'Last update:' > mrt-$i.out
diff -u ${BGPDCONFIGDIR}/mrt-$i.ok mrt-$i.out
done
exit 0
|