Skip to content

Commit c3eba0a

Browse files
Shannon Nelsondavem330
authored andcommitted
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>
1 parent fd0e418 commit c3eba0a

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎tools/testing/selftests/net/rtnetlink.sh‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,21 +526,19 @@ kci_test_macsec()
526526
kci_test_ipsec()
527527
{
528528
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-
536529
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
537535

538536
# flush to be sure there's nothing configured
539537
ip x s flush ; ip x p flush
540538
check_err $?
541539

542540
# start the monitor in the background
543-
tmpfile=`mktemp ipsectestXXX`
541+
tmpfile=`mktemp /var/run/ipsectestXXX`
544542
mpid=`(ip x m > $tmpfile & echo $!) 2>/dev/null`
545543
sleep 0.2
546544

@@ -604,6 +602,7 @@ kci_test_ipsec()
604602
check_err $?
605603
ip x p flush
606604
check_err $?
605+
ip addr del $srcip/32 dev $devdummy
607606

608607
if [ $ret -ne 0 ]; then
609608
echo "FAIL: ipsec"

0 commit comments

Comments
 (0)