3 # testscript to check CAN filters and CAN frame flow in Linux network layer
8 if [ $(id -ru) -ne 0 ]; then
9 echo You need to be root to execute these tests
13 # load needed CAN networklayer modules
17 # ensure the vcan driver to perform the ECHO on driver level
19 modprobe -f vcan echo=1
23 # create virtual CAN device
24 ip link add dev $VCAN type vcan || exit 1
27 # check precondition for CAN frame flow test
28 HAS_ECHO=`ip link show $VCAN | grep -c ECHO`
30 if [ $HAS_ECHO -ne 1 ]
35 # test of CAN filters on af_can.c
36 ./tst-filter $VCAN || return 1
38 # test of CAN frame flow down to the netdevice and up again
39 ./tst-rcv-own-msgs $VCAN || return 1
42 echo "CAN networklayer tests succeeded."