Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: rtnetlink: use dummydev as a test device

We really shouldn't mess with local system settings, so let's
use the already created dummy device instead for ipsec testing.
Oh, and let's put the temp file into a proper directory.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Shannon Nelson and committed by
David S. Miller
c3eba0a4 fd0e418d

+7 -8
+7 -8
tools/testing/selftests/net/rtnetlink.sh
··· 526 526 kci_test_ipsec() 527 527 { 528 528 ret=0 529 - 530 - # find an ip address on this machine and make up a destination 531 - srcip=`ip -o addr | awk '/inet / { print $4; }' | grep -v "^127" | head -1 | cut -f1 -d/` 532 - net=`echo $srcip | cut -f1-3 -d.` 533 - base=`echo $srcip | cut -f4 -d.` 534 - dstip="$net."`expr $base + 1` 535 - 536 529 algo="aead rfc4106(gcm(aes)) 0x3132333435363738393031323334353664636261 128" 530 + srcip=192.168.123.1 531 + dstip=192.168.123.2 532 + spi=7 533 + 534 + ip addr add $srcip dev $devdummy 537 535 538 536 # flush to be sure there's nothing configured 539 537 ip x s flush ; ip x p flush 540 538 check_err $? 541 539 542 540 # start the monitor in the background 543 - tmpfile=`mktemp ipsectestXXX` 541 + tmpfile=`mktemp /var/run/ipsectestXXX` 544 542 mpid=`(ip x m > $tmpfile & echo $!) 2>/dev/null` 545 543 sleep 0.2 546 544 ··· 602 604 check_err $? 603 605 ip x p flush 604 606 check_err $? 607 + ip addr del $srcip/32 dev $devdummy 605 608 606 609 if [ $ret -ne 0 ]; then 607 610 echo "FAIL: ipsec"