-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathmrdisc.sh
executable file
·36 lines (29 loc) · 884 Bytes
/
mrdisc.sh
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
#!/bin/sh
# Verifies IPv4 mrdisc messages on all interfaces it is enabled on
# Runs for two intervals to ensure interval timer works properly.
#set -x
# shellcheck source=/dev/null
. "$(dirname "$0")/lib.sh"
print "Creating world ..."
topo basic
ip addr add 10.0.0.1/24 dev a1
ip addr add 20.0.0.1/24 dev a2
ip -br a
print "Creating config ..."
cat <<EOF > "/tmp/$NM/conf"
phyint a1 enable mrdisc
phyint a2 enable mrdisc
EOF
cat "/tmp/$NM/conf"
print "Starting smcrouted ..."
../src/smcrouted -f "/tmp/$NM/conf" -n -N -P "/tmp/$NM/pid" -l debug -u "/tmp/$NM/sock" -m 4 &
sleep 1
collect a2 -c3 'dst 224.0.0.106'
sleep 10
print "Analyzing ..."
lines=$(tshark -r "/tmp/$NM/pcap" 2>/dev/null | grep 224.0.0.106 | tee "/tmp/$NM/result" | wc -l)
cat "/tmp/$NM/result"
echo " => $lines for 224.0.0.106 (MRDISC), expected >= 2"
# shellcheck disable=SC2086
[ $lines -ge 2 ] && OK
FAIL